Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use different directories for translation files #781

Closed
KNeela opened this issue Jan 26, 2018 · 4 comments
Closed

use different directories for translation files #781

KNeela opened this issue Jan 26, 2018 · 4 comments

Comments

@KNeela
Copy link

KNeela commented Jan 26, 2018

I'm using ngx-translate to translate buttons, headers, ... in my app and this works fine. My translation files are in the /assets/i18n/ folder.

Now I have mockdata which I also have to translate, but my mockdata is in another directory -> /assets/data/

To load my json translations files from the i18n folder I use:

export function setTranslateLoader(http: HttpClient) {
  return new TranslateHttpLoader(http, './assets/i18n/', '.json');
}

but now I also want to load the files from the data directory.

How can I achieve that?

  • ngx-translate version: 8.0.0

  • Angular version: 4.4.3

@Iv3li0s
Copy link

Iv3li0s commented Jan 27, 2018

Hey,
Solution here : issues 199

@KNeela
Copy link
Author

KNeela commented Feb 1, 2018

Hi, thanks for your answer. I tried this code but i dont really get it to work.
can you take a look at my plunker?
https://plnkr.co/edit/K2dZuYAREvOA48sm66N9?p=info

@Iv3li0s
Copy link

Iv3li0s commented Feb 1, 2018

Hey,

import { Observable } from 'rxjs/Observable';
import 'rxjs/add/observable/forkJoin';
Observable.forkJoin(...)

fail in error... as if angular can't find Observable import.
You can force it via :

import Rx from 'rxjs/Rx';
Rx.Observable.forkJoin(...)

@Iv3li0s
Copy link

Iv3li0s commented Feb 1, 2018

In plunker the "root file" is not as in classic angular app
You must add "src"
{prefix: './assets/i18n/', suffix: '.json'} besome
{prefix: './src/assets/i18n/', suffix: '.json'}

@KNeela KNeela closed this as completed Feb 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants