{"action":"created","issue":{"url":"https://api.github.com/repos/ngx-translate/core/issues/425","repository_url":"https://api.github.com/repos/ngx-translate/core","labels_url":"https://api.github.com/repos/ngx-translate/core/issues/425/labels{/name}","comments_url":"https://api.github.com/repos/ngx-translate/core/issues/425/comments","events_url":"https://api.github.com/repos/ngx-translate/core/issues/425/events","html_url":"https://github.com/ngx-translate/core/issues/425","id":206953474,"number":425,"title":".forChild() usage with lazy loading routes","user":{"login":"dhardtke","id":1360135,"avatar_url":"https://avatars0.githubusercontent.com/u/1360135?v=4","gravatar_id":"","url":"https://api.github.com/users/dhardtke","html_url":"https://github.com/dhardtke","followers_url":"https://api.github.com/users/dhardtke/followers","following_url":"https://api.github.com/users/dhardtke/following{/other_user}","gists_url":"https://api.github.com/users/dhardtke/gists{/gist_id}","starred_url":"https://api.github.com/users/dhardtke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dhardtke/subscriptions","organizations_url":"https://api.github.com/users/dhardtke/orgs","repos_url":"https://api.github.com/users/dhardtke/repos","events_url":"https://api.github.com/users/dhardtke/events{/privacy}","received_events_url":"https://api.github.com/users/dhardtke/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":8,"created_at":"2017-02-11T03:15:31Z","updated_at":"2017-10-06T13:41:53Z","closed_at":null,"author_association":"NONE","body":"**I'm submitting a ...**  (check one with \"x\")\r\n```\r\n[ ] bug report => check the FAQ and search github for a similar issue or PR before submitting\r\n[x] support request => check the FAQ and search github for a similar issue before submitting\r\n[ ] feature request\r\n```\r\n\r\n**Current behavior**\r\n`AppModule`\r\n```typescript\r\nexport function createTranslateLoader(http: Http) {\r\n    return new TranslateHttpLoader(http, \"/i18n/\", \"/index.json\");\r\n}\r\nimports: [\r\n    TranslateModule.forRoot({\r\n            loader: {\r\n                provide: TranslateLoader,\r\n                useFactory: createTranslateLoader,\r\n                deps: [Http]\r\n            }\r\n        }),\r\n]\r\n```\r\n`SharedModule`\r\n```typescript\r\nimports: [\r\n    //TranslateModule\r\n],\r\nexports: [\r\n    //TranslateModule,\r\n]\r\n```\r\n\r\n`AdminModule`\r\n```\r\nexport function createTranslateLoader(http: Http) {\r\n    return new TranslateHttpLoader(http, \"/i18n/\", \"/admin.json\");\r\n}\r\nimports: [\r\n    TranslateModule.forChild({\r\n            loader: {\r\n                provide: TranslateLoader,\r\n                useFactory: createTranslateLoader,\r\n                deps: [Http]\r\n            }\r\n        }),\r\n]\r\n```\r\n\r\n**Expected/desired behavior**\r\nI would like to load additional JSON files per component / module, i.e. an admin.json for the administration panel of our app.\r\nI would like to import one TranslateModule inside of `SharedModule` and configure it allow all modules that don't explicite call .forChild().\r\n\r\nBoth doesn't work, it simply doesn't load the admin.json and hence doesn't translate strings defined in that file.\r\n\r\n**Please tell us about your environment:**\r\n\r\n* **ngx-translate version:** 6.0.0-beta.1\r\n\r\n* **Angular version:** 2.4.7\r\n \r\n* **Browser:** [Firefox 51.0.1] \r\n \r\n* **Language:** [TypeScript 2.0] "},"comment":{"url":"https://api.github.com/repos/ngx-translate/core/issues/comments/334758249","html_url":"https://github.com/ngx-translate/core/issues/425#issuecomment-334758249","issue_url":"https://api.github.com/repos/ngx-translate/core/issues/425","id":334758249,"user":{"login":"Tuizi","id":2027148,"avatar_url":"https://avatars2.githubusercontent.com/u/2027148?v=4","gravatar_id":"","url":"https://api.github.com/users/Tuizi","html_url":"https://github.com/Tuizi","followers_url":"https://api.github.com/users/Tuizi/followers","following_url":"https://api.github.com/users/Tuizi/following{/other_user}","gists_url":"https://api.github.com/users/Tuizi/gists{/gist_id}","starred_url":"https://api.github.com/users/Tuizi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Tuizi/subscriptions","organizations_url":"https://api.github.com/users/Tuizi/orgs","repos_url":"https://api.github.com/users/Tuizi/repos","events_url":"https://api.github.com/users/Tuizi/events{/privacy}","received_events_url":"https://api.github.com/users/Tuizi/received_events","type":"User","site_admin":false},"created_at":"2017-10-06T13:41:53Z","updated_at":"2017-10-06T13:41:53Z","author_association":"NONE","body":"What would be a real solution?\r\n\r\nI have time to work on a PR and I would like to try to solve this problem, which seems to impact many people.\r\n\r\nWhat do you think of that?\r\n\r\n**Core Module**\r\n```typescript\r\nexport function createTranslateLoader(http: HttpClient) {\r\n  // We may need a new loader? To define the folder where i18n's files are, and the extension\r\n  return new LazyTranslateHttpLoader(http, './assets/i18n/', '.json');\r\n}\r\n\r\nTranslateModule.forRoot({\r\n  loader: {\r\n      provide: TranslateLoader,\r\n      useFactory: (createTranslateLoader),\r\n      deps: [HttpClient]\r\n  }\r\n})\r\n```\r\n\r\n**Lazy loaded Module: admin**\r\n```typescript\r\n  TranslateModule.forChild({lazy: 'admin'})\r\n```\r\n\r\nWhen admin module is loaded, the file `./assets/i18n/admin/en.json` will be requested. \r\n\r\nWhat do you think of that?"}}
{"actor":{"display_login":"Tuizi"}}