feat: Rename to Toju and add translation
Some checks failed
Build Android APK / build-android-apk (push) Has been cancelled
Deploy Web Apps / deploy (push) Has been cancelled
Queue Release Build / prepare (push) Has been cancelled
Queue Release Build / build-linux (push) Has been cancelled
Queue Release Build / build-windows (push) Has been cancelled
Queue Release Build / finalize (push) Has been cancelled
Some checks failed
Build Android APK / build-android-apk (push) Has been cancelled
Deploy Web Apps / deploy (push) Has been cancelled
Queue Release Build / prepare (push) Has been cancelled
Queue Release Build / build-linux (push) Has been cancelled
Queue Release Build / build-windows (push) Has been cancelled
Queue Release Build / finalize (push) Has been cancelled
This commit is contained in:
40
toju-app/src/app/core/i18n/app-i18n.service.spec.ts
Normal file
40
toju-app/src/app/core/i18n/app-i18n.service.spec.ts
Normal file
@@ -0,0 +1,40 @@
|
||||
import { createEnvironmentInjector } from '@angular/core';
|
||||
import { TranslateService, provideTranslateService } from '@ngx-translate/core';
|
||||
|
||||
import { AppI18nService } from './app-i18n.service';
|
||||
|
||||
describe('AppI18nService', () => {
|
||||
let injector: ReturnType<typeof createEnvironmentInjector>;
|
||||
let service: AppI18nService;
|
||||
let translate: TranslateService;
|
||||
|
||||
beforeEach(() => {
|
||||
injector = createEnvironmentInjector([
|
||||
provideTranslateService({
|
||||
fallbackLang: 'en',
|
||||
lang: 'en'
|
||||
}),
|
||||
AppI18nService
|
||||
]);
|
||||
|
||||
service = injector.get(AppI18nService);
|
||||
translate = injector.get(TranslateService);
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
injector.destroy();
|
||||
});
|
||||
|
||||
it('loads bundled English translations on initialize', () => {
|
||||
service.initialize();
|
||||
|
||||
expect(translate.getCurrentLang()).toBe('en');
|
||||
expect(translate.instant('common.brand')).toBe('Toju');
|
||||
});
|
||||
|
||||
it('falls back to English for unsupported locale requests', () => {
|
||||
service.initialize('fr');
|
||||
|
||||
expect(translate.getCurrentLang()).toBe('en');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user