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

$localize usage in component is reset on every extraction #176

Open
spock123 opened this issue Oct 29, 2020 · 4 comments
Open

$localize usage in component is reset on every extraction #176

spock123 opened this issue Oct 29, 2020 · 4 comments

Comments

@spock123
Copy link

spock123 commented Oct 29, 2020

UPDATE UPDATE

I noticed that if the translation state is set to "translated", it works as designed.
If the state = final it will be overwritten on each extraction.

Hi, I'm using $localize to generate translations inside component classes.

Example:

public order = $localize:@@order.order-step-label:;

However, after running extraction, while the field is found and inserted in the messages file, both source and target for the translations are empty:

<source/><target state="final"/>

Further, if we translate it and update the translation file, on the next extraction run, the translations are reset to the initial empty state again.

Any ways we can prevent this? It makes it impossible to use the tool as all our translations are removed each time we run the script.

Configuration:

{
  "xliffmergeOptions": {
    "srcDir": "src/locale",
    "genDir": "src/locale",
    "i18nFile": "messages.xlf",
    "i18nBaseFile": "messages",
    "i18nFormat": "xlf",
    "encoding": "UTF-8",
    "defaultLanguage": "en",
    "languages": ["en", "da"],
    "removeUnusedIds": true,
    "supportNgxTranslate": false,
    "ngxTranslateExtractionPattern": "@@",
    "useSourceAsTarget": true,
    "targetPraefix": "",
    "targetSuffix": "",
    "beautifyOutput": false,
    "preserveOrder": true,
    "allowIdChange": false,
    "autotranslate": false,
    "apikey": "",
    "apikeyfile": "",
    "verbose": false,
    "quiet": false
  }
}
@julkue
Copy link

julkue commented Nov 12, 2020

The problem is, it's only compatible with Angular v8 currently, where $localize didn't even exist. See #167

@ahmadalfy
Copy link

@julmot it's compatible with 10 as well

@julkue
Copy link

julkue commented Nov 13, 2020

@ahmadalfy Yes, the base functionality that was already present with v8 kept working up and including to v10 (not v11). But it's not officially compatible, thus a feature like $localize that wasn't there in v8 isn't officially supported, see: https://github.com/martinroob/ngx-i18nsupport/blob/master/package.json#L30

@ahmadalfy
Copy link

@julmot you're right, I found that I am not using it. I ended up removing it from my project and used xliffmerge from the same author.

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

3 participants