本文整理匯總了TypeScript中angular-l10n.LocaleService類的典型用法代碼示例。如果您正苦於以下問題:TypeScript LocaleService類的具體用法?TypeScript LocaleService怎麽用?TypeScript LocaleService使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了LocaleService類的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: constructor
constructor(public locale: LocaleService, public translation: TService) {
this.locale.addConfiguration()
.addLanguages(['en', 'es'])
.setCookieExpiration(30)
.defineLanguage('es')
this.translation.addConfiguration()
.addProvider('./assets/locale-')
this.translation.init()
}
示例2: constructor
// Constructor del modulo raiz importa aquellos servicios que seran globales
// para todos los demas modulos
constructor(
private home: HomeElementsService,
private langManager: LanguageService,
public locale: LocaleService,
public translation: TService
) {
this.locale.addConfiguration()
.addLanguages(['en', 'es'])
.setCookieExpiration(30)
.defineLanguage('es');
this.translation.addConfiguration()
.addProvider('./assets/locale-');
this.translation.init()
}
示例3: selectLanguage
public selectLanguage(language: string): void {
this.locale.setCurrentLanguage(language)
/*setTimeout(function () {
$("select").material_select()
}, 200)*/
localStorage.lang = language
}
示例4: load
load(): Promise<any> {
this.locale.addConfiguration()
.addLanguages(['en', 'sr'])
.setCookieExpiration(30)
.defineDefaultLocale('sr', 'RS').defineCurrency('RSD');
this.locale.init();
this.translation.addConfiguration()
.addProvider('./assets/locale/locale-');
this.translation.init();
const promise: Promise<any> = new Promise((resolve: any) => {
this.translation.translationChanged.subscribe(() => {
resolve(true);
});
});
this.translation.init();
return promise;
}
示例5: selectLocale
selectLocale(language: string, country: string, currency: string): void {
this.locale.setDefaultLocale(language, country);
this.locale.setCurrentCurrency(currency);
location.reload();
}
示例6: selectLanguage
public selectLanguage(language: string): void {
this.locale.setCurrentLanguage(language)
this.locale.setDefaultLocale(language, "US");
this.locale.setCurrentCurrency("USD");
this.storage.set("lang", language)
}