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

Auto Translate with $localize delete variables. #166

Open
Ricardo96r opened this issue Jun 19, 2020 · 4 comments
Open

Auto Translate with $localize delete variables. #166

Ricardo96r opened this issue Jun 19, 2020 · 4 comments

Comments

@Ricardo96r
Copy link

I am trying to Auto Translate the $localize of my application. The problem is that when translating $localize the variables are erased.

Example:

$localize'El campo tiene muy pocos caracteres. Mínimo ${o.requiredLength} caracteres. (${o.actualLength})'

Default XLF (messages.xlf Original defaultLanguage: es)

<trans-unit id="854483955309547493" datatype="html">
    <source>El campo tiene muy pocos caracteres. Mínimo <x id="PH"/> caracteres. (<x id="PH_1"/>)</source>
    <target>El campo tiene muy pocos caracteres. Mínimo <x id="PH"/> caracteres. (<x id="PH_1"/>)</target>
</trans-unit>

Then i run xliffmerge --profile apps/web/xliffmerge.json and generate: (messages.en.xlf):

<trans-unit id="854483955309547493" datatype="html">
    <source>El campo tiene muy pocos caracteres. Mínimo <x id="PH"/> caracteres. (<x id="PH_1"/>)</source>
    <target state="translated">The field has very few characters. Minimum characters. ()</target>
</trans-unit>

As you can see, the element <x id = "PH" /> and <x id="PH_1"/> is removed.

It is necessary that it is not deleted, since my application has 17 languages and it is very laborious to add it manually

Any idea how to make the element <x id = "PH" /> not be deleted?


My xliffmerge.json:

  "xliffmergeOptions": {
    "srcDir": "apps/web/src/locale",
    "genDir": "apps/web/src/locale",
    "i18nFile": "messages.xlf",
    "i18nBaseFile": "messages",
    "i18nFormat": "xlf",
    "encoding": "UTF-8",
    "defaultLanguage": "es",
    "languages": ["es", "en", "zh", "da", "de", "nl", "fr", "ht", "hi", "it", "ja", "ko", "pt", "ru", "sv", "tr", "uk"],
    "removeUnusedIds": false,
    "supportNgxTranslate": false,
    "useSourceAsTarget": true,
    "beautifyOutput": false,
    "preserveOrder": true,
    "allowIdChange": false,
    "autotranslate": true,
    "apikeyfile": "/users/me/.secrets/googleTranslateApiKey.txt",
    "verbose": false,
    "quiet": false
  }
}
@Blucbo
Copy link

Blucbo commented Aug 28, 2020

Hi, do you solve the issue?

@lfsmoura
Copy link

lfsmoura commented Sep 2, 2020

Is there a workaround for this issue? is it possible to mark trans units as "not removable"?

@Blucbo
Copy link

Blucbo commented Sep 4, 2020

Is there a workaround for this issue? is it possible to mark trans units as "not removable"?

You can add into template text with same ids

@daniel-sc
Copy link

$localize is only recognized if you use ivy to extract: ng xi18n --ivy

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

4 participants