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
ng xi18n Xliff no longer produces empty <target/> translations causing the Xliff parser to fail #21690
Comments
Please note that the polyfill lib that I wrote is in no way endorsed by Google as an official polyfill for Angular or anything. |
Thank you for the information and your efforts.
Without the ability to handle translations outside of the template, it makes Angular quite challenging to achieve a fluid approach to internationalization. Notwithstanding other third party libraries, your initial polyfill is working quite well and as far as what I’ve experimented with provides the most cohesion to the development process.
|
I can reproduce this issue just using |
Any update on this ? |
I'm working on a frontend for the storage technology Ceph. We are about to add i18n support to our project. This issues is an absolute showstopper for us, because manually adding the tags leads to an empty translated string, but without the tags the compiler fails. So, it seems there is no way that missing translation will be replaced by the default/source language, or am I wrong? We cannot guarantee that all string are translated for every release. |
You should use ngx-i18nsupport that @martinroob developed, it will do that for you and a lot more! |
I've used it myself to solve the issue and I can confirm that it does the trick. |
Any updates on this? I don't want to use another tool to be able to work with this.... |
On @BinaryBrain01's note above, I'm not keen to have to use another tool to work with Angular's xi18n tools. If I do have to however I'm not sure which tool does what and how to ensure I don't get the errors here. @TomDemulierChevret how did you get it to not throw the missing target errors? Thanks. |
@penkin I had the following script :
which It uses :
In my setup, since I supported only
The syntax of the commands may have changed thought because the projet hasn't been updated for several months. |
just a note .. i had already generated a messages file with translations without targets and xliffmerge did not fix it .. i needed to delete and start over... this "Target" missing from the original file should be fixed |
Any updates on this? I am getting |
This issue still exists in Angular 9 RC7. After every |
Has this issue been resolved.....?? m fed up with re-working on same stuff repeatedly |
I am soon to work on revamping the translation extraction to better support the new ivy translation pipe-line. I will ensure that these empty |
I'm still seeing that target problem on cli 9.1.6, and angular 9.1.7 |
I also use cli 9.1.6 and the command "ng xi18n" generates an xlf file without After some research, it seems (in my case) that xlf generated is not v1.2 strict. The target-language attribute is missing from I hope it's useful for someone |
Some localization workflows want to use the extracted source translation files directy back in the project as a target translation file. The extraction process generates files that only contain "source" messages and not "target" messages. This is actually valid for most translation formats but currently the Angular localization process expects target translation files to always contain target messages and will stop with an error in this case. Now, instead of an error, the translation file loader will log a warning, and then try to falback to a source message, only erroring if this is also missing. Fixes angular#21690
Some localization workflows want to use the extracted source translation files directy back in the project as a target translation file. The extraction process generates files that only contain "source" messages and not "target" messages. This is actually valid for most translation formats but currently the Angular localization process expects target translation files to always contain target messages and will stop with an error in this case. Now, instead of an error, the translation file loader will log a warning, and then try to falback to a source message, only erroring if this is also missing. Fixes #21690 PR Close #41944
Some localization workflows want to use the extracted source translation files directy back in the project as a target translation file. The extraction process generates files that only contain "source" messages and not "target" messages. This is actually valid for most translation formats but currently the Angular localization process expects target translation files to always contain target messages and will stop with an error in this case. Now, instead of an error, the translation file loader will log a warning, and then try to falback to a source message, only erroring if this is also missing. Fixes #21690 PR Close #41944
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
I'm submitting a...
Current behavior
As a result of 15754
ng x18n
no longer produces empty<target/>
translation tags. Given the direction of the the I18n support, as per the new i18n-polyfill, 4, this creates issues with the development lifecycle of internationalized Angular applications.Expected behavior
When developing internationalized applications it's common to develop in a single "root language", and once complete extract the specific words and dispatch the appropriate language files to a translator for languages translation. The resulting language files are then loaded into the application and support for additional languages is achieved.
Due to the direction I18n support appears to be heading, throughout the core development lifecycle of applications utilizing the Angular framework, it's anticipated to generate many cycles of the root languages .xlf file.
Unfortunately as it stands, the as extracted xlf file is not valid(to the Angular Xliff parser, although omitting the tag is valid to the standard, from my understanding), and upon load causes a fatal error by the translation indicated "missing translations". The
MissingTranslatoinStrategy
has no effect as that impacts things post Xliff parsing. Therefore the developer must manually add appropriate<target/>
tags in each instance a given Xliff file(corresponding to an appropriate<source>
tag) for the root language file.Recommendations:
1:
Allow the developer to pass an argument to the
ng x18n
that allows the developer to make an informed decision about generating the resulting empty<target/>
to ensure the Xliff parser can parse the Xliff file.OR
2:
Enhance the Xliff parser to not require a
<target>
as it does not appear to be required by the standard.Minimal reproduction of the problem with instructions
1:
Setup an application for internationalization(taken from #4) the example below utilizes the new speculative polyfill:
2:
Generate an appropriate xlf file(requires using I18n service provided by Pollyfill or i18n template attributes):
ng xi18n -of i18n/messages.en.xlf -f xlf --locale en
3:
Attempt to load the application,and navigate to a specific component that utilized I18n, Angular will produce an error similar to the following:
What is the motivation / use case for changing the behavior?
Ensuring an effective, straightforward, and easy to use approach to the lifecycle of developing internationalized Angular applications.
Environment
The text was updated successfully, but these errors were encountered: