@phensley/cldr-core
Advanced tools
Comparing version 0.2.17 to 0.3.0
@@ -1,9 +0,10 @@ | ||
export * from './engine'; | ||
export * from './api'; | ||
export * from './common'; | ||
export * from './exports'; | ||
export * from './internals'; | ||
export * from './locale'; | ||
export * from './resource'; | ||
export * from './types'; | ||
export { buildSchema } from './schema'; | ||
export { Pack } from './resource/pack'; | ||
export { LRU } from './utils/lru'; | ||
export { AvailableFormatType, CurrencyType, DateFieldType, FieldWidthType, FormatWidthType, RelativeTimeWidthType, UnitType } from '@phensley/cldr-schema'; | ||
import * as encoding from './resource/encoding'; | ||
export { encoding }; |
@@ -7,9 +7,8 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__export(require("./engine")); | ||
__export(require("./api")); | ||
__export(require("./common")); | ||
__export(require("./internals")); | ||
__export(require("./locale")); | ||
__export(require("./resource")); | ||
__export(require("./types")); | ||
var schema_1 = require("./schema"); | ||
exports.buildSchema = schema_1.buildSchema; | ||
var pack_1 = require("./resource/pack"); | ||
exports.Pack = pack_1.Pack; | ||
var lru_1 = require("./utils/lru"); | ||
@@ -16,0 +15,0 @@ exports.LRU = lru_1.LRU; |
import { LanguageTag } from './languagetag'; | ||
/** | ||
* Methods for substituting language and region aliases, adding likely subtags, etc. | ||
* | ||
* @alpha | ||
*/ | ||
@@ -5,0 +7,0 @@ export declare class LanguageResolver { |
@@ -190,2 +190,4 @@ "use strict"; | ||
* Methods for substituting language and region aliases, adding likely subtags, etc. | ||
* | ||
* @alpha | ||
*/ | ||
@@ -192,0 +194,0 @@ var LanguageResolver = /** @class */ (function () { |
@@ -1,49 +0,4 @@ | ||
import { Bundle } from '@phensley/cldr-schema'; | ||
import { LanguageTag } from '../locale'; | ||
export declare type ExceptionIndex = { | ||
[y: number]: number; | ||
}; | ||
export interface ResourceBundle extends Bundle { | ||
calendarSystem(): string; | ||
numberSystem(): string; | ||
languageScript(): string; | ||
languageRegion(): string; | ||
} | ||
export declare class StringBundle implements Bundle { | ||
readonly id: string; | ||
readonly tag: LanguageTag; | ||
readonly strings: string[]; | ||
readonly exceptions: string[]; | ||
readonly index: ExceptionIndex | undefined; | ||
private _calendarSystem; | ||
private _numberSystem; | ||
private _languageRegion; | ||
private _languageScript; | ||
constructor(id: string, tag: LanguageTag, strings: string[], exceptions: string[], index?: ExceptionIndex | undefined); | ||
bundleId(): string; | ||
language(): string; | ||
region(): string; | ||
languageScript(): string; | ||
languageRegion(): string; | ||
calendarSystem(): string; | ||
numberSystem(): string; | ||
get(offset: number): string; | ||
} | ||
import { Bundle, ExceptionIndex } from './bundle'; | ||
/** | ||
* Bundle that gets returned when a lookup fails. | ||
* | ||
* TODO: once public api is hammered out this may be unnecessary as | ||
* we may throw an error. | ||
*/ | ||
export declare class DummyBundle implements ResourceBundle { | ||
bundleId(): string; | ||
language(): string; | ||
region(): string; | ||
languageScript(): string; | ||
languageRegion(): string; | ||
calendarSystem(): string; | ||
numberSystem(): string; | ||
get(offset: number): string; | ||
} | ||
/** | ||
* Layer in the pack that supports all regions for a single language + script. | ||
@@ -63,3 +18,3 @@ */ | ||
}); | ||
get(tag: LanguageTag): ResourceBundle; | ||
get(tag: LanguageTag): Bundle; | ||
private decode(region); | ||
@@ -80,3 +35,3 @@ } | ||
constructor(data: any); | ||
get(tag: LanguageTag): ResourceBundle; | ||
get(tag: LanguageTag): Bundle; | ||
} |
@@ -5,103 +5,6 @@ "use strict"; | ||
var locale_1 = require("../locale"); | ||
var bundle_1 = require("./bundle"); | ||
var DELIMITER = '\t'; | ||
var StringBundle = /** @class */ (function () { | ||
function StringBundle(id, tag, strings, exceptions, index) { | ||
this.id = id; | ||
this.tag = tag; | ||
this.strings = strings; | ||
this.exceptions = exceptions; | ||
this.index = index; | ||
// Properties for fast internal lookups into maps. | ||
// For example, extended day periods cover all of 'es' except for 'es-CO'. | ||
// Pre-computing these to avoid string creation for lookups at runtime. | ||
this._calendarSystem = 'gregory'; | ||
this._numberSystem = 'default'; | ||
var language = tag.language(); | ||
this._languageRegion = language + "-" + tag.region(); | ||
this._languageScript = language + "-" + tag.script(); | ||
// When bundle is constructed, see if there are unicode extensions for | ||
// number and calendar systems. | ||
for (var _i = 0, _a = tag.extensionSubtags('u'); _i < _a.length; _i++) { | ||
var subtag = _a[_i]; | ||
if (subtag.startsWith('nu-')) { | ||
this._numberSystem = subtag.substring(3); | ||
} | ||
else if (subtag.startsWith('co-')) { | ||
this._calendarSystem = subtag.substring(3); | ||
} | ||
} | ||
} | ||
StringBundle.prototype.bundleId = function () { | ||
return this.id; | ||
}; | ||
StringBundle.prototype.language = function () { | ||
return this.tag.language(); | ||
}; | ||
StringBundle.prototype.region = function () { | ||
return this.tag.region(); | ||
}; | ||
StringBundle.prototype.languageScript = function () { | ||
return this._languageScript; | ||
}; | ||
StringBundle.prototype.languageRegion = function () { | ||
return this._languageRegion; | ||
}; | ||
StringBundle.prototype.calendarSystem = function () { | ||
return this._calendarSystem; | ||
}; | ||
StringBundle.prototype.numberSystem = function () { | ||
return this._numberSystem; | ||
}; | ||
StringBundle.prototype.get = function (offset) { | ||
// If there is an exception index, attempt to resolve it. | ||
if (this.index !== undefined) { | ||
var i = this.index[offset]; | ||
if (i !== undefined) { | ||
return this.exceptions[i] || ''; | ||
} | ||
} | ||
// Return the actual string. | ||
return this.strings[offset] || ''; | ||
}; | ||
return StringBundle; | ||
}()); | ||
exports.StringBundle = StringBundle; | ||
var DUMMY_BUNDLE = new bundle_1.DummyBundle(); | ||
/** | ||
* Bundle that gets returned when a lookup fails. | ||
* | ||
* TODO: once public api is hammered out this may be unnecessary as | ||
* we may throw an error. | ||
*/ | ||
var DummyBundle = /** @class */ (function () { | ||
function DummyBundle() { | ||
} | ||
DummyBundle.prototype.bundleId = function () { | ||
return 'und'; | ||
}; | ||
DummyBundle.prototype.language = function () { | ||
return 'und'; | ||
}; | ||
DummyBundle.prototype.region = function () { | ||
return 'ZZ'; | ||
}; | ||
DummyBundle.prototype.languageScript = function () { | ||
return 'und-Zzzz'; | ||
}; | ||
DummyBundle.prototype.languageRegion = function () { | ||
return 'und-ZZ'; | ||
}; | ||
DummyBundle.prototype.calendarSystem = function () { | ||
return 'gregory'; | ||
}; | ||
DummyBundle.prototype.numberSystem = function () { | ||
return 'default'; | ||
}; | ||
DummyBundle.prototype.get = function (offset) { | ||
return ''; | ||
}; | ||
return DummyBundle; | ||
}()); | ||
exports.DummyBundle = DummyBundle; | ||
var DUMMY_BUNDLE = new DummyBundle(); | ||
/** | ||
* Layer in the pack that supports all regions for a single language + script. | ||
@@ -121,3 +24,3 @@ */ | ||
DUMMY_BUNDLE : | ||
new StringBundle(tag.compact(), tag, this._strings, this._exceptions, index); | ||
new bundle_1.StringBundle(tag.compact(), tag, this._strings, this._exceptions, index); | ||
}; | ||
@@ -124,0 +27,0 @@ PackScript.prototype.decode = function (region) { |
@@ -13,2 +13,5 @@ export declare const enum RoundingMode { | ||
export declare type RoundingModeType = 'up' | 'down' | 'ceiling' | 'floor' | 'half-up' | 'half-down' | 'half-even' | '05up' | 'truncate'; | ||
/** | ||
* @alpha | ||
*/ | ||
export interface MathContext { | ||
@@ -15,0 +18,0 @@ scale?: number; |
{ | ||
"name": "@phensley/cldr-core", | ||
"version": "0.2.17", | ||
"version": "0.3.0", | ||
"description": "Core library for @phensley/cldr", | ||
@@ -30,3 +30,3 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"@phensley/cldr-schema": "^0.2.17" | ||
"@phensley/cldr-schema": "^0.3.0" | ||
}, | ||
@@ -33,0 +33,0 @@ "devDependencies": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
779430
278
9328
+ Added@phensley/cldr-schema@0.3.10(transitive)
- Removed@phensley/cldr-schema@0.2.17(transitive)
Updated@phensley/cldr-schema@^0.3.0