You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, the namespaceFunctions option in the lexers does not support recognizing wrapped functions defined as namespace properties, such as i18n.useTranslate. For example:
const { t } = i18n.useTranslate('common');
const message = t('welcome_message');
The parser fails to recognize i18n.useTranslate as a valid namespace function, and as a result, it does not extract the common namespace or the associated keys. The current implementation of namespaceFunctions only supports simple function names like useTranslate, which limits the parser's flexibility for projects that use wrapped functions defined within namespaces.
Expected behavior
Extend the namespaceFunctions option in the lexers to support namespace property functions (e.g., i18n.useTranslate) in the same way that functions and componentFunctions were enhanced in Issue #912 and PR #913. This enhancement will allow the parser to extract namespaces and keys from nested property functions seamlessly.
Why It's Important
This enhancement would improve the flexibility of the parser, making it compatible with projects that use namespaced or wrapped translation functions. It would also bring consistency across functions, componentFunctions, and namespaceFunctions, enabling developers to extract translations without requiring additional preprocessing or workarounds.
Your Environment
runtime version: node v20.11.1
i18next version: 23.15.1
os: Mac
The text was updated successfully, but these errors were encountered:
🐛 Bug Report
Currently, the
namespaceFunctions
option in the lexers does not support recognizing wrapped functions defined as namespace properties, such asi18n.useTranslate
. For example:The parser fails to recognize
i18n.useTranslate
as a valid namespace function, and as a result, it does not extract thecommon
namespace or the associated keys. The current implementation ofnamespaceFunctions
only supports simple function names likeuseTranslate
, which limits the parser's flexibility for projects that use wrapped functions defined within namespaces.Expected behavior
Extend the
namespaceFunctions
option in the lexers to support namespace property functions (e.g.,i18n.useTranslate
) in the same way thatfunctions
andcomponentFunctions
were enhanced in Issue #912 and PR #913. This enhancement will allow the parser to extract namespaces and keys from nested property functions seamlessly.Why It's Important
This enhancement would improve the flexibility of the parser, making it compatible with projects that use namespaced or wrapped translation functions. It would also bring consistency across
functions
,componentFunctions
, andnamespaceFunctions
, enabling developers to extract translations without requiring additional preprocessing or workarounds.Your Environment
The text was updated successfully, but these errors were encountered: