Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Array value erased when extract #244

Open
lufo88ita opened this issue Oct 14, 2021 · 0 comments
Open

Array value erased when extract #244

lufo88ita opened this issue Oct 14, 2021 · 0 comments

Comments

@lufo88ita
Copy link

lufo88ita commented Oct 14, 2021

Hi,

First of all: thanks for your work. It is a hge help in manage the translations.
My problem:
Maybe I do not understand something but array values in .json files is erased when I run your library. This is how I call ngx-translate-extract:

ngx-translate-extract -f namespaced-json -i ./src/**/*.{ts,html} -o ./src/assets/i18n/messages.{de,en,es,fr,it,zh-Hans}.json -s -n -c

All works great and as I want, except one thing: if the value provided in a translations in an array it will be erased.

I search a bit and try to remove some parameter, in the end I discover that the array is split.
Example.
In my messages.en.json I wrote this entry:

{
//others translations
"dayNamesMin" : ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa" ]
}

I run the script above without the -c parameter. The final messages.en.json is this:

{
//others translations
"dayNamesMin" : null
"dayNamesMin.0" : "Su"
"dayNamesMin.1" : "Mo"
"dayNamesMin.2" : "Tu"
"dayNamesMin.3" :  "We"
"dayNamesMin.4" : "Th"
"dayNamesMin.5" : "Fr"
"dayNamesMin.6" : "Sa"
}

Of course, if the -c is present the dayNamesMin. will be all deleted

What is my error? the array is a valid json type and Ngx-translate support it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant