angular-cn/packages/localize
Pete Bacon Darwin b5e8c28640 fix(localize): render correct closing tag placeholder names in XLIFF 2 (#41152)
When there are elements in a translated message, the start and end tags
are encoded as placeholders. The names of these placeholders are computed
from the name of the element. For example `<a> will be `START_LINK` and
`</a>` will be `CLOSE_LINK`.

If there are more than one element with the same name, but different attributes,
then the starting placeholder name is made unique.
For example `<a href="a">` would be `START_LINK`, while `<a href="b">` in
the same message would then be called `START_LINK_1`.
But the closing tags will not be made unique since there are no attrbutes;
the always have the same text `</a>`, which will produce, for example,
`CLOSE_LINK`.

Previously, when extracting XLIFF 2 formatted translation files, the closing
tag placeholder names were computed incorrectly from the opening tag
placeholder names. For example `CLOSE_LINK_1`.

This commit strips these `_1` type endings from the start tag placeholder
name when computing the closing tag placeholder name. It also ensures
that the `type` of the placeholder is computed accurately in these cases
too.

Fixes #41142

PR Close #41152
2021-03-10 10:59:59 -08:00
..
init build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
schematics feat(core): drop support for zone.js 0.10.x (#40823) 2021-02-24 07:58:29 -08:00
src fix(localize): render correct closing tag placeholder names in XLIFF 2 (#41152) 2021-03-10 10:59:59 -08:00
test build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
BUILD.bazel build: provide full paths to `ts_api_guardian_test_npm_package` and `ts_api_guardian_test` (#36034) 2020-03-12 09:49:00 -07:00
index.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
localize.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
package.json feat(localize): add scripts to migrate away from legacy message IDs (#41026) 2021-03-08 10:05:42 -08:00
private.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00