Questions tagged [transloco]
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.
36
questions
0
votes
1
answer
9
views
Transloco dependency conflict
I am trying to add the Transloco package to my Angular Ionic project which I compile in VSCode. I am running Angular version 13.3.0 When I run the installation command:
ng add @ngneat/transloco
I get ...
0
votes
1
answer
26
views
Can't use TRANSLOCO with Storybook in Angular Lib
i'm working on an Angular 13 lib and i want to implement storybook and all lib's compontents include TRANSLOCO.
So, when i create stories i can't see those because i have issues like this:
NG0302: ...
0
votes
1
answer
30
views
How to call Method where Constructor has httpclient in @NgModule?
I am currently using Transloco to do translation in my application. I have the below @NgModule.
@NgModule({
exports: [TranslocoModule],
providers: [
{
provide: TRANSLOCO_CONFIG,
...
0
votes
0
answers
89
views
Error migrating an NX workspace with Nestjs and Transloco (from 12 to 13)
I've followed the steps on this guide to migrate from NX 12 to NX 13.
The migration itself had no problems.
However, when starting the app, I get the following error:
/home/gitpod/myproject/src/...
0
votes
4
answers
419
views
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(...
0
votes
0
answers
29
views
Transloco configuration missingHandler.logMissingKey
I have an Angular component that gets a TranslocoService injected into the constructor. The point of this component is to use the key provided as the output of the transform method in the event the ...
1
vote
0
answers
91
views
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 ...
0
votes
1
answer
268
views
Transloco does NOT work in my Angular 12 Prod Build, while it works in my DEV build. What could I be missing?
When I run my Angular 12 application locally using npm start the Transloco translations work fine.
However, after an ng build --configuration production when I run my application using http-server ...
1
vote
0
answers
41
views
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:
@...
0
votes
0
answers
42
views
How to store language code in Angular 6+ with Transloco API
I use the Transloco API where I use two languages: ['en', 'es'].
Whichever I choose I want to store and use when reloading the page.
1
vote
0
answers
102
views
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 ...
0
votes
1
answer
353
views
Transloco - how to add scope to Translation API?
How to set the scope when using : this.translocoService.translate('object.test'); ?
My translation files are located in a folder like "MyFolder", so the scope will be MyFolder.
This is the ...
0
votes
0
answers
30
views
transloco key in expression with single quote escape
what is the best way to have a string that contains a single quote, but it is used as a key to transloco and this is in an attribute:
<div [tooltip]="t('can't use single quote')">
...
0
votes
0
answers
46
views
Angular subdirectories with gTLDs
Currently I am working on an Angular project which is multilingual and uses transloco for that. I already have transloco built in throughout the application and now wanted to link this to the url in ...
0
votes
1
answer
78
views
How do I translate const files if I can't import TranslocoService?
Introduction
Hello, I have an Angular+Ionic project and I'm using Transloco to translate some of the text.
The problem
I have a consts file that has strings inside and I want to be able to translate ...
0
votes
1
answer
106
views
How to add Transloco translation files in production mode?
I got an error when running my app in IIS: myServer/assets/i18n/de.json not found. How to add the Transloco translation files in production mode?
1
vote
1
answer
148
views
How to convert Observable<Some> to other Observable<Other>
I would like to use Transloco and gather translations from existing REST API and not from the i18n file. I replaced line in TranslocoHttpLoader by rest service call:
getTranslation(lang: string): ...
0
votes
0
answers
120
views
Is there a way to use a scope to translate an array by using the pipe approach of transloco?
I am tring to use pipe approach of transloco to translate an array by using scope.
Code in .component.ts
providers: [{ provide: TRANSLOCO_SCOPE, useValue:{scope:'components/content-search/content-...
0
votes
1
answer
722
views
How to check missing translation keys in transloco?
I am currently using Transloco to do my translations in angular application. I have 2 files in my assets:
en.json with values:
{
"firstName": "First Name",
"lastName": &...
1
vote
0
answers
89
views
Transloco - Is there a way to reference other translations within a plural rule?
We are using plural rules in the JSON in our app, such as:
"myPluralRule": "{myCount, plural, =0 {no results} one {1 result} other {# results}}"
However, we need to translate ...
0
votes
1
answer
238
views
TranslocoLocale pipes injected into a service causes unit test errors
How can I test a service that uses TranslocoLocale pipes (TranslocoDecimalPipe, TranslocoDatePipe, etc.)? I could obviously mock the pipes myself but I shouldn't have to.
TranslocoLocale pipes in my ...
0
votes
1
answer
68
views
Failed to load i18N files after ionic build
After running NG Build to generate a PWA solution, the i18n files of the transloc translation are not being found. I looked for where the files are being pointed, but I didn't find them.
The correct ...
3
votes
0
answers
296
views
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 ...
1
vote
2
answers
432
views
Angular ngFor on an array loaded via Transloco
I'm using Transloco to manage multiple language in an angular10 project.
I created a json i18n file like this:
"Datalist":[
{
"from" : "value",
&...
0
votes
1
answer
148
views
How to use 'transloco' on `pie-chart` in Angular?
This is my code:
.HTML:
<div fxFlex>
<ngx-charts-pie-chart
[view]="view"
[scheme]="colorScheme"
...
2
votes
1
answer
550
views
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 ...
1
vote
0
answers
374
views
How to get scoped values in the Transloco Translate API
I am trying to find the syntax for getting translation values from a scoped object.
I would like to get the translation text for the key "title".
file: en.json
{
"foo": "Foo&...
0
votes
1
answer
1k
views
NullInjectorError: No provider for InjectionToken DEFAULT_LOCALE
I am trying to set up an Angular 2 project with i18n. Followed the tutorial here using Transloco and all works great. However, when I run the unit tests I get this error and I cant find anything ...
0
votes
1
answer
2k
views
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)...
1
vote
1
answer
1k
views
How to correctly unit test labels coming from transloco api in angular
I have been using Transloco API for a time but I have not been able to use it during unit testing.
I am following this blog from ngneat Unit testing with transloco
But my simple test cases are also ...
-2
votes
1
answer
854
views
Transloco - how to add a language at runtime
I'm writing an app with Angular 8 and NativeScript 6.4.1.
I am considering using Transloco for my translations library.
I need to be able to change the language at runtime as well as add a new ...
5
votes
0
answers
547
views
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 ...
0
votes
1
answer
180
views
Ionic 5 action sheet text not accept transloco
I am using action sheet and transloco translate plugin in my ionic 5 angular app.
When I use transloco on text the APP is considering as string.
buttons: [{
text: "{{'channel.edit' | transloco}}"...
1
vote
1
answer
302
views
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'
3
votes
1
answer
459
views
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 ...