Closed fragov closed 3 weeks ago
I think it fails for any t
function with options, as second parameter. This is also not working:
{
"dayWithCount_one": "{{count}} day",
"dayWithCount_other": "{{count}} days",
}
const { t } = useTranslation('common');
t('dayWithCount', { count: 2 }); // warn about missing translation
And gd
is not working for this translation (but it worked for t('deep')
from previous examples).
@fragov Thank you for using the plugin and for reporting this issue.
I planning to add support for keyPrefix and namespace in a future update.
@fragov KeyPrefix support has been implemented in version 0.4.0. Please update your plugin to check! If you encounter any bugs or have further feedback, please report it.
Foremost, HUGE thanks for your great plugin and the time you've invested in it, as well as for applying my suggestions. 👍🏼
The
keyPrefix
option in thet
function appears to be inconsistently handled for translations with nested structures. According to the expected behavior, settingkeyPrefix
should prepend the specified prefix to keys passed to thet
function, facilitating the access of nested translation values. Here’s an example to illustrate the issue:Translation:
Working Example:
Non-Working Examples: However, when attempting to use the
keyPrefix
option inside thet
function call or rely on the initially set prefix for nested keys, the function fails to retrieve the nested values:Both attempts fail to work as expected.
https://www.i18next.com/translation-function/essentials