{"action":"created","issue":{"url":"https://api.github.com/repos/angular/angular-cli/issues/2201","repository_url":"https://api.github.com/repos/angular/angular-cli","labels_url":"https://api.github.com/repos/angular/angular-cli/issues/2201/labels{/name}","comments_url":"https://api.github.com/repos/angular/angular-cli/issues/2201/comments","events_url":"https://api.github.com/repos/angular/angular-cli/issues/2201/events","html_url":"https://github.com/angular/angular-cli/issues/2201","id":177652316,"number":2201,"title":"[Discussion] angular-cli and i18n (ng-xi18n + ngc)","user":{"login":"christiandreher","id":13337480,"avatar_url":"https://avatars.githubusercontent.com/u/13337480?v=3","gravatar_id":"","url":"https://api.github.com/users/christiandreher","html_url":"https://github.com/christiandreher","followers_url":"https://api.github.com/users/christiandreher/followers","following_url":"https://api.github.com/users/christiandreher/following{/other_user}","gists_url":"https://api.github.com/users/christiandreher/gists{/gist_id}","starred_url":"https://api.github.com/users/christiandreher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/christiandreher/subscriptions","organizations_url":"https://api.github.com/users/christiandreher/orgs","repos_url":"https://api.github.com/users/christiandreher/repos","events_url":"https://api.github.com/users/christiandreher/events{/privacy}","received_events_url":"https://api.github.com/users/christiandreher/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/angular/angular-cli/labels/type:%20discussion","name":"type: discussion","color":"EEEEEE"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-09-18T13:37:55Z","updated_at":"2016-10-06T06:56:36Z","closed_at":null,"body":"With angular's `i18n` working quite good now, I wanted to start a general discussion about how the `angular-cli` will be supposed to work with it.\r\n\r\nAccording to [this](http://stackoverflow.com/a/39167817/2938082) statement on StackOverflow from @Brocco, `angular-cli` will eventually make use of AOT compilation. This means, that `ngc` will be used, which in turn will respect `xlf` files for translations. For JIT builds (development builds), we could make use of a raw webpack loader, which loads a `xlf` file as string and provides this as translation.\r\n\r\nHere are some questions which come to my mind and I think need to be considered in future development:\r\n\r\n- Currently, for a production build, everything (vendor's code + application code) is bundled into one single `bundle.js` file. With multiple translations, will we be supposed to have one complete bundle for each language? This seems to be a very inpractical approach. Bundling every translation into the `bundle.js` is not practical either, as in maybe 99% of all cases, one language is sufficient. Imagine a popular app, built with angular, which is used from people all over the world. We **1)** don't want to ship a `bundle.js` containing all possible translations, because eventually they will blow up the bundle size. We **2)** don't want to have hundrets of bundles, each for one language. Maybe it would be good to split the `bundle.js` into two separate bundles: **1)** vendors library code, **2)** NgFactory code. For each language, a dedicated `ngfactory-bundle.lang-LANG.js` would then be created. \r\n- What about libraries that support localization? For example a library which supplies some input components (like a calendar) which needs to be localized.\r\n- How can we reliably detect the language and load the app accordingly? At the moment, this has to occur during bootstrap, but what about detecting the browser locale or maybe the users preference (this means: much later than bootstrap time; after a database request, fetching the user settings after auth)?\r\n- As `ng` is a façade: would we need an `ng i18n` command to hide the possibly rather complex `ng-xi18n` call (regarding hiding passed parameters... a call could otherwise look like this: `./node_modules/.bin/ng-xi18n -p src/tsconfig.json ......`)? Or could this be automated with some kind of watch (I don't think so, as `ng-xi18n` takes some time to complete, even with a small app)?\r\n- Where would we store the localization files? Maybe `src/i18n/` would be a good place for the start. If we would like to encourage a set of localization files for each module, it should be located at `src/<module-name>/i18n/` or maybe `src/i18n/<module-name>/`. The latter approach would be better for translator-teams, or translation-tools I think"},"comment":{"url":"https://api.github.com/repos/angular/angular-cli/issues/comments/251882075","html_url":"https://github.com/angular/angular-cli/issues/2201#issuecomment-251882075","issue_url":"https://api.github.com/repos/angular/angular-cli/issues/2201","id":251882075,"user":{"login":"elvirdolic","id":17769458,"avatar_url":"https://avatars.githubusercontent.com/u/17769458?v=3","gravatar_id":"","url":"https://api.github.com/users/elvirdolic","html_url":"https://github.com/elvirdolic","followers_url":"https://api.github.com/users/elvirdolic/followers","following_url":"https://api.github.com/users/elvirdolic/following{/other_user}","gists_url":"https://api.github.com/users/elvirdolic/gists{/gist_id}","starred_url":"https://api.github.com/users/elvirdolic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elvirdolic/subscriptions","organizations_url":"https://api.github.com/users/elvirdolic/orgs","repos_url":"https://api.github.com/users/elvirdolic/repos","events_url":"https://api.github.com/users/elvirdolic/events{/privacy}","received_events_url":"https://api.github.com/users/elvirdolic/received_events","type":"User","site_admin":false},"created_at":"2016-10-06T06:56:36Z","updated_at":"2016-10-06T06:56:36Z","body":"As we have now AOT in angular-cli the question is how we can use i18n with aot and CLI? At the moment I don't see the possibility. \r\n\r\n@christiandreher already said this is a common case for apps to support multiple languages and I think it would be a great experience to have this in CLI to make the experience complete or at least some instructions how that can be achieved outside of CLI magic blackbox.\r\n\r\n"}}
{"actor":{"display_login":"elvirdolic"}}