Title: i18n support in Angular libraries · Issue #17140 · angular/angular-cli · GitHub
Open Graph Title: i18n support in Angular libraries · Issue #17140 · angular/angular-cli
X Title: i18n support in Angular libraries · Issue #17140 · angular/angular-cli
Description: 🐞 Bug report Command (mark with an x) new build serve test e2e generate add update lint xi18n run config help version doc Is this a regression? No. Related functionaliy only available with new i18n capabilities of angular 9. Description ...
Open Graph Description: 🐞 Bug report Command (mark with an x) new build serve test e2e generate add update lint xi18n run config help version doc Is this a regression? No. Related functionaliy only available with new i18n...
X Description: 🐞 Bug report Command (mark with an x) new build serve test e2e generate add update lint xi18n run config help version doc Is this a regression? No. Related functionaliy only available with new i18n...
Opengraph URL: https://github.com/angular/angular-cli/issues/17140
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"i18n support in Angular libraries","articleBody":"# 🐞 Bug report\r\n\r\n### Command (mark with an `x`)\r\n\u003c!-- Can you pin-point the command or commands that are effected by this bug? -->\r\n\u003c!-- ✍️edit: -->\r\n\r\n- [ ] new\r\n- [ ] build\r\n- [ ] serve\r\n- [ ] test\r\n- [ ] e2e\r\n- [ ] generate\r\n- [ ] add\r\n- [ ] update\r\n- [ ] lint\r\n- [x] xi18n\r\n- [ ] run\r\n- [ ] config\r\n- [ ] help\r\n- [ ] version\r\n- [ ] doc\r\n\r\n\r\n### Is this a regression?\r\n\r\n\u003c!-- Did this behavior use to work in the previous version? -->\r\n\u003c!-- ✍️--> No. Related functionaliy only available with new i18n capabilities of angular 9.\r\n\r\n\r\n### Description\r\n\r\n\u003c!-- ✍️-->I want to use ng xi18n command to extract messages for i18n tags which are part of a library project which is part of a monrepo setup created by the cli. According to docs at \r\nhttps://angular.io/cli/xi18n this is supposed to be possible \r\n \r\n> ng xi18n \\\u003cproject\\>\r\n> \\\u003cproject\\> The name of the project to build. Can be an application or a library.\r\n\r\n## 🔬 Minimal Reproduction\r\n\r\n1. create project: `ng new lib-i18n`\r\n1. add localize: `ng add @angular/localize`\r\n1. generate library: `ng g library my-lib`\r\n1. add i18n attribute in my-lib.component.ts \r\n ```\r\n \u003cp i18n>\r\n my-lib works!\r\n \u003c/p>\r\n ```\r\n1. run `ng xi18n my-lib`: Result will be \r\n`An unhandled exception occurred: Project 'my-lib' does not support the 'extract-i18n' target.` \r\nAfter adding corresponding extract-i18n target in angular.json, error output as below.\r\n\r\nI created a minimal demo project which incorporates the scenario describe above. It is located here:\r\nhttps://github.com/multimike77/lib-i18n-issue\r\n\r\nCheckout and run `npm install`. Then run `ng xi18n my-lib` and it should produce error as below.\r\n\r\n## 🔥 Exception or Error\r\n\u003cpre>\u003ccode>\r\nAn unhandled exception occurred: The \"path\" argument must be of type string. Received undefined\r\n\r\n[error] TypeError [ERR_INVALID_ARG_TYPE]: The \"path\" argument must be of type string. Received undefined\r\n at validateString (internal/validators.js:117:11)\r\n at Object.resolve (path.js:980:7)\r\n at Object.getCommonConfig (/Users/.../lib-i18n/node_modules/@angular-devkit/build-angular/src/angular-cli-files/models/webpack-configs/common.js:390:24)\r\n at /Users/.../lib-i18n/node_modules/@angular-devkit/build-angular/src/extract-i18n/index.js:91:27\r\n at generateWebpackConfig (/Users/.../lib-i18n/node_modules/@angular-devkit/build-angular/src/utils/webpack-browser-config.js:62:22)\r\n at async Object.generateBrowserWebpackConfigFromContext (/Users/.../lib-i18n/node_modules/@angular-devkit/build-angular/src/utils/webpack-browser-config.js:137:20)\r\n at async execute (/Users/.../lib-i18n/node_modules/@angular-devkit/build-angular/src/extract-i18n/index.js:73:24)\r\n\u003c/code>\u003c/pre>\r\n\r\n\r\n## 🌍 Your Environment\r\n\u003cpre>\u003ccode>\r\nAngular CLI: 9.0.4\r\nNode: 12.16.1\r\nOS: darwin x64\r\n\r\nAngular: 9.0.4\r\n... animations, cli, common, compiler, compiler-cli, core, forms\r\n... language-service, localize, platform-browser\r\n... platform-browser-dynamic, router\r\nIvy Workspace: Yes\r\n\r\nPackage Version\r\n------------------------------------------------------------\r\n@angular-devkit/architect 0.900.4\r\n@angular-devkit/build-angular 0.900.4\r\n@angular-devkit/build-ng-packagr 0.900.4\r\n@angular-devkit/build-optimizer 0.900.4\r\n@angular-devkit/build-webpack 0.900.4\r\n@angular-devkit/core 9.0.4\r\n@angular-devkit/schematics 9.0.4\r\n@ngtools/webpack 9.0.4\r\n@schematics/angular 9.0.4\r\n@schematics/update 0.900.4\r\nng-packagr 9.0.2\r\nrxjs 6.5.4\r\ntypescript 3.7.5\r\nwebpack 4.41.2\r\n\u003c/code>\u003c/pre>\r\n\r\n**Anything else relevant?**\r\n\u003c!-- ✍️Is this a browser specific issue? If so, please specify the browser and version. -->\r\n\r\n\u003c!-- ✍️Do any of these matter: operating system, IDE, package manager, HTTP server, ...? If so, please mention it below. -->\r\n","author":{"url":"https://github.com/multimike77","@type":"Person","name":"multimike77"},"datePublished":"2020-03-03T09:44:20Z","url":"https://github.com/angular/angular-cli/issues/17140"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:fc3ed996-e034-6fc4-cd27-91d35c42e210 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CFEA:1F7384:9B6B13:CF5A88:6B00E666 |
| html-safe-nonce | 30934e1645755333929df5cecddc44704af54ddc31758c281407ddbe80f76680 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDRkVBOjFGNzM4NDo5QjZCMTM6Q0Y1QTg4OjZCMDBFNjY2IiwidmlzaXRvcl9pZCI6IjY2NzY4NDUyODk4NzEwNDIxNTAiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 187de45ff792bad43d53f76dc4208527709287a77148741b36fa5dec4fe56386 |
| hovercard-subject-tag | issue:574538931 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/angular/angular-cli/17140/issue_layout |
| twitter:image | https://opengraph.githubassets.com/f802318550989ccf69f94b6bba082988b243fba06c2830d7d624ffa65bf263ea/angular/angular-cli/issues/17140 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/f802318550989ccf69f94b6bba082988b243fba06c2830d7d624ffa65bf263ea/angular/angular-cli/issues/17140 |
| og:image:alt | 🐞 Bug report Command (mark with an x) new build serve test e2e generate add update lint xi18n run config help version doc Is this a regression? No. Related functionaliy only available with new i18n... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | multimike77 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 27088b6977484d0d3321d9a11c907c6d6637b315cfa359ef7952dbf6292f9b14 |
| turbo-cache-control | no-preview |
| go-import | github.com/angular/angular-cli git https://github.com/angular/angular-cli.git |
| octolytics-dimension-user_id | 139426 |
| octolytics-dimension-user_login | angular |
| octolytics-dimension-repository_id | 36891867 |
| octolytics-dimension-repository_nwo | angular/angular-cli |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 36891867 |
| octolytics-dimension-repository_network_root_nwo | angular/angular-cli |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 624179fb8b88d26ba5bba08894eb60a1c5a1d93d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width