Skip to content
This repository has been archived by the owner on Nov 8, 2021. It is now read-only.

Loader does not work with base-href set #11

Closed
joachimprinzbach opened this issue Jul 7, 2017 · 8 comments
Closed

Loader does not work with base-href set #11

joachimprinzbach opened this issue Jul 7, 2017 · 8 comments

Comments

@joachimprinzbach
Copy link
Contributor

When having a base-href set, the loader ignores it and can't fetch the i18n files.

Example:
"build": "ng build --aot --prod --base-href /somestring/",

All requests are ignoring the base-href: "/assets/i18n/en.json" instead of "/somestring/assets/i18n/en.json".
Adding a dot to the prefix ("./assets/i18n/") fixes the problem.

@desfero
Copy link

desfero commented Jul 18, 2017

+1

4 similar comments
@mzilian
Copy link

mzilian commented Jul 19, 2017

+1

@reikyoushin
Copy link

+1

@culmat
Copy link

culmat commented Aug 17, 2017

👍

@DCollart
Copy link

👍

@PunkHaz4rd
Copy link

Is it gonna be merged soon ? it's been 2 month that there's a fix already.

@pgossmann
Copy link

How do I workaround this?
too bad that this simple fix is not merged. I wish I would know how to help.

@GoshaFighten
Copy link

@pgossmann Provide your own TranslateLoader:

TranslateModule.forRoot({
      loader: {
        provide: TranslateLoader,
        useFactory: HttpLoaderFactory,
        deps: [HttpClient]
      }
}),
export function HttpLoaderFactory(http: HttpClient) {
  return new TranslateHttpLoader(http, './assets/i18n/');
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants