-
Notifications
You must be signed in to change notification settings - Fork 26.7k
feat(compiler) : i18n explicit ID #13272
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
Conversation
@vicb I created new PR, because I'm not very good at rebasing. Now you have a clean PR. |
0350625
to
bde38c5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what do you think or renaming i18nInfo
to msgInfo
/ msgMeta
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vicb OK for msgMeta.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_parseMessageMeta
would look better, WDYT ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please return an obj now, would be clerarer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please look for @@
first.
- split left part on | for m|d,
- right part is id
add const MEANING_SEPARATOR = "|"
and const ID_SEPARATOR = "@@"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add trailing "," here please - and maybe move id first (this is the important part)
Thanks ! I have added a last round of comments. To rebase, update your master branch from upstream (or origin whatever it is name) and do a Also please remove the WS before the colon in |
Also we discussed about an issue/PR on the doc repo, any progress on that front ? |
bde38c5
to
8f8af59
Compare
@vicb see the angular.io PR => docs(compiler): add doc + examples for i18n explicit ID option |
8f8af59
to
129d9c7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move the const at file level
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
simplify, something like:
const idIndex = i18n.indexOf(ID_SEPARATOR);
const [mAndD, id] = idIndex == -1 ? [i18n, ''] : [i18n.slice(0, idIndex), i18n.slice(idIndex + 2)];
const descIndex = i18n.indexOf('|');
const [meaning, description] = descIndex == -1 ? ['', mAndD] : [mAndD.slice(0, descIndex), i18n.slice(descIndex + 1)];
return {meaning, description, id};
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: "id only"
Thanks, this PRs looks good. Only a couple more changes before this can be merged. |
129d9c7
to
b868ce2
Compare
Thanks! it should get in tomorrow. |
Would this feature allow us to set IDs in our HTML/XLF files and avoid having to maintain IDs changing? |
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. |
Please check if the PR fulfills these requirements
What kind of change does this PR introduce? (check one with "x")
What is the current behavior? (You can also link to an open issue here)
See [i18n] enable control over translation message ID
What is the new behavior?
Developer can now use specific ID in translations by adding a new "parameter" in the i18n attribute :
will produce for XMB :
Does this PR introduce a breaking change? (check one with "x")
If this PR contains a breaking change, please describe the impact and migration path for existing applications: ...
Other information: