Visitar URL original
Angular 12 i18n-internationalisation of the library : message.xlf is empty · Issue #44056 · angular/angular · GitHub
The Wayback Machine - https://web.archive.org/web/20250520190236/https://github.com/angular/angular/issues/44056
Skip to content

Angular 12 i18n-internationalisation of the library : message.xlf is empty #44056

Closed
@ShadowmourneE

Description

@ShadowmourneE

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

localize

Is this a regression?

No

Description

I`ve been done all as per this guide https://angular.io/guide/i18n-overview#!#angular-i18n. I try to localize the existing library in my project using the command as per guide from this issue: angular/angular-cli#17140

localize-extract -s "/dist/testLib-lib/fesm2015/*.js" -f xlf -o messagesTestLib.xlf

and receive the empty file like:

<?xml version="1.0" encoding="UTF-8" ?> <xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2"> <file source-language="en" datatype="plaintext" original="ng2.template"> <body> </body> </file> </xliff>

One point is I found is that here may be a problem with TS version, but I tried to downgrade even the version and it doesn`t help me.
Which environment should I have to use localization?

NOTE: I added

import '@angular/localize/init';

in my entryPoint public-api.ts as well.
I noticed that in worked simple project(https://github.com/michaelhunziker/angular-i18n-library) in dist/lib/*.js I have worked code string which is compiled the i18n statement from html template:
i18n_0 = MSG_EXTERNAL_6617834883484090744$$LIB_TEST_LIB_COMPONENT_TS_1;

But in my project I dont have this, instead I have not compiled text like: < div i18n>HelloWorld`

Please provide a link to a minimal reproduction of the bug

No response

Please provide the exception or error you saw

No errors/no exceptions.

Please provide the environment you discovered this bug in

Angular CLI: 12.2.10
Node: 14.17.5
Package Manager: npm 6.14.14
OS: win32 x64

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

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1202.10
@angular-devkit/build-angular   12.2.10
@angular-devkit/core            12.2.10
@angular-devkit/schematics      12.2.10
@angular/cdk                    12.2.9
@angular/material               12.2.9
@schematics/angular             12.2.10
ng-packagr                      12.2.3
rxjs                            6.6.7
typescript                      4.3.5

Anything else?

In addition, this is my package.json of the project:
{
"name": "test",
"version": "0.0.0-alpha",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/animations": "~12.2.9",
"@angular/cdk": "^12.2.9",
"@angular/common": "~12.2.9",
"@angular/compiler": "~12.2.9",
"@angular/core": "~12.2.9",
"@angular/forms": "~12.2.9",
"@angular/material": "^12.2.9",
"@angular/platform-browser": "~12.2.9",
"@angular/platform-browser-dynamic": "~12.2.9",
"@angular/router": "~12.2.9",
"@fortawesome/angular-fontawesome": "^0.9.0",
"@fortawesome/fontawesome-svg-core": "^1.2.36",
"@fortawesome/free-solid-svg-icons": "^5.15.4",
"luxon": "^2.0.0",
"ngx-highlightjs": "^4.1.4",
"rxjs": "~6.6.3",
"tslib": "^2.0.0",
"zone.js": "~0.11.4"
},
"devDependencies": {
"@angular-devkit/build-angular": "^12.2.9",
"@angular/cli": "^12.2.9",
"@angular/compiler-cli": "~12.2.9",
"@angular/localize": "^12.2.10",
"@types/jasmine": "~3.6.0",
"@types/luxon": "^2.0.5",
"@types/node": "^12.19.11",
"jasmine-core": "^3.9.0",
"karma": "^6.3.4",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage": "^2.0.3",
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "^1.5.0",
"ng-packagr": "^12.2.3",
"typescript": "^4.3.5" < may problem by here in version?
}
}

and this is a package.json of my library:

{
"name": "@test/testLib-lib",
"version": "0.0.30-alpha",
"dependencies": {
"tslib": "^2.0.0"
},
"peerDependencies": {
"@angular/common": "^12.2.0",
"@angular/core": "^12.2.0",
"@angular/material": "^12.2.7",
"@angular/cdk": "^12.2.7",
"luxon": "^2.0.0"
}
}

this is tsconfig.lib.json:
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "../../out-tsc/lib",
"target": "es2015",
"declaration": true,
"declarationMap": true,
"inlineSources": true,
"types": [],
"lib": [
"dom",
"es2018"
]
},
"angularCompilerOptions": {
"compilationMode": "partial"
},
"exclude": [
"src/test.ts",
"**/*.spec.ts"
]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions