Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bobril-g11n

Package Overview
Dependencies
Maintainers
1
Versions
50
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 3.3.4 to 4.0.0

src/numberFormatter.d.ts

5

CHANGELOG.md
CHANGELOG
===
4.0.0
--
Global moment has set current locale. So you are free to use it, but even better is just use getMoment.
3.3.4

@@ -5,0 +10,0 @@ --

1

index.d.ts

@@ -1,2 +0,1 @@

/// <reference path="typings/moment/moment-node.d.ts" />
export * from './src/msgFormatParser';

@@ -3,0 +2,0 @@ export * from './src/msgFormatter';

@@ -6,3 +6,2 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
/// <reference path="./typings/moment/moment-node.d.ts" />
__export(require("./src/msgFormatParser"));

@@ -9,0 +8,0 @@ __export(require("./src/msgFormatter"));

{
"name": "bobril-g11n",
"version": "3.3.4",
"version": "4.0.0",
"description": "Bobril globalization",

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

@@ -1,3 +0,8 @@

export declare function setPluralRule(locale: string, pluralFn: (val: number, ordinal: boolean) => string): void;
export interface ILocaleRules {
pluralFn: (val: number, ordinal: boolean) => string;
td: string;
dd: string;
}
export declare function setRules(locale: string, params: any[]): void;
export declare function getLanguageFromLocale(locale: string): string;
export declare function getPluralRule(locale: string): (val: number, ordinal: boolean) => string;
export declare function getRules(locale: string): ILocaleRules;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var moment = require("moment");
var RuntimeFunctionGenerator_1 = require("./RuntimeFunctionGenerator");
var localeDataStorage = require("./localeDataStorage");
var numberFormatter = require("./numberFormatter");
var moment = require('moment');
window.moment = moment;

@@ -8,0 +8,0 @@ var numberFormatterCache = Object.create(null);

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var RuntimeFunctionGenerator = (function () {
var RuntimeFunctionGenerator = /** @class */ (function () {
function RuntimeFunctionGenerator() {

@@ -5,0 +5,0 @@ this.constants = [];

@@ -0,1 +1,2 @@

import * as moment from 'moment';
export interface IG11NConfig {

@@ -5,9 +6,13 @@ defaultLocale?: string;

}
export declare let registeredTranslations: {
[name: string]: string[];
};
export declare function t(message: string | number, params?: Object, _translationHelp?: string): string;
export declare function f(message: string, params: Object): string;
export declare function initGlobalization(config?: IG11NConfig): Promise<void>;
export declare function setLocale(locale: string): Promise<any>;
export declare function setLocale(locale: string): Promise<void>;
export declare function getLocale(): string;
export declare function getMoment(init?: any, init2?: any, init3?: any): moment.Moment;
export declare const getMoment: typeof moment;
export declare function unformatNumber(str: string): number;
export declare function registerTranslations(locale: string, localeDefs: any[], msgs: string[]): void;
export declare function spyTranslation(spyFn?: ((text: string) => string) | null): ((text: string) => string) | undefined;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/// <reference path="../typings/moment/moment-node.d.ts" />
var moment = require("moment");
var msgFormatParser = require("./msgFormatParser");

@@ -18,3 +18,3 @@ var msgFormatter = require("./msgFormatter");

var loadedLocales = newMap();
var registeredTranslations = newMap();
exports.registeredTranslations = newMap();
var initWasStarted = false;

@@ -27,3 +27,2 @@ var currentLocale = '';

var stringCachedFormats = newMap();
var momentInstance;
if (window.g11nPath) {

@@ -127,3 +126,3 @@ cfg.pathToTranslation = window.g11nPath;

currentRules = localeDataStorage.getRules(locale);
currentTranslations = registeredTranslations[locale] || [];
currentTranslations = exports.registeredTranslations[locale] || [];
currentUnformatter = undefined;

@@ -133,3 +132,3 @@ currentCachedFormat = [];

stringCachedFormats = newMap();
momentInstance = window.moment().locale(currentLocale);
moment.locale(currentLocale);
b.ignoreShouldChange();

@@ -144,9 +143,3 @@ });

exports.getLocale = getLocale;
function getMoment(init, init2, init3) {
if (init !== undefined) {
return window.moment(init, init2, init3).locale(currentLocale);
}
return momentInstance.clone();
}
exports.getMoment = getMoment;
exports.getMoment = moment;
function unformatNumber(str) {

@@ -164,3 +157,3 @@ if (currentUnformatter === undefined) {

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

@@ -167,0 +160,0 @@ }

@@ -34,3 +34,3 @@ import * as moment from 'moment';

let loadedLocales: { [name: string]: boolean } = newMap();
let registeredTranslations: { [name: string]: string[] } = newMap();
export let registeredTranslations: { [name: string]: string[] } = newMap();
let initWasStarted = false;

@@ -43,3 +43,2 @@ let currentLocale = '';

let stringCachedFormats: { [input: string]: IMessageFormat } = newMap();
let momentInstance: moment.Moment;

@@ -153,3 +152,3 @@ if ((<any>window).g11nPath) {

stringCachedFormats = newMap();
momentInstance = (<any>window).moment().locale(currentLocale);
moment.locale(currentLocale);
b.ignoreShouldChange();

@@ -164,8 +163,3 @@ });

export function getMoment(init?: any, init2?: any, init3?: any): moment.Moment {
if (init !== undefined) {
return (<any>window).moment(init, init2, init3).locale(currentLocale);
}
return momentInstance.clone();
}
export const getMoment = moment;

@@ -172,0 +166,0 @@ export function unformatNumber(str: string): number {

@@ -11,3 +11,5 @@ {

"es2015.core",
"es2015.promise"
"es2015.promise",
"es2015.iterable",
"es2015.collection"
],

@@ -24,3 +26,4 @@ "removeComments": false,

"noFallthroughCasesInSwitch": true,
"strictNullChecks": true
"strictNullChecks": true,
"types": []
},

@@ -27,0 +30,0 @@ "include": [

Sorry, the diff of this file is not supported yet

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