@jupyterlab/translation
Advanced tools
Comparing version 3.0.0-alpha.8 to 3.0.0-alpha.9
@@ -1,12 +0,17 @@ | ||
import { ITranslator } from './tokens'; | ||
import { ITranslator, TranslationBundle } from './tokens'; | ||
/** | ||
* The basic translator interface. | ||
* | ||
* This translator just returns the input string plus any interpolation if needed. | ||
* A translator that loads a dummy language bundle that returns the same input | ||
* strings. | ||
*/ | ||
export declare namespace DefaultTranslator { | ||
/** | ||
* Get the basix translator instance. | ||
*/ | ||
function getInstance(): ITranslator; | ||
declare class NullTranslator implements ITranslator { | ||
constructor(bundle: TranslationBundle); | ||
load(domain: string): TranslationBundle; | ||
locale(): string; | ||
private _languageBundle; | ||
} | ||
/** | ||
* The application null translator instance that just returns the same text. | ||
* Also provides interpolation. | ||
*/ | ||
export declare const nullTranslator: NullTranslator; | ||
export {}; |
@@ -8,3 +8,3 @@ // Copyright (c) Jupyter Development Team. | ||
*/ | ||
class EmptyTranslator { | ||
class NullTranslator { | ||
constructor(bundle) { | ||
@@ -17,3 +17,3 @@ this._languageBundle = bundle; | ||
locale() { | ||
return 'en-us'; | ||
return 'en'; | ||
} | ||
@@ -24,3 +24,3 @@ } | ||
*/ | ||
class EmptyLanguageBundle { | ||
class NullLanguageBundle { | ||
__(msgid, ...args) { | ||
@@ -55,27 +55,6 @@ return this.gettext(msgid, ...args); | ||
/** | ||
* The basic translator interface. | ||
* | ||
* This translator just returns the input string plus any interpolation if needed. | ||
* The application null translator instance that just returns the same text. | ||
* Also provides interpolation. | ||
*/ | ||
export var DefaultTranslator; | ||
(function (DefaultTranslator) { | ||
/** | ||
* Get the basix translator instance. | ||
*/ | ||
function getInstance() { | ||
return Private.instance; | ||
} | ||
DefaultTranslator.getInstance = getInstance; | ||
})(DefaultTranslator || (DefaultTranslator = {})); | ||
/** | ||
* The namespace for module private data. | ||
*/ | ||
var Private; | ||
(function (Private) { | ||
/** | ||
* The application base translator instance that just returns the same text. | ||
* Also provides interpolation. | ||
*/ | ||
Private.instance = new EmptyTranslator(new EmptyLanguageBundle()); | ||
})(Private || (Private = {})); | ||
export const nullTranslator = new NullTranslator(new NullLanguageBundle()); | ||
//# sourceMappingURL=base.js.map |
@@ -386,9 +386,9 @@ /* ---------------------------------------------------------------------------- | ||
} | ||
else if (!this._pluralFuncs[options.locale]) { | ||
this._pluralFuncs[options.locale] = this.getPluralFunc(this._pluralForms[options.locale]); | ||
plural = this._pluralFuncs[options.locale](n); | ||
else if (!this._pluralFuncs[options.locale || '']) { | ||
this._pluralFuncs[options.locale || ''] = this.getPluralFunc(this._pluralForms[options.locale || '']); | ||
plural = this._pluralFuncs[options.locale || ''](n); | ||
// we have the plural function, compute the plural result | ||
} | ||
else { | ||
plural = this._pluralFuncs[options.locale](n); | ||
plural = this._pluralFuncs[options.locale || ''](n); | ||
} | ||
@@ -395,0 +395,0 @@ // If there is a problem with plurals, fallback to singular one |
@@ -31,5 +31,4 @@ import { DataConnector, IDataConnector } from '@jupyterlab/statedb'; | ||
load(domain: string): TranslationBundle; | ||
locale(): string; | ||
} | ||
export declare const ITranslator: Token<ITranslator>; | ||
export {}; |
{ | ||
"name": "@jupyterlab/translation", | ||
"version": "3.0.0-alpha.8", | ||
"version": "3.0.0-alpha.9", | ||
"description": "JupyterLab - Translation services", | ||
@@ -49,9 +49,9 @@ "keywords": [ | ||
"dependencies": { | ||
"@jupyterlab/coreutils": "^5.0.0-alpha.8", | ||
"@jupyterlab/services": "^6.0.0-alpha.8", | ||
"@jupyterlab/statedb": "^3.0.0-alpha.8", | ||
"@jupyterlab/coreutils": "^5.0.0-alpha.9", | ||
"@jupyterlab/services": "^6.0.0-alpha.9", | ||
"@jupyterlab/statedb": "^3.0.0-alpha.9", | ||
"@lumino/coreutils": "^1.4.3" | ||
}, | ||
"devDependencies": { | ||
"@jupyterlab/testutils": "^3.0.0-alpha.8", | ||
"@jupyterlab/testutils": "^3.0.0-alpha.9", | ||
"@types/jest": "^24.0.23", | ||
@@ -71,3 +71,3 @@ "@typescript-eslint/eslint-plugin": "^2.25.0", | ||
}, | ||
"gitHead": "b776c754eb1f57ac9e56dd9bce84b6300b661155" | ||
"gitHead": "e69d0c6f9b2c81df177f5d853c89921b6708fac5" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
47511
899
1