mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-09-17 17:14:18 +02:00
Fix recursive call in translate()
This commit is contained in:
@@ -18,13 +18,14 @@ function getTranslations() {
|
|||||||
|
|
||||||
const translations = getTranslations();
|
const translations = getTranslations();
|
||||||
|
|
||||||
export default function translate(key, args = '') {
|
export default function translate(key, args = []) {
|
||||||
|
const translation = translations[key] || key;
|
||||||
|
|
||||||
if (args) {
|
if (args) {
|
||||||
const translatedKey = translate(key);
|
return translation.replace(/\{(\d+)\}/g, (match, index) => {
|
||||||
return translatedKey.replace(/\{(\d+)\}/g, (match, index) => {
|
|
||||||
return args[index];
|
return args[index];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return translations[key] || key;
|
return translation;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user