Repository navigation
Conversation
There was a problem hiding this comment.
you can remove this line "you should ..."
same below
There was a problem hiding this comment.
|| sourceFormat at the end (useful when they are the same)
There was a problem hiding this comment.
For xmb/xtb source & target format are different, this could lead to bugs. The only case where this would work would be for xlf and it's already the default format.
There was a problem hiding this comment.
Please take the opportunity of this PR to clean the (...)! hack.
There was a problem hiding this comment.
As a general comment on this PR, "source" is confusing because it relates to the file being written which is counter-intuitive - same for "target".
Can you think about better names ?
vicb
left a comment
There was a problem hiding this comment.
See inline comments + need tests
7c6100a to
9d7d54e
Compare
There was a problem hiding this comment.
I wanted to be sure if you really paid attention to the code.
Jokes aside, good catch, fixed
9d7d54e to
6befe68
Compare
There was a problem hiding this comment.
move this to the top with other parameters ?
explain why we do || options.i18nTranslationFormat (ie most files contain both messages and translations)
There was a problem hiding this comment.
same thing here, move init to the top, missing i18nTranslationFormat here
There was a problem hiding this comment.
format could not be null -> || '' at the end
There was a problem hiding this comment.
forget my first comment, you have updated the API
There was a problem hiding this comment.
We don't use "i18nTranslationFormat" for the extraction (this is ng-xi18n, not ngc)
There was a problem hiding this comment.
specify the possible values in the comment
vicb
left a comment
There was a problem hiding this comment.
- see inline comments,
- add tests
6befe68 to
8a24b8c
Compare
There was a problem hiding this comment.
revert |null
also for the other methods if possible
There was a problem hiding this comment.
It's the only way that I found to add the unit test. I can remove it, but I'll have to remove the test as well
8a24b8c to
cbf49f1
Compare
|
LGTM, needed before merge:
|
You can now add parameters to your tsconfig that will be used when you don't provide cli parameters. It works with ng-xi18n and ngc. Since they both use some parameters with a similar name, those options in tsconfig can have a slightly different name compared to the cli parameters. Closes angular#16232 Fixes angular#16235
cbf49f1 to
71a7a3b
Compare
|
Blocked because missing approval. @alexeagle could you please review. Thanks. |
| locale?: string; | ||
|
|
||
| // path & name for the extracted messages file | ||
| outFile?: string; |
There was a problem hiding this comment.
this is probably confusing.
"compilerOptions": {
"outDir": "foo",
"out": "bar"
},
"angularCompilerOptions": {
"outFile": "baz"
}
I think either these options need to have i18n in the name, or be nested:
"angularCompilerOptions": {
"i18n_msgs": {
"extract": {
"outFile": "msgs.xtb"
},
"merge": {
"i18nFile": "msgs.xtb"
}
}
}
WDYT?
There was a problem hiding this comment.
We used the names of the current cli options (when possible). We can nest them though, what do you think @vicb ?
There was a problem hiding this comment.
it's not possible to nest the options:
type CompilerOptionsValue = string | number | boolean | (string | number)[] | string[] | MapLike<string[]> | PluginImport[];
There was a problem hiding this comment.
Isn't MapLike<string[]> the way to nest options? TypeScript does nest them, eg. compilerOptions.paths
| i18nFormat?: string; | ||
|
|
||
| // locale of your application for extracted messages file | ||
| locale?: string; |
There was a problem hiding this comment.
I was expecting multiple locales to appear here. Users shouldn't have N tsconfig files (and note that the tsconfig "extends" behavior doesn't cover unknown config properties like "angularCompilerOptions")
There was a problem hiding this comment.
This is the locale used for extracted messages, which is the main locale of your application. There is only one here since you only do one extraction.
You are referring to translationLocale?: string; which is the locale used when you compile the application. I had a comment there that @vicb told me remove which was something like "only use this if you have one tsconfig file / locale".
I agree that it would be better if we could compile all locales in one command, but that is not possible yet. There's a bit refactor coming for the compiler and it will probably change at that point, but for now we can only compile for one locale.
ae67092 to
71a7a3b
Compare
|
So there's good news and bad news. 👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there. 😕 The bad news is that it appears that one or more commits were authored by someone other than the pull request submitter. We need to confirm that they're okay with their commits being contributed to this project. Please have them confirm that here in the pull request. Note to project maintainer: This is a terminal state, meaning the |
|
Does this have google3 impact? |
|
closing as implemented in the new 5.x compiler flow - see #18494 |
|
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. |
What kind of change does this PR introduce?
What is the current behavior? (You can also link to an open issue here)
Right now you cannot add existing i18n parameters to tsconfig, see issue #16232
What is the new behavior?
You can now add parameters to your tsconfig that will be used when you don't provide cli parameters. It works with ng-xi18n and ngc. Since they both have some parameters with a similar name, those options in tsconfig have a slightly different name compared to the cli parameters (with the prefix source for ng-xi18n and the prefix target for ngc).
Does this PR introduce a breaking change? (check one with "x")