Transloco is an open-source internationalisation and localisation library for Angular and a set of accompanying tools for translations management. It's main features are: switching languages at runtime, lazy-loading support and Ivy compatibility.
Questions tagged [transloco]
55 questions
5
votes
1 answer
Unable to load translation and all the fallback languages, did you misspelled the scope name?
I'm trying to use "@ngneat/transloco": ^2.17.1" for i18n in my application. It was working fine earlier but i don't know what happened suddenly all of a sudden I get this error message Unable to load translation and all the fallback languages, did…

HariHaran
- 3,642
- 2
- 16
- 33
4
votes
1 answer
AOT mode in angular builds add `fr.` or `en.` as prefix of translation keys in transloco
I've simple translation keys like login-page.login.
When building in AOT, the translation isn't displayed correctly and instead the key fr.login-page.login is displayed.
I didn't found why AOT would add the lang prefix.
Obviously in JIT everything…

Alexandre SIRKO
- 816
- 11
- 22
3
votes
1 answer
Transloco translateService.translate does not work in app.component.ts
If I enter the below in my app.component.ts constructor, it does not work.
alert(this.translateService.translate('navigation.dashboard'));
However if I enter this same code in a submodule, it works fine.
This is my .json file:
"navigation": {
…

avdeveloper
- 449
- 6
- 30
2
votes
1 answer
How to check if a translation file has been loaded in transloco?
I have an Angular 14 project to which I recently added transloco. It works well, but it also uses some PrimeNG to which I must provide the right i18n translations every time the language is switched.
This is what I have right now:
ngOnInit(): void…

SJuan76
- 24,532
- 6
- 47
- 87
2
votes
1 answer
Transloco Locale. How to add custom date filter?
I am trying to extend the date filters transloco locale provides by default with some others that meet our customer requirements. However, documentation does not provide examples or good explanations about this.
Have any of you managed to add custom…

Francisco
- 265
- 1
- 2
- 17
2
votes
1 answer
Transloco translate doesn't work the first time
This is my Transloco config:
@Injectable({ providedIn: 'root' })
export class TranslocoHttpLoader implements TranslocoLoader {
constructor(private http: HttpClient) {}
getTranslation(lang: string) {
return…

Conde
- 785
- 15
- 31
2
votes
1 answer
how should I change Material Table titles using transloco i18n(internationalization) liabrary for pagination and page range, next , previous buttons?
want to show titles using i18n
Above is the image for showing titles 'items per page'

shiVam_Mak
- 39
- 1
- 8
1
vote
0 answers
Angular initialize Transloco before application
In a Angular project we are using Transloco for translations. Inside my typescript i am trying to use the transloco service like so:
this.translocoService.translate('foo.bar')
I am aware that I am responsible for ensuring that the translation files…

Heathcliff
- 97
- 1
- 11
1
vote
1 answer
Transloco in Storybook throws "No provider for InjectionToken TRANSLOCO_TRANSPILER"
Transloco doesn't seem to work with Storybook anymore. I created a new clean repo with Angular, Transloco and Storybook on latest version and I always get the error:
NG0302: The pipe 'transloco' could not be found in the 'SomeComponent' component.…

Mick
- 8,203
- 10
- 44
- 66
1
vote
1 answer
Angular SSR: Get Request instance (for grabbing headers) inside a route resolver
I'm working on an SSR project and trying to get the users request headers sent to the node server to parse the accepted language header param inside an angular resolver.
What Im trying to do is redirect the users root route to a preferred language…

Don
- 366
- 1
- 10
1
vote
0 answers
Translation not loaded at start up in Angular app
I encounter this problem on both ngx-translate and transloco in my Angular 15 app, so it might be a configuration issue.
When my app is loaded, in the app.component.ts, depending on if the user is logged in or not, he is redirected to the login…

pat
- 11
- 1
- 2
1
vote
4 answers
Angular Transloco usage in ngOnInit()
I know that the following code doesn't work, because the translation file en.json hasn't been loaded, when ngOnInit() is called:
component.ts
ngOnInit() {
console.log(this.translocoService.translate('hello', { value: 'world' }););
}
en.json
{
…

dewey
- 809
- 2
- 16
- 47
1
vote
0 answers
Can transloco.config.js in a monorepo environment support multiple apps built from different libraries
With reference to the structure explained in https://ngneat.github.io/transloco/docs/tools/scope-lib-extractor, if we have two apps
app (built on core library)
app2[built on core2 library)
What is the best way to get translations from library…

TJ-
- 11
- 1
1
vote
0 answers
inject translocoDecimalPipe into other pipe
I stumbled upon a problem while trying to inject TranslocoDecimalPipe into my custom pipe. The error I receive is either about something else or I do not understand it entirely.
Here is my service:
@Pipe({
name: 'valueCurrency',
})
export class…

Mike
- 809
- 6
- 20
1
vote
0 answers
Transloco - How to avoid adding transloco root module to non transloco apps but incluide the library which needs translations
I'm using the transloco for my Nx project. I have multiple apps and libraries in my Nx project. For one of the project and related libraries, I have added the transloco. But the same libraries are used in the other app where transloco isn't needed.…

Kranthi
- 1,377
- 1
- 17
- 34