Repository navigation
[IVY] i18n not working yet? #32311
Copy link
Copy link
Closed
Labels
area: compilerIssues related to `ngc`, Angular's template compilerIssues related to `ngc`, Angular's template compiler
Milestone
Description
I was trying out IVY on our medium sized corporate project - I finally managed to get the site compiled, but noticed none of the i18n translations were injected into the generated code.
Is i18n not supposed to work with IVY yet? Just curious
There are no error messages other than weird stuff like
WARNING in /Users/lrj/project/ivy2/src/app/modules/iticket-business/views/edit-profile/index.ts is part of the TypeScript compilation but it's unused.
Add only entry points to the 'files' or 'include' properties in your tsconfig.
But the site seems to be working - just not with the translations inserted.
I make heavy use of paths in tsconfig.json, - is this not supposed to be supported in IVY?
Is this a regression?
Don't know
🌍 Your Environment
Angular Version:
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 9.0.0-next.0
Node: 12.2.0
OS: darwin x64
Angular: 9.0.0-next.3
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router, service-worker
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.900.0-next.0
@angular-devkit/build-angular 0.900.0-next.0
@angular-devkit/build-optimizer 0.900.0-next.0
@angular-devkit/build-webpack 0.900.0-next.0
@angular-devkit/core 9.0.0-next.0
@angular-devkit/schematics 9.0.0-next.0
@angular/cdk 8.1.2
@angular/cli 9.0.0-next.0
@angular/material 8.1.2
@angular/pwa 0.900.0-next.0
@ngtools/webpack 9.0.0-next.0
@schematics/angular 9.0.0-next.0
@schematics/update 0.900.0-next.0
rxjs 6.5.2
typescript 3.5.2
Anything else relevant?
I'm sorry if this is a dumb question but I just wanted to check if the i18n="@@my-id" was supposed to be working with IVY.
I make heavy use of paths in tsconfig.json, - is this not supposed to be supported in IVY?
Tsconfig:
{
"compileOnSave": false,
"angularCompilerOptions": {
"enableIvy": true
},
"compilerOptions": {
"baseUrl": "./src",
"importHelpers": true,
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
//"module": "es2015",
"module": "esnext",
"moduleResolution": "node",
"noImplicitAny": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es5",
"skipLibCheck": true,
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2018",
"dom"
],
"paths": {
"@store/*": ["app/store/*", "app/store"],
"@store": ["app/store/*", "app/store"],
"@modules/*": ["app/modules/*", "app/modules"],
"@modules": ["app/modules/*", "app/modules"],
"@main/*": ["app/main/*", "app/main"],
"@models/*": ["app/models/*", "app/models"],
"@models": ["app/models/*", "app/models"],
"@main": ["app/main/*", "app/main"],
"@environment": ["environments/environment"],
"@lib/*": ["app/lib/*", "app/lib"],
"@lib": ["app/lib/*", "app/lib"],
"@iticket-business/*": [ "app/modules/iticket-business/*", "app/modules/iticket-business"]
}
}
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area: compilerIssues related to `ngc`, Angular's template compilerIssues related to `ngc`, Angular's template compiler
Activity
spock123 commentedon Aug 24, 2019
Just for the record - the application works, except no translations are injected in the templates. Both during ng serve and production builds.
Very strange
ocombe commentedon Aug 25, 2019
This looks more like an issue with angular cli than angular itself, because as far as I know translations work with ivy.
I'm transferring the issue to the cli repository
alan-agius4 commentedon Aug 25, 2019
@ocombe, did something change recently? AFAIK, the NGTSC compiler doesn’t support translations yet.
ocombe commentedon Aug 25, 2019
I thought that this was only for extracting, not loading them?
alan-agius4 commentedon Aug 25, 2019
Ngtsc doesn’t support loading the translations either.
alan-agius4 commentedon Aug 25, 2019
I had a chat with @alxhub about this in the past, and he was aware that this feature is not yet implemented in ngtsc.
spock123 commentedon Aug 25, 2019
@AlabasterAxe @ocombe Ok thanks for the info guys.... We can close this issue then, it wasn't me going crazy hehe.... and stop working on a Sunday :)
petebacondarwin commentedon Aug 25, 2019
What is the current process (pre-ivy) to load the translations? Is it to add them as a provider in the application root injector?
ocombe commentedon Aug 25, 2019
no, you use the cli config file: https://angular.io/guide/i18n#merge-the-completed-translation-file-into-the-app
spock123 commentedon Aug 25, 2019
@ocombe yes that's also what I use in my project.. something like
krassimir-nedelchev commentedon Aug 25, 2019
Try this:
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "./out-tsc/app",
"types": []
},
"files": [
"src/main.ts",
"src/polyfills.ts"
],
"include": [
"src//*.ts"
],
"exclude": [
"src/test.ts",
"src//*.spec.ts"
]
}
save to the same directory as the "tsconfig.json" file;
edit angular.json and replace "tsConfig": "tsconfig.json" with "tsConfig": "tsconfig.app.json",
Hope this helps...
spock123 commentedon Aug 25, 2019
@krassimir-nedelchev Hi, thanks for your advice.
I was already using the tsconfig.app.json file (but located in my src folder), I added the "files" and "include" sections but that didn't seem to help the issue with translations. No translations are added to the templates.
HOWEVER they did remove all the warnings (
... is part of the TypeScript compilation but it's unused.)... so that's great! Thank you!
krassimir-nedelchev commentedon Aug 25, 2019
Or just append tsconfig.json with an exclude section:
"exclude": [
"src/app/modules/iticket-business/views/edit-profile/index.ts"
]
kara commentedon Aug 29, 2019
i18n work for Ivy is still in progress. @spock123 Closing this issue as it's not technically a bug or a feature request.
spock123 commentedon Aug 30, 2019
@kara I accept that, just because it's you (star struck)
On a serious note: thanks for clearing up the things.
akash-gupt commentedon Sep 4, 2019
any solution ?
spock123 commentedon Sep 4, 2019
@techaks I guess we can just patiently await.. it definitely makes it impossible to try out Ivy if you use i18n.
petebacondarwin commentedon Sep 4, 2019
We are working on i18n in ivy.
We already have some pieces merged into master but it is not functional yet. There are a few more pieces to go and the plan is to have it all working by v9.0.0 release.
Please bear with us.
spock123 commentedon Sep 4, 2019
Thanks @petebacondarwin
Javarome commentedon Sep 20, 2019
Hi @ocombe @petebacondarwin
I just upgraded to 9.0.0-next.7 to see if i18n was working better and actually found some changes that I... didn't expect: all
<tag i18n="xxx">defaultValue</tag>are now displayed as<tag>:xxx:defaultValue</tag>without translation. Is it because this is old syntax and there is some new syntax I should use starting with next-7?petebacondarwin commentedon Sep 23, 2019
@Javarome did you also update your version of
@angular/localize?angular-automatic-lock-bot commentedon Oct 24, 2019
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.