i18next / i18next-scanner

Scan your code, extract translation keys/values, and merge them into i18n resource files.
http://i18next.github.io/i18next-scanner
MIT License
568 stars 128 forks source link

Support for Angular Translation Pipe #166

Open Desnoo opened 4 years ago

Desnoo commented 4 years ago

Version

Request

It would be nice to extract placeholders that are associated with a translation pipe in angular. For example you can use in an inline template or external template a translation pipe. i18next is in this case the pipe provided by https://github.com/Romanchuk/angular-i18next:

<h1 class="mat-h1">{{ 'app_settings_configuration_categories_edit_headline' | i18next }}</h1>

In this case I want to extract the provided placeholder 'app_settings_configuration_categories_edit_headline'.

barrystaes commented 3 years ago

Same question, and wondering whats currently possible in Angular to extract a JSON with the default language keys 9and possible default translations).

I already used i19next-scanner with React,

t('common:foobarkey',{defaultValue :'foobar text')

and now wonder if and how it could do the same for a Angular project. We use a pipe called translate:

<span>{{ 'common_foobar_key' | translate }}</span>

Often key is a plain string, but could also be a constant or a variable (e.g. array of dropdown options) .. any chance that such Angular usage would be supported by i18next-scanner? Or is there "regex" trick that we could use to parse code statistically and get keys + defaults?

genox commented 1 year ago

Did anyone of you find a solution to extract strings preceding pipes in angular templates?