New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

bobril-g11n

Package Overview
Dependencies
Maintainers
0
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bobril-g11n - npm Package Compare versions

Comparing version 5.1.2 to 5.2.0

4

CHANGELOG.md
# CHANGELOG
## 5.2.0
Improved error message to better understand what is wrong with client system.
## 5.1.2

@@ -4,0 +8,0 @@

2

package.json
{
"name": "bobril-g11n",
"version": "5.1.2",
"version": "5.2.0",
"description": "Bobril globalization",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -30,6 +30,2 @@ import * as b from "bobril";

function newMap(): any {
return Object.create(null);
}
let cfg: IG11NConfig = {

@@ -41,4 +37,5 @@ defaultLocale: "en-US",

let loadedLocales: { [name: string]: boolean } = newMap();
export let registeredTranslations: { [name: string]: string[] } = newMap();
let failedToLoadLocales: Set<string> = new Set();
let loadedLocales: Set<string> = new Set();
export let registeredTranslations: { [name: string]: string[] } = Object.create(null);
let initWasStarted = false;

@@ -50,3 +47,3 @@ let currentLocale = "";

let currentCachedFormat: IMessageFormat[] = [];
let stringCachedFormats: { [input: string]: IMessageFormat } = newMap();
let stringCachedFormats: Map<string, IMessageFormat> = new Map();
let keysByTranslationId: string[] | undefined = undefined;

@@ -66,3 +63,12 @@ let key2TranslationId: Map<string, number> | undefined = undefined;

if (text === undefined) {
throw new Error("message " + message + " is not defined");
throw new Error(
"Message " +
message +
" is not defined. Current locale: " +
currentLocale +
" Loaded locales: " +
Array.from(loadedLocales).join(", ") +
" Failed to load locales: " +
Array.from(failedToLoadLocales).join(", ")
);
}

@@ -108,3 +114,3 @@ return text;

if (params == null) return spyTranslatedString(message);
format = stringCachedFormats[message];
format = stringCachedFormats.get(message);
if (format === undefined) {

@@ -116,3 +122,3 @@ let ast = msgFormatParser.parse(message);

format = msgFormatter.compile(currentLocale, ast, noEval);
stringCachedFormats[message] = format;
stringCachedFormats.set(message, format);
}

@@ -231,3 +237,3 @@ }

if (currentLocale.length !== 0) {
if (!loadedLocales[currentLocale]) {
if (!loadedLocales.has(currentLocale)) {
currentLocale = "";

@@ -244,3 +250,3 @@ }

var lcLocale = locale.toLowerCase();
if (!loadedLocales[lcLocale]) {
if (!loadedLocales.has(lcLocale)) {
let pathToTranslation = cfg.pathToTranslation;

@@ -252,4 +258,10 @@ if (pathToTranslation) {

.then(() => cfg.runScriptAsync!(p!))
.then(() => {
if (!loadedLocales.has(lcLocale)) {
throw Error("Locale " + locale + " was not loaded correctly");
}
})
.catch((e) => {
console.warn(e);
failedToLoadLocales.add(locale);
if (locale != cfg.defaultLocale)

@@ -269,3 +281,3 @@ return setLocale(cfg.defaultLocale!).then(() => Promise.reject(e) as Promise<void>);

currentCachedFormat.length = currentTranslations.length;
stringCachedFormats = newMap();
stringCachedFormats = new Map();
moment.locale(currentLocale);

@@ -304,3 +316,3 @@ b.ignoreShouldChange();

if (Array.isArray(msgs)) registeredTranslations[locale] = msgs;
loadedLocales[locale] = true;
loadedLocales.add(locale);
}

@@ -307,0 +319,0 @@

{
"compilerOptions": {
"allowImportingTsExtensions": true,
"allowJs": false,

@@ -12,6 +13,8 @@ "allowSyntheticDefaultImports": true,

"lib": [
"es2019",
"es2022",
"dom"
],
"module": "commonjs",
"module": "es2022",
"moduleResolution": "bundler",
"noEmit": true,
"noEmitHelpers": true,

@@ -37,7 +40,13 @@ "noFallthroughCasesInSwitch": true,

"files": [
"index.ts",
"/Users/borisletocha/.bbcore/tools/jasmine330.d.ts"
],
"include": [
"**/*"
"**/*.spec.ts",
"**/*.spec.tsx",
"**/*.spec.d.ts",
"**/*Spec.ts",
"**/*Spec.tsx",
"**/*Spec.d.ts"
]
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc