mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-14 02:37:08 -07:00
Fix Localization Serialization
This commit is contained in:
parent
9f1ec2a2c3
commit
937a8518ad
4 changed files with 34 additions and 12 deletions
|
@ -4,6 +4,7 @@ interface CssExports {
|
|||
'deleteButton': string;
|
||||
'hideMetadataProfile': string;
|
||||
'labelIcon': string;
|
||||
'message': string;
|
||||
}
|
||||
export const cssExports: CssExports;
|
||||
export default cssExports;
|
||||
|
|
|
@ -7,7 +7,7 @@ function getTranslations() {
|
|||
dataType: 'json',
|
||||
url: '/localization',
|
||||
success: function(data) {
|
||||
localization = data.Strings;
|
||||
localization = data.strings;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -19,12 +19,13 @@ function getTranslations() {
|
|||
const translations = getTranslations();
|
||||
|
||||
export default function translate(key, args = '') {
|
||||
const translation = translations[key] || key;
|
||||
|
||||
if (args) {
|
||||
const translatedKey = translate(key);
|
||||
return translatedKey.replace(/\{(\d+)\}/g, (match, index) => {
|
||||
return translation.replace(/\{(\d+)\}/g, (match, index) => {
|
||||
return args[index];
|
||||
});
|
||||
}
|
||||
|
||||
return translations[key] || key;
|
||||
return translation;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue