Nested angular localize calls produces invalid code

This issue has been created since 2022-09-07.

Which @angular/* package(s) are the source of the bug?

compiler, localize

Is this a regression?

No

Description

Nested localize calls production invalid i18n bundles. For example:

$localize`:@@login-form-components--lock-timeout-sec:Account locked. Try again in ${this.pluralizeTimeout(4, $localize`:@@login-form-components--lock-timeout-sec-single:second`,$localize`:@@login-form-components--lock-timeout-sec-plural:seconds`)}:accountLockTimeoutSec:.`

Will compile into:

"Account locked. Try again in " + this.pluralizeTimeout(4, $localize`:@@login-form-components--lock-timeout-sec-single:second`, $localize`:@@login-form-components--lock-timeout-sec-plural:seconds`) + ".""second""seconds";

Which will throw an error at runtime as ".""second""seconds"; isn't valid JS code.

To reproduce:

git clone https://github.com/mattlewis92/angular-localize-bug.git
cd angular-localize-bug
npm i
npm start

Then observe the browser console throwing a syntax error exception.

Please provide a link to a minimal reproduction of the bug

https://github.com/mattlewis92/angular-localize-bug

Please provide the exception or error you saw

Uncaught SyntaxError: Unexpected string


### Please provide the environment you discovered this bug in (run `ng version`)

```true
Angular CLI: 14.2.1
Node: 16.16.0
Package Manager: npm 6.14.17 
OS: darwin arm64

Angular: 14.2.0
... animations, common, compiler, compiler-cli, core, forms
... localize, platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1402.1
@angular-devkit/build-angular   14.2.1
@angular-devkit/core            14.2.1
@angular-devkit/schematics      14.2.1
@angular/cli                    14.2.1
@schematics/angular             14.2.1
rxjs                            7.5.6
typescript                      4.7.4

Anything else?

No response

More Details About Repo
Owner Name angular
Repo Name angular
Full Name angular/angular
Language TypeScript
Created Date 2014-09-18
Updated Date 2022-09-30
Star Count 84080
Watcher Count 3064
Fork Count 22235
Issue Count 1197

YOU MAY BE INTERESTED

Issue Title Created Date Comment Count Updated Date
[proposal] Add extendable api for debug interceptor 0 2022-05-18 2022-09-16
qt.qpa.plugin: Could not find the Qt platform plugin "xcb" in "" 5 2020-07-30 2022-07-11
Improve behavior of generate:locales 3 2022-02-01 2022-09-27
Does the portfolio backtesting backtest the current portfolios? 0 2021-11-20 2022-09-08
🐛 BUG: @builder.io/sdk-solid not working with Astro 3 2022-05-10 2022-09-17
Feature Request: ignoreSelector Array 9 2018-06-07 2022-09-21
Error with CEC compiling 6 2017-01-05 2022-09-22
Build currently broken due to pip / conda issue. 0 2021-10-02 2022-08-01
Apply ArgumentNullException.ThrowIfNull to NLog source-code 0 2022-09-03 2022-09-23
System Error when running Ganache 2.5.4 on win32 0 2021-12-27 2022-08-15
how can i change blender version 2 2022-06-07 2022-09-19
Doesn't work in browser (requires fs) 4 2020-06-19 2022-09-28
Handle boolean type 2 2021-07-16 2022-01-16
Bump prismjs from 1.19.0 to 1.21.0 0 2020-08-08 2022-01-30
[sqflite] The FFI implementation of sqflite_tizen 2 2021-11-23 2022-07-05
Having DevTools open affects transition calculation 2 2021-12-03 2022-09-18
The 'Number' Column Evaluates Numbers 3 2022-08-21 2022-09-05
Recovery of config files for compressed backups fails on CentOS 7 2 2022-09-06 2022-09-17
Is there a good interface GUI for barman? 1 2022-09-07 2022-09-17
Drop python 3.5 and unpin protobuf dep 0 2022-09-05 2022-09-17
ENH: Add Legendre elliptic integral Pi 1 2021-12-03 2022-09-16
(abort): the main thread is keep running for the aborted experiment for the revert duration 0 2021-07-26 2021-09-25
Missing handlers parameter documentation on setFormNotification 0 2021-10-28 2022-09-26
UAMQP live test pipeline - update SDK cloned branch 0 2021-05-11 2022-09-19
Debian: toolbars flying wild 2 2021-06-16 2022-09-11
Imgur proxy 0 2022-01-04 2022-01-08
opensea.wtf 0 2021-10-10 2021-12-30
Set "String" as a response body instead of PactDslJsonBody 1 2021-09-15 2022-09-27
直接拉取代码后 npm install 下载依赖报错问题 7 2022-04-24 2022-09-20
Arbitrary derive fails with lifetimes in some cases 3 2022-02-28 2022-09-21
修复x-input 右边clear无法正确清除 2 2021-08-30 2021-10-30
Unhandled Exception: NoSuchMethodError: The getter 'isNotEmpty' was called on null. 2 2021-03-16 2022-09-29
VSCode: Add support for Testing API 0 2022-08-31 2022-09-13
cmd/compile: unnecessary bounds check when indexing relative to the end 2 2022-03-11 2022-08-01
Add ability to combine "heating" output 0 2014-02-14 2022-07-09
Consolidating Engineering Handbook in a single place 6 2022-02-23 2022-09-28
Clean-up Redux state from Storybook 1 2022-02-23 2022-09-28
newly added functions are not getting listed when searched in opengrok 1 2022-05-09 2022-09-20
[Improvement][Script] Refactor the cli scripts. 1 2022-09-17 2022-09-16
Illumination fails below min value of 260 0 2022-08-16 2022-08-16
Possible to disable automatic insertion of periods when using Codespaces on macOS? 3 2021-10-05 2022-09-28
Install without Anaconda/Miniconda 7 2020-04-04 2022-09-16
The Store API is not writable 7 2022-03-14 2022-09-15
LGTM.com - false positive C# record classes (records) - Local scope variable shadows member 1 2022-01-16 2022-09-15
[Bug] [柱状图] 堆叠柱图,设置barMinHeight,极限数据情况下柱子重叠而非堆叠 2 2022-05-10 2022-09-18
Edit track from the selected point 1 2021-12-01 2022-09-01
Getting an unespected error retrieving the latest deployment logs 1 2022-03-23 2022-09-22
[Lens] Change all dimension configuration advanced inputs to be housed in an accordion 1 2022-04-01 2022-09-15
heroku_cert no longer works 0 2022-09-07 2022-09-15
Compiling iOS using a different toolchain 3 2022-02-08 2022-09-02