##// END OF EJS Templates
Added tag v1.0.8 for changeset dd0d589acfbb
Added tag v1.0.8 for changeset dd0d589acfbb

File last commit:

r55:dd0d589acfbb v1.0.8 default
r56:1661e3ab870c default
Show More
i18n.ts
51 lines | 1.5 KiB | video/mp2t | TypeScriptLexer
cin
i18n corrected default locale selection, more verbose error reporting
r55 import { id as mid} from "module";
cin
Initial commit, copied files related to .tsx scripts support.
r0 import { MapOf } from "@implab/core-amd/interfaces";
import { NlsBundle } from "./NlsBundle";
import { isPromise } from "@implab/core-amd/safe";
cin
i18n corrected default locale selection, more verbose error reporting
r55 import { locale as sysLocale } from "dojo/_base/kernel";
import { TraceSource } from "@implab/core-amd/log/TraceSource";
const trace = TraceSource.get(mid);
trace.debug("Current sysLocale: {0}", sysLocale);
cin
Initial commit, copied files related to .tsx scripts support.
r0
cin
Fixed i18n exports
r44 export interface OnLoad {
cin
fixes to css, nls to support requirejs optimizer
r36 (result?: any): void;
error(err: any): void;
}
cin
Initial commit, copied files related to .tsx scripts support.
r0 export function bundle<T extends object>(nls: T, locales?: MapOf<any>) {
const nlsBundle = new NlsBundle(nls, locales);
cin
i18n corrected default locale selection, more verbose error reporting
r55 const fn = (_locale?: string) => {
const locale = _locale || sysLocale;
cin
corrected i18n, css modules to support requirejs optimizer...
r53 const result = nlsBundle.getLocale(locale);
cin
created typings for basic part of dojo and dijit further work is required to...
r2
cin
Initial commit, copied files related to .tsx scripts support.
r0 if (isPromise(result))
throw new Error(`The bundle '${locale}' isn't loaded`);
else
return result;
};
fn.define = (pack: Partial<T>) => pack;
cin
fixes to css, nls to support requirejs optimizer
r36 fn.load = async (id: string, require: Require, cb: OnLoad, config: any) => {
cin
i18n corrected default locale selection, more verbose error reporting
r55 const locale = id || sysLocale;
cin
Fixed loading i18n with dojo module loader
r46 if (config && config.isBuild) {
cin
Initial commit, copied files related to .tsx scripts support.
r0 cb();
cin
fixes to css, nls to support requirejs optimizer
r36 } else {
try {
cin
i18n corrected default locale selection, more verbose error reporting
r55 await nlsBundle.getLocale(locale);
cin
fixes to css, nls to support requirejs optimizer
r36 cb();
} catch (e) {
cin
i18n corrected default locale selection, more verbose error reporting
r55 if(cb.error) {
cin
corrected i18n, css modules to support requirejs optimizer...
r53 cb.error(e);
cin
i18n corrected default locale selection, more verbose error reporting
r55 } else {
// in case the loader doesn't support error reporting
trace.error("Error loading {0}: {1}", locale, e);
}
cin
fixes to css, nls to support requirejs optimizer
r36 }
cin
Initial commit, copied files related to .tsx scripts support.
r0 }
};
return fn;
}