bobril-g11n
Advanced tools
Comparing version 1.4.0 to 2.0.0
CHANGELOG | ||
=== | ||
2.0.0 | ||
-- | ||
Breaking changes | ||
- | ||
Requires Bobril 4.44.0 or higher, but does not depend on it in package.json. Bobril needs to be required sooner than bobril-g11n. | ||
When setLocale fails it will revoke returned promise. Additionaly it will try to revert to default locale before. | ||
1.4.0 | ||
@@ -5,0 +14,0 @@ -- |
{ | ||
"name": "bobril-g11n", | ||
"version": "1.4.0", | ||
"version": "2.0.0", | ||
"description": "Bobril globalization", | ||
@@ -11,3 +11,2 @@ "main": "index.js", | ||
"dependencies": { | ||
"bobril": "*", | ||
"moment": "^2.10.6", | ||
@@ -17,2 +16,3 @@ "numeral": "^1.5.3" | ||
"devDependencies": { | ||
"bobril": "^4.44.0", | ||
"graceful-fs": "*", | ||
@@ -19,0 +19,0 @@ "gulp": "^3.9.0", |
"use strict"; | ||
var msgFormatParser = require("./msgFormatParser"); | ||
var msgFormatter = require('./msgFormatter'); | ||
var b = require('bobril'); | ||
var jsonp_1 = require('./jsonp'); | ||
@@ -74,3 +73,3 @@ var localeDataStorage = require('./localeDataStorage'); | ||
b.setBeforeInit(function (cb) { | ||
initPromise.then(cb); | ||
initPromise.then(cb, cb); | ||
}); | ||
@@ -81,3 +80,3 @@ function initGlobalization(config) { | ||
} | ||
b.assign(cfg, config); | ||
Object.assign(cfg, config); | ||
initWasStarted = true; | ||
@@ -104,3 +103,7 @@ if (currentLocale.length !== 0) { | ||
return jsonp_1.jsonp(p_1); | ||
}).then(null, function (e) { return console.warn(e); }); | ||
}).then(null, function (e) { | ||
console.warn(e); | ||
if (locale != cfg.defaultLocale) | ||
return setLocale(cfg.defaultLocale).then(function () { return Promise.reject(e); }); | ||
}); | ||
} | ||
@@ -107,0 +110,0 @@ } |
import * as msgFormatParser from "./msgFormatParser"; | ||
import * as msgFormatter from './msgFormatter'; | ||
import * as b from 'bobril'; | ||
import { jsonp } from './jsonp'; | ||
import * as localeDataStorage from './localeDataStorage'; | ||
declare var b: { | ||
setBeforeInit(callback: (cb: () => void) => void): void; | ||
ignoreShouldChange(): void; | ||
}; | ||
export interface IG11NConfig { | ||
@@ -86,10 +90,10 @@ defaultLocale?: string; | ||
b.setBeforeInit((cb: (_: any) => void) => { | ||
initPromise.then(cb); | ||
initPromise.then(cb, cb); | ||
}); | ||
export function initGlobalization(config?: IG11NConfig): Promise<any> { | ||
export function initGlobalization(config?: IG11NConfig): Promise<void> { | ||
if (initWasStarted) { | ||
throw new Error('initLocalization must be called only once'); | ||
} | ||
b.assign(cfg, config); | ||
Object.assign(cfg, config); | ||
initWasStarted = true; | ||
@@ -116,3 +120,7 @@ if (currentLocale.length !== 0) { | ||
return jsonp(p); | ||
}).then(null, (e) => console.warn(e)); | ||
}).then(null, (e) => { | ||
console.warn(e); | ||
if (locale != cfg.defaultLocale) | ||
return setLocale(cfg.defaultLocale).then(() => Promise.reject(e)); | ||
}); | ||
} | ||
@@ -119,0 +127,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Wildcard dependency
QualityPackage has a dependency with a floating version range. This can cause issues if the dependency publishes a new major version.
Found 1 instance in 1 package
169443
2
3935
0
14
- Removedbobril@*
- Removedbobril@20.10.1(transitive)