You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ng-xi18n should generate same IDs when using xlf or xmb format #15136
[ ] bug report => search github for a similar issue or PR before submitting
[x] feature request
[ ] support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question
Current behavior
Using the same template with some i18n markup text.
I try to extract the messages file with ng-xi18n.
I can use formats xlf or xmb with the --i18n-format xmb flag.
But in the generated messages.xlf and messages.xmb the units for the same input texts have totally different IDs.
Expected behavior
The generated IDs should only be a function of input text, description and intent, they should not depend on the output format.
Minimal reproduction of the problem with instructions
(see above)
What is the motivation / use case for changing the behavior?
I try to buld some tooling for i18n, especially something like a translation memory.
Therefore it is important, to have format independent IDs.
Please tell us about your environment:
Angular version: 2.0.X
Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]
Xmb uses decimalDigest, and xliff uses digest to generate ids.
Apparently based on this issue the digest for xmb was changed because xmb tools require decimal digests and not hexadecimal. But I don't know why it was not changed for xliff at the same time, I don't see anything in the xliff spec that specifies that it should be hexadecimal. @vicb what is the reason for using two different digest functions? Can we make xliff use the decimalDigest function as well?
change ng-x18n, so that it creates the same decimal IDs as xmb
have a flag to say "use old hex IDs"
deprecate that flag after a while
have some tooling to convert the IDs in already translated files
Sounds great.
Personally, I'm currently working on some tooling called ngx-i18nsupport.
The basic idea is, that it merges translated files with newly (via ng-xi18n) created files.
In the moment it works based on the IDs, so it compares the IDs found in the master file with the IDs found in the translated files and merges it.
But it would be a very small change, to let it look at the message content.
So, if you have e.g. <p i18n>Hello, world</p> and this is converted to messages.xlf
Oh I like the tool that you're working on, I might use it for my workshop at ng-conf :-) (or at least mention it).
And yes you understand the idea right, the only problem is that even if the fix is super simple, it's a breaking change (because old ids will all be replaced...). The tool that converts ids will take more work but should not be too hard to do.
Thank you for submitting your feature request! Looks like during the polling process it didn't collect a sufficient number of votes to move to the next stage.
We want to keep Angular rich and ergonomic and at the same time be mindful about its scope and learning journey. If you think your request could live outside Angular's scope, we'd encourage you to collaborate with the community on publishing it as an open source package.
You can find more details about the feature request process in our documentation.
Activity
ocombe commentedon Mar 20, 2017
Xmb uses decimalDigest, and xliff uses digest to generate ids.
Apparently based on this issue the digest for xmb was changed because xmb tools require decimal digests and not hexadecimal. But I don't know why it was not changed for xliff at the same time, I don't see anything in the xliff spec that specifies that it should be hexadecimal.
@vicb what is the reason for using two different digest functions? Can we make xliff use the decimalDigest function as well?
vicb commentedon Mar 20, 2017
This is because we need decimal IDs internally.
Ideally we should switch to the same IDs for xliff.
I see 2 possible solutions:
May be we should start with the former, deprecate the latter and also come with a tool before removing the legacy IDs.
thoughts ?
martinroob commentedon Mar 22, 2017
So, if I understand you right, the idea is
Sounds great.
Personally, I'm currently working on some tooling called ngx-i18nsupport.
The basic idea is, that it merges translated files with newly (via ng-xi18n) created files.
In the moment it works based on the IDs, so it compares the IDs found in the master file with the IDs found in the translated files and merges it.
But it would be a very small change, to let it look at the message content.
So, if you have e.g.
<p i18n>Hello, world</p>and this is converted tomessages.xlfand you have a translated file
messages.de.xlfcontainingit would detect, that source (and description and meaning) are the same, and would change
messages.de.lfto contain(currently it would just delete the translation and add a new untranslated version because of the changed IDs).
ocombe commentedon Mar 24, 2017
Oh I like the tool that you're working on, I might use it for my workshop at ng-conf :-) (or at least mention it).
And yes you understand the idea right, the only problem is that even if the fix is super simple, it's a breaking change (because old ids will all be replaced...). The tool that converts ids will take more work but should not be too hard to do.
angular-robot commentedon Jun 5, 2021
Just a heads up that we kicked off a community voting process for your feature request. There are 20 days until the voting process ends.
Find more details about Angular's feature request process in our documentation.
angular-robot commentedon Jun 25, 2021
Thank you for submitting your feature request! Looks like during the polling process it didn't collect a sufficient number of votes to move to the next stage.
We want to keep Angular rich and ergonomic and at the same time be mindful about its scope and learning journey. If you think your request could live outside Angular's scope, we'd encourage you to collaborate with the community on publishing it as an open source package.
You can find more details about the feature request process in our documentation.
dylhunn commentedon Mar 31, 2022
This is a large breaking change -- we're unlikely to do this, unless a clearer benefit of having the IDs be the same is apparent.
angular-automatic-lock-bot commentedon May 1, 2022
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.