i18next / i18next-parser

Parse your code to extract translation keys/values and manage your catalog files
MIT License
473 stars 195 forks source link

The keyPrefix argument is ignored in JavascriptLexer, and not in JsxLexer #737

Open ohardy opened 1 year ago

ohardy commented 1 year ago

To Reproduce

Name this file with .ts extension (configured with JavascriptLexer) and the keyPrefix is ignored, if you use JsxLexer instead, it's works

export default function useArticlesFilter() {
  const { t } = useTranslation('filters', { keyPrefix: 'articles' });

  return useMemo(() => {
    return {
      menuTitle: t('menu'),
      badge: {
        Component: ArticlesBadge,
      },
      panel: {
        Component: ArticlesPanel,
        query: ArticlesPanelQuery,
      },
    };
  }, [t]);
}

Expected behavior

Keyprefix should not be ignored

thomasmery commented 1 year ago

I can confirm this behaviour

I could try and look into it but someone with more knowledge of the project would be more efficient I guess

hope this can be addressed

thanks

karellm commented 1 year ago

@thomasmery You are welcome to have a look. Thanks!