Skip to content

using in project #11

@samvloeberghs

Description

@samvloeberghs

Hi,

I'm trying to integrate this library in the starter kit provided by AngularClass:
https://github.com/AngularClass/angular2-webpack-starter.

PatrickJS/PatrickJS-starter#208

The webpack dev server is serving from the src folder. The translations are defined in
src/assets/i18n.

It doesn't seem to find the translation files using the provided setup:

export class App {
  name = 'Angular 2 Webpack Starter';
  url = 'https://twitter.com/AngularClass';
  constructor(translate: TranslateService) {

    var prefix = 'assets/i18n';
    var suffix = '.json';
    translate.useStaticFilesLoader(prefix, suffix);

    var userLang = navigator.language.split('-')[0]; // use navigator lang if available
    userLang = /(nl|fr|en)/gi.test(userLang) ? userLang : 'en';

    // optional, default is "en"
    translate.setDefaultLang('en');

    // the lang to use, if the lang isn't available, it will use the current loader to get them
    translate.use(userLang);

  }
}

But if I change the configuration to be var prefix = 'src/assets/i18n'; it works.

I'm not sure this is something related to your package or perhaps to the starter kit architecture. So that's why I'll post it and reference it in both projects.

Kr
Sam V.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions