biesbjerg / ngx-translate-extract

Extract translatable (using ngx-translate) strings and save as a JSON or Gettext pot file
MIT License
524 stars 196 forks source link

saving multi file not working #227

Open ghost683 opened 3 years ago

ghost683 commented 3 years ago

in windows, trying to save multiple file as example not working "i18n:extract": "ngx-translate-extract --input ./src --output ./src/assets/i18n/{en,da}.json --clean --format json" the command will create a file src/assets/118n{en,da}.json instead of the two expected files

ghost683 commented 3 years ago

prepend any characters before the parentheses do the work

./src/assets/i18n/_{en,da}.json will create _en.json and _da.json inside i18n

VILLAN3LL3 commented 3 years ago

Same here. Is there a workaround to get en.json and fr.json by using the {en,fr} syntax?

guyenot-jeremy commented 3 years ago

Hi,

I have the same issue

"i18n:extract-clean": "ngx-translate-extract --input './src/{app,_helpers,_models,_services}/**/*.{html,ts}' --output './src/assets/i18n/{en,fr}.json' -s -c -f namespaced-json"

And the result

ngx-translate-extract --input './src/{app,_helpers,_models,_services}/**/*.{html,ts}' --output './src/assets/i18n/{en,fr}.json' -s -c -f namespaced-json

Enabled parsers:
- PipeParser
- DirectiveParser
- ServiceParser
- MarkerParser

Enabled post processors:
- PurgeObsoleteKeysPostProcessor
- SortByKeyPostProcessor

Compiler:
- NamespacedJsonCompiler

Found 288 strings.

Saving:
- \src\assets\i18n\{en,fr}.json [CREATED]

Done.
ghost683 commented 3 years ago

Same here. Is there a workaround to get en.json and fr.json by using the {en,fr} syntax?

I don't know if it can fit you as a workarowund, but as I said you can change the structure of the language files, like: ./src/translations/lang_{en-US,fr-FR,it-IT}.json' in this way the files lang_en-US.json, lang_fr-FR.json, lang _it-IT.json are created then just rename the input files in your project and that's it, otherwise you can then concatenate a renaming function to obtain the files in the required form

SebaRenner commented 2 years ago

Still seems to be an issue. A simple workaround is to add multiple output paths, like it is possible with the input parameter. Example: ngx-translate-extract --input ./src --output ./src/assets/i18n/de.json ./src/assets/i18n/fr.json --sort --format namespaced-json

JesseHelmes commented 2 years ago

I have found the solution or a workaround for all the window users who are still having troubles with this, including me. Be doing this:

i18n:extract": "ngx-translate-extract --input ./src --output ./src/assets/i18n{/en,/da}.json --clean --format json

I did the same thing as @ghost683 "prepend any characters before the parentheses do the work" But I ended with a folder before the brackets and placed the "/" before the filenames inside the brackets.

vivganes commented 10 months ago

I have found the solution or a workaround for all the window users who are still having troubles with this, including me. Be doing this:

i18n:extract": "ngx-translate-extract --input ./src --output ./src/assets/i18n{/en,/da}.json --clean --format json

I did the same thing as @ghost683 "prepend any characters before the parentheses do the work" But I ended with a folder before the brackets and placed the "/" before the filenames inside the brackets.

This worked flawlessly for me. Thanks @JesseHelmes