mirror of
https://github.com/mediacms-io/mediacms.git
synced 2025-12-17 09:02:31 -05:00
feat: translations support
This commit is contained in:
@@ -12,3 +12,5 @@ export * from './propTypeFilters';
|
||||
export { default as publishedOnDate } from './publishedOnDate';
|
||||
export * from './quickSort';
|
||||
export * from './requests';
|
||||
export { translateString } from './translate';
|
||||
export { replaceString } from './replacementStrings';
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
// check templates/config/installation/translations.html for more
|
||||
|
||||
export function replaceString(string) {
|
||||
for (const key in window.REPLACEMENTS) {
|
||||
string = string.replace(key, window.REPLACEMENTS[key]);
|
||||
}
|
||||
return string;
|
||||
}
|
||||
9
frontend/src/static/js/utils/helpers/translate.js
Normal file
9
frontend/src/static/js/utils/helpers/translate.js
Normal file
@@ -0,0 +1,9 @@
|
||||
// check templates/config/installation/translations.html for more
|
||||
|
||||
export function translateString(string) {
|
||||
if (window.TRANSLATION && window.TRANSLATION[string]) {
|
||||
return window.TRANSLATION[string];
|
||||
} else {
|
||||
return string;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user