feat: translations support

This commit is contained in:
Markos Gogoulos
2024-10-04 13:17:40 +03:00
committed by GitHub
parent ef4067cbdd
commit 4992cc425c
84 changed files with 2303 additions and 161 deletions

View File

@@ -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';

View File

@@ -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;
}

View 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;
}
}