Skip to content

Commit

Permalink
SHIBUI-814 Fixed test and ref to navigator
Browse files Browse the repository at this point in the history
  • Loading branch information
rmathis committed Sep 21, 2018
1 parent a3c4e40 commit f365125
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 19 deletions.
16 changes: 1 addition & 15 deletions ui/src/app/i18n/service/i18n.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,6 @@ import { HttpClientModule } from '@angular/common/http';
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { NavigatorService } from '../../core/service/navigator.service';

class MockNavigatorService {
language = 'en-US';

languages = ['en-US'];

get native(): string {
return this.language;
}

set native(str: string) {
this.language = str;
}
}

describe('i18n Service', () => {
let service: I18nService;
let nav: NavigatorService;
Expand All @@ -29,7 +15,7 @@ describe('i18n Service', () => {
HttpClientTestingModule
],
providers: [
{ provide: NavigatorService, useClass: MockNavigatorService },
NavigatorService,
I18nService
]
});
Expand Down
8 changes: 4 additions & 4 deletions ui/src/app/i18n/service/i18n.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,20 @@ export class I18nService {
}

getCurrentLanguage(): string {
return getCurrentLanguage(this.navigator);
return getCurrentLanguage(this.navigator.native);
}

getCurrentCountry(): string {
return getCurrentCountry(this.navigator);
return getCurrentCountry(this.navigator.native);
}

getCurrentLocale(): string {
return getCurrentLocale(this.navigator);
return getCurrentLocale(this.navigator.native);
}

translate(value: string, interpolated: any, messages: Messages): string {
interpolated = interpolated || {};
let val = messages.hasOwnProperty(value) ? messages[value] : value;
let val = messages.hasOwnProperty(value) ? messages[value] : (Object.keys(messages).length ? value : '');
return this.interpolate(val, interpolated);
}

Expand Down

0 comments on commit f365125

Please sign in to comment.