add parseMissingKeyHandler

This commit is contained in:
ZhaiSoul 2025-01-02 16:14:42 +08:00
parent eaf27ec714
commit 7476fa1300

View File

@ -30,6 +30,18 @@ i18n
interpolation: { interpolation: {
escapeValue: false, // react already safes from xss escapeValue: false, // react already safes from xss
}, },
keySeparator: false,
parseMissingKeyHandler: (key: string) => {
console.debug("Missing key: " + key);
const parts = key.split('.');
if (parts.length > 1) {
if (parts[0] === 'object' || parts[0] === 'audio') {
return parts[1].replaceAll("_", " ").charAt(0).toUpperCase() + parts[1].slice(1);
}
return parts[parts.length - 1];
}
return key;
}
}); });
export default i18n; export default i18n;