const { t } = useTranslation('ns1');
t('key'); // finds key from ns1
and this is as well:
const { t } = useTranslation(['ns1', 'ns2']);
t('key'); // finds key from ns1
t('ns1:key'); // finds key from ns1
t('ns2:key2'); // finds key from ns2
Is there some way to recreate this behavior of having a default scoped namespace with the Jetbrains plugin? I've only had partial success with defining a template as t('%namespace%:%key%', %map%), which then means the plugin expects %namespace% is always provided (which as you can see above, is not necessary in react-i18next).
Taking it a step farther, if it were possible to do the above - I'd also like to be able to define a custom scope (rather than react-i18next's useTranslation function) that would add parity with this feature I contributed to the VS Code extension.
When using
react-i18next
, theuseTranslation()
hook can accept one or more namespaces, where the first namespace becomes the default scope for the current file.For example, this is valid syntax:
and this is as well:
Is there some way to recreate this behavior of having a default scoped namespace with the Jetbrains plugin? I've only had partial success with defining a template as
t('%namespace%:%key%', %map%)
, which then means the plugin expects%namespace%
is always provided (which as you can see above, is not necessary inreact-i18next
).Taking it a step farther, if it were possible to do the above - I'd also like to be able to define a custom scope (rather than
react-i18next
'suseTranslation
function) that would add parity with this feature I contributed to the VS Code extension.Thanks!