question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ng2 translate does not work with webpack

See original GitHub issue

For reducing the start time of the application, I have configured webpack in my application . But after that ng2 translate is not working and I am getting the error ERROR Error: Uncaught (in promise): Response with status: 200 for URL: null

“ng2-translate”: “^5.0.0”,

app.module.ts

export function createTranslateLoader(http: Http) {
    return new TranslateHttpLoader(http, './assets/i18n', '.json');
}
@NgModule({
  declarations: [AppComponent],
  bootstrap: [AppComponent],
imports: [
    NativeScriptModule,
    NativeScriptHttpModule,
    NativeScriptUIListViewModule,
    NativeScriptFormsModule,
    NativeScriptUISideDrawerModule,
    NativeScriptRouterModule,
    NativeScriptRouterModule.forRoot(routes),
    TranslateModule.forRoot({
            provide: TranslateLoader,
            useFactory: (createTranslateLoader),
            deps: [Http]
        })
  ],

In webpack.config.js I have added

new CopyWebpackPlugin([
            {from: mainSheet},
            {from: "css/**"},
            {from: "fonts/**"},
            {from: "**/*.jpg"},
            {from: "**/*.png"},
            {from: "**/*.xml"},
            **{from: "i18n/*.json"},**
            {from: "**/*.json"},
        ], {ignore: ["App_Resources/**"]}),

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:5

github_iconTop GitHub Comments

5reactions
Cayancommented, Jul 19, 2017

I had a similar issue a few hours ago, if your translation json is inside the folder app/assets/i18n add the next line to your CopyWebpackPlugin { from: “assets/i18n/*.json” }

0reactions
mozi22commented, Apr 24, 2018

@Shifs did you solve this issue ?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Ng2-translate and webpack - Stack Overflow
Good that you provided a example project, I was able to quickly review it and looks like you are using latest version of...
Read more >
webpack/webpack - Gitter
Hi guys, I got a problem with webpack and angular 2. I have created a component and uploaded it on npm. Then I...
Read more >
How to translate your Angular app with ngx-translate
1. Add ngx-translate to your Angular application 2. Set up the TranslateService in your app.module.ts 3. Create your main language translation file (in...
Read more >
ng2-translate - npm Package Health Analysis - Snyk
The npm package ng2-translate was scanned for known vulnerabilities and missing license, and no issues were found. Thus the package was deemed as...
Read more >
[Solved]-Ng2-translate and webpack - appsloveworld
In Xcode, how to not run certain Run Script Build Phases when running Tests? Caching images in memory on iOS, what is smaller...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found