loclapp / locl

Internationalization (i18n) tools suite for Angular
https://www.locl.app
GNU Affero General Public License v3.0
91 stars 16 forks source link

locl/cli: Unterminated $localize metadata block in ": " #24

Open simdevmon opened 4 years ago

simdevmon commented 4 years ago

I wanted to test extraction of phrases with locl/cli

ng build --prod && npx locl extract -s=dist/*.js -f=xlf2 -o=src/locale/messages.xlf

I get the following error message:

Warning: Entry point '@locl/cli' contains deep imports into '[...]/node_modules/@angular/localize/src/tools/src/diagnostics'. This is probably not a problem, but may cause the compilation of entry points to be out of order.
Generating ES5 bundles for differential loading...
ES5 bundle generation complete.

chunk {2} polyfills-es2015.c8682c51c0caa40f380a.js (polyfills) 88 kB [initial] [rendered]
chunk {3} polyfills-es5.0325fbfe1c99ab433cae.js (polyfills-es5) 181 kB [initial] [rendered]
chunk {0} runtime-es2015.1eba213af0b233498d9d.js (runtime) 1.45 kB [entry] [rendered]
chunk {0} runtime-es5.1eba213af0b233498d9d.js (runtime) 1.45 kB [entry] [rendered]
chunk {1} main-es2015.d7b91fad7b566b873991.js (main) 7.07 MB [initial] [rendered]
chunk {1} main-es5.d7b91fad7b566b873991.js (main) 7.7 MB [initial] [rendered]
chunk {4} styles.d25033ebe723c9d60754.css (styles) 92.7 kB [initial] [rendered]
chunk {scripts} scripts.bb89f88fda3726c41cfa.js (scripts) 566 kB [entry] [rendered]
Date: 2020-04-06T07:14:36.228Z - Hash: 947f933b924253cf94b4 - Time: 32073ms

Extracting translations from "dist/*.js"
unknown: Unterminated $localize metadata block in ": ".
npm ERR! code ELIFECYCLE
npm ERR! errno 1

Angular version

Angular CLI: 9.1.0
Node: 12.16.1
OS: win32 x64

Angular: 9.1.0
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, localize, platform-browser
... platform-browser-dynamic, router
Ivy Workspace: Yes

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.901.0
@angular-devkit/build-angular     0.901.0
@angular-devkit/build-optimizer   0.901.0
@angular-devkit/build-webpack     0.901.0
@angular-devkit/core              9.1.0
@angular-devkit/schematics        9.1.0
@angular/cdk                      9.2.0
@ngtools/webpack                  9.1.0
@schematics/angular               9.1.0
@schematics/update                0.901.0
rxjs                              6.5.4
typescript                        3.8.3
webpack                           4.42.0

It would be helpful to point to the file / line, which contains an error.

ocombe commented 3 years ago

Agreed, but for now I don't have this kind of info and it would require a lot of work to pass it to this part of the code. I'll add a better error message for now.

Pederaugust commented 2 years ago

This is still an issue. I have spent hours now looking through a thousand translations to find the issue, and what is the issue isn't really clear from the error message. From the code I assume the problem is that a localize block only contains one colon at the start and none at the end of the token.