mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-04-24 05:47:22 -04:00
Fix recursive call in translate()
This commit is contained in:
parent
79fbb2d0d7
commit
94c91d4c3f
1 changed files with 5 additions and 4 deletions
|
@ -18,13 +18,14 @@ function getTranslations() {
|
|||
|
||||
const translations = getTranslations();
|
||||
|
||||
export default function translate(key, args = '') {
|
||||
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