mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-09-17 17:14:18 +02:00
Another translation update
This commit is contained in:
@@ -22,7 +22,18 @@ function getTranslations() {
|
||||
|
||||
const translations = getTranslations();
|
||||
|
||||
export default function translate(key) {
|
||||
export default function translate(key, args = '') {
|
||||
if (args) {
|
||||
const translatedKey = translate(key);
|
||||
return translatedKey.replace(/(\{\{\d\}\}|\{\d\})/g, (translatedKeyDbl) => {
|
||||
if (translatedKeyDbl.substring(0, 2) === '{{') {
|
||||
return translatedKeyDbl;
|
||||
}
|
||||
const match = parseInt(translatedKey.match(/\d/)[0]);
|
||||
return args[match];
|
||||
});
|
||||
}
|
||||
|
||||
const formatedKey = key.charAt(0).toLowerCase() + key.slice(1);
|
||||
return translations[formatedKey] || key;
|
||||
}
|
||||
|
Reference in New Issue
Block a user