-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
77 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
describe('App Component Init - Check Nixng title', () => { | ||
it('Should contain heading', () => { | ||
cy.visit('http://localhost:4200/') | ||
cy.contains("এটা হলো nixng") | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
describe('App Component - Translation Check', () => { | ||
|
||
beforeEach(() => { | ||
cy.visit('http://localhost:4200/') | ||
}) | ||
|
||
it('Should contain english title', () => { | ||
cy.get('[data-cy="language"]').select('en') | ||
cy.contains("This is nixng") | ||
}) | ||
it('Should contain spanish title', () => { | ||
cy.get('[data-cy="language"]').select('es') | ||
cy.contains("Esto es nixng") | ||
}) | ||
it('Should contain Bangla title', () => { | ||
cy.get('[data-cy="language"]').select('bn') | ||
cy.contains("এটা হলো nixng") | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { HttpClient } from '@angular/common/http'; | ||
import { | ||
TRANSLOCO_LOADER, | ||
Translation, | ||
TranslocoLoader, | ||
TRANSLOCO_CONFIG, | ||
translocoConfig, | ||
TranslocoModule | ||
} from '@ngneat/transloco'; | ||
import { Injectable, NgModule } from '@angular/core'; | ||
import { environment } from '../environments/environment'; | ||
|
||
@Injectable({ providedIn: 'root' }) | ||
export class TranslocoHttpLoader implements TranslocoLoader { | ||
constructor(private http: HttpClient) {} | ||
|
||
getTranslation(lang: string) { | ||
return this.http.get<Translation>(`/assets/i18n/${lang}.json`); | ||
} | ||
} | ||
|
||
@NgModule({ | ||
exports: [TranslocoModule], | ||
providers: [ | ||
{ | ||
provide: TRANSLOCO_CONFIG, | ||
useValue: translocoConfig({ | ||
availableLangs: ['en', 'es', 'bn'], | ||
defaultLang: 'bn', | ||
// Remove this option if your application doesn't support changing language in runtime. | ||
reRenderOnLangChange: true, | ||
prodMode: environment.production | ||
}) | ||
}, | ||
{ provide: TRANSLOCO_LOADER, useClass: TranslocoHttpLoader } | ||
] | ||
}) | ||
export class TranslocoRootModule {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"title":"এটা হলো" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"title":"This is" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"title":"Esto es" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module.exports = { | ||
rootTranslationsPath: 'src/assets/i18n/', | ||
langs: ['en', 'es', 'bn'], | ||
keysManager: {} | ||
}; |