Title: Angular-i18n Guide · Issue #24474 · angular/angular · GitHub
Open Graph Title: Angular-i18n Guide · Issue #24474 · angular/angular
X Title: Angular-i18n Guide · Issue #24474 · angular/angular
Description: I'm submitting a... [ ] Regression (a behavior that used to work and stopped working in a new release) [ ] Bug report [ ] Performance issue [ ] Feature request [x] Documentation issue or request [ ] Support request => Please do not submi...
Open Graph Description: I'm submitting a... [ ] Regression (a behavior that used to work and stopped working in a new release) [ ] Bug report [ ] Performance issue [ ] Feature request [x] Documentation issue or request [ ...
X Description: I'm submitting a... [ ] Regression (a behavior that used to work and stopped working in a new release) [ ] Bug report [ ] Performance issue [ ] Feature request [x] Documentation issue or reques...
Opengraph URL: https://github.com/angular/angular/issues/24474
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Angular-i18n Guide","articleBody":"\u003c!--\r\nPLEASE HELP US PROCESS GITHUB ISSUES FASTER BY PROVIDING THE FOLLOWING INFORMATION.\r\n\r\nISSUES MISSING IMPORTANT INFORMATION MAY BE CLOSED WITHOUT INVESTIGATION.\r\n-->\r\n\r\n## I'm submitting a...\r\n\u003c!-- Check one of the following options with \"x\" -->\r\n\u003cpre>\u003ccode>\r\n[ ] Regression (a behavior that used to work and stopped working in a new release)\r\n[ ] Bug report \u003c!-- Please search GitHub for a similar issue or PR before submitting -->\r\n[ ] Performance issue\r\n[ ] Feature request\r\n[x] Documentation issue or request\r\n[ ] Support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question\r\n[ ] Other... Please describe:\r\n\u003c/code>\u003c/pre>\r\n\r\non the doc here (https://angular.io/guide/i18n) I can't tell if it would be ok or not to do something like this : \r\n\r\n```\r\n\u003c?xml version=\"1.0\" encoding=\"UTF-8\" ?>\r\n\u003cxliff version=\"1.2\" xmlns=\"urn:oasis:names:tc:xliff:document:1.2\">\r\n \u003cfile source-language=\"fr\" datatype=\"plaintext\" original=\"ng2.template\">\r\n```\r\nnotice the source is `fr`. so would it be ok to have the base app language as french en then en-US would be one of the languges the app is translated to.\r\n\r\nThe way the doc is written that possibility is obscured.\r\n\r\nmore than that it's almost implied you have to work off of english : \r\n\r\n> By default, Angular uses the locale en-US, which is English as spoken in the United States of America.\r\n\r\nbut then it gets worse because you follow that up with : \r\n\r\n> To set your app's locale to another value, use the CLI parameter --configuration with the value of the locale id that you want to use:\r\n\r\n```ng serve --configuration=fr```\r\n\r\nwhich if you're starting out the guide as you would be (it's at the very top), does not work.\r\n\r\nonly at the very bottom is it explained how to add configs. \r\n\r\nI'm running off of the assumption that switching the base language as I'm attempting to do is a possibility but I may just hit a wall when I'm done implementing a test and I won't be sure why. I'd like the docs to be more explicit for that reason.\r\n\r\nthe place that does put this to rest is : https://angular.io/guide/i18n#other-options with : \r\n\r\n> You can specify the base locale of your app with the parameter --i18n-locale:\r\n\r\n`ng xi18n --i18n-locale fr`\r\n\r\nbut that's too far down. and not what should be indicating otherwise.\r\n\r\nAlso there is absolutely no mention of variables.\r\n\r\nI find that bewildering but that's the case.\r\n\r\nhow do you translate this ? \r\n\r\n```\u003cdiv i18n=\"@@myId\" class=\"title-text\">{{currentPage}}\u003c/div>```\r\n\r\nlike this ?\r\n```\r\n\u003c?xml version=\"1.0\" encoding=\"UTF-8\" ?>\r\n\u003cxliff version=\"1.2\" xmlns=\"urn:oasis:names:tc:xliff:document:1.2\">\r\n \u003cfile source-language=\"en\" datatype=\"plaintext\" original=\"ng2.template\">\r\n \u003cbody>\r\n \u003ctrans-unit id=\"myId\" datatype=\"html\">\r\n \u003csource>Title 1\u003c/source>\r\n \u003ctarget>Titre 1\u003c/target>\r\n \u003c/trans-unit>\r\n \u003ctrans-unit id=\"myId\" datatype=\"html\">\r\n \u003csource>Help 2\u003c/source>\r\n \u003ctarget>Aide 2\u003c/target>\r\n \u003c/trans-unit>\r\n \u003ctrans-unit id=\"myId\" datatype=\"html\">\r\n \u003csource>New 3\u003c/source>\r\n \u003ctarget>Nouveau 3\u003c/target>\r\n \u003c/trans-unit>\r\n \u003c/body>\r\n \u003c/file>\r\n\u003c/xliff>\r\n```\r\nafter running ng xi18n I got : \r\n\r\n```\r\n \u003ctrans-unit id=\"9f3e56faa6da73b83f4646a1e074b970891894da\" datatype=\"html\">\r\n \u003csource>\u003cx id=\"INTERPOLATION\" equiv-text=\"{{currentPage}}\"/>\u003c/source>\r\n \u003ccontext-group purpose=\"location\">\r\n \u003ccontext context-type=\"sourcefile\">app/logged.in/top.bar/top.bar.component.ts\u003c/context>\r\n \u003ccontext context-type=\"linenumber\">85\u003c/context>\r\n \u003c/context-group>\r\n \u003cnote priority=\"1\" from=\"description\">the title of the current route\u003c/note>\r\n \u003c/trans-unit>\r\n```\r\nI don't know if this will work. but most importantly what's the syntax for adding my 6 possibilities?\r\n\r\nalso here's how I modified my configuration in `angular.json` : \r\n```\r\n\"configurations\": {\r\n \"test-en\": {\r\n \"aot\": true,\r\n \"outputPath\": \"dist/en/\",\r\n \"i18nFile\": \"src/locale/english.xlf\",\r\n \"i18nFormat\": \"xlf\",\r\n \"i18nLocale\": \"en\",\r\n \"i18nMissingTranslation\": \"error\"\r\n },\r\n \"production\": {\r\n \"fileReplacements\": [\r\n {\r\n \"replace\": \"src/environments/environment.ts\",\r\n \"with\": \"src/environments/environment.prod.ts\"\r\n }\r\n ],\r\n \"optimization\": true,\r\n \"outputHashing\": \"all\",\r\n \"sourceMap\": false,\r\n \"extractCss\": true,\r\n \"namedChunks\": false,\r\n \"aot\": true,\r\n \"extractLicenses\": true,\r\n \"vendorChunk\": false,\r\n \"buildOptimizer\": true\r\n },\r\n \"production-en\": {\r\n \"fileReplacements\": [\r\n {\r\n \"replace\": \"src/environments/environment.ts\",\r\n \"with\": \"src/environments/environment.prod.ts\"\r\n }\r\n ],\r\n \"optimization\": true,\r\n \"outputHashing\": \"all\",\r\n \"sourceMap\": false,\r\n \"extractCss\": true,\r\n \"namedChunks\": false,\r\n \"aot\": true,\r\n \"extractLicenses\": true,\r\n \"vendorChunk\": false,\r\n \"buildOptimizer\": true,\r\n \"outputPath\": \"dist/my-project-en/\",\r\n \"i18nFile\": \"src/locale/english.xlf\",\r\n \"i18nFormat\": \"xlf\",\r\n \"i18nLocale\": \"en\",\r\n \"i18nMissingTranslation\": \"error\"\r\n }\r\n }\r\n },\r\n```\r\n\r\nI don't know what's wrong but \r\n\r\n`ng serve`\r\ncontinues to work\r\n\r\n`ng serve --configuration=production`\r\ncontinues to work\r\n\r\n`ng serve --configuration=production-en`\r\ndoesn't and \r\n\r\n`ng serve --configuration=test-en`\r\ndoesn't.\r\n\r\n```\r\nConfiguration 'test-en' could not be found in project 'web.ui'.\r\nError: Configuration 'test-en' could not be found in project 'web.ui'.\r\n at Architect.getBuilderConfiguration (C:\\Users\\j_bard\\WebstormProjects\\AirConnect\\web\\web.ui\\node_modules\\@angular-devkit\\architect\\src\\architect.js:106:23)\r\n at MergeMapSubscriber._loadWorkspaceAndArchitect.pipe.operators_1.concatMap [as project] (C:\\Users\\j_bard\\WebstormProjects\\AirConnect\\web\\web.ui\\node_modules\\@angular\\cli\\models\\architect-command.js:64:55)\r\n at MergeMapSubscriber._tryNext (C:\\Users\\j_bard\\WebstormProjects\\AirConnect\\web\\web.ui\\node_modules\\rxjs\\internal\\operators\\mergeMap.js:122:27)\r\n at MergeMapSubscriber._next (C:\\Users\\j_bard\\WebstormProjects\\AirConnect\\web\\web.ui\\node_modules\\rxjs\\internal\\operators\\mergeMap.js:112:18)\r\n at MergeMapSubscriber.Subscriber.next (C:\\Users\\j_bard\\WebstormProjects\\AirConnect\\web\\web.ui\\node_modules\\rxjs\\internal\\Subscriber.js:103:18)\r\n at TapSubscriber._next (C:\\Users\\j_bard\\WebstormProjects\\AirConnect\\web\\web.ui\\node_modules\\rxjs\\internal\\operators\\tap.js:109:26)\r\n at TapSubscriber.Subscriber.next (C:\\Users\\j_bard\\WebstormProjects\\AirConnect\\web\\web.ui\\node_modules\\rxjs\\internal\\Subscriber.js:103:18)\r\n at MergeMapSubscriber.notifyNext (C:\\Users\\j_bard\\WebstormProjects\\AirConnect\\web\\web.ui\\node_modules\\rxjs\\internal\\operators\\mergeMap.js:141:26)\r\n at InnerSubscriber._next (C:\\Users\\j_bard\\WebstormProjects\\AirConnect\\web\\web.ui\\node_modules\\rxjs\\internal\\InnerSubscriber.js:30:21)\r\n at InnerSubscriber.Subscriber.next (C:\\Users\\j_bard\\WebstormProjects\\AirConnect\\web\\web.ui\\node_modules\\rxjs\\internal\\Subscriber.js:103:18)\r\n\r\n```\r\n\r\nwhy?","author":{"url":"https://github.com/tatsujb","@type":"Person","name":"tatsujb"},"datePublished":"2018-06-13T14:38:53Z","url":"https://github.com/angular/angular/issues/24474"}
| 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:9559508e-089a-f432-cbeb-dfdca64ce83f |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E292:1087D4:123055B:1850C3C:6B0123AF |
| html-safe-nonce | 8d4889c6d531f5e85f58df7870941922efb99ad292de20225a1b6b9bc6578bd2 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMjkyOjEwODdENDoxMjMwNTVCOjE4NTBDM0M6NkIwMTIzQUYiLCJ2aXNpdG9yX2lkIjoiMzc0NzY1MTY3ODE2NjM5Mzc3NSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 2702e3ef1ec6aea7a991ae5f7bd2f211fb2dc1d761914cfb7a85e5452446b66a |
| hovercard-subject-tag | issue:332025449 |
| 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/24474/issue_layout |
| twitter:image | https://opengraph.githubassets.com/69054f6c707222a287d33195486702f30090fa86e120185d238efbca379ce50f/angular/angular/issues/24474 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/69054f6c707222a287d33195486702f30090fa86e120185d238efbca379ce50f/angular/angular/issues/24474 |
| og:image:alt | I'm submitting a... [ ] Regression (a behavior that used to work and stopped working in a new release) [ ] Bug report [ ] Performance issue [ ] Feature request [x] Documentation issue or request [ ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | tatsujb |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| turbo-cache-control | no-preview |
| go-import | github.com/angular/angular git https://github.com/angular/angular.git |
| octolytics-dimension-user_id | 139426 |
| octolytics-dimension-user_login | angular |
| octolytics-dimension-repository_id | 24195339 |
| octolytics-dimension-repository_nwo | angular/angular |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 24195339 |
| octolytics-dimension-repository_network_root_nwo | angular/angular |
| 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 | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width