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

@boost/translate

Package Overview
Dependencies
Maintainers
1
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@boost/translate - npm Package Compare versions

Comparing version 2.2.7 to 2.2.8

6

dts/createTranslator.d.ts

@@ -18,3 +18,7 @@ import { InitOptions } from 'i18next';

}
export declare function createTranslator(namespace: string[] | string, resourcePath: PortablePath | PortablePath[], { autoDetect, debug: debugOpt, fallbackLocale, locale, lookupType, resourceFormat, }?: TranslatorOptions): Translator;
/**
* Create and return a `Translator` instance with the defined namespace.
* A list of resource paths are required for locating translation files.
*/
export declare function createTranslator(namespace: string[] | string, resourcePath: PortablePath | PortablePath[], options?: TranslatorOptions): Translator;
//# sourceMappingURL=createTranslator.d.ts.map

2

dts/FileBackend.d.ts

@@ -12,3 +12,3 @@ import { BackendModule, Resource, ResourceKey } from 'i18next';

init(services: unknown, options: Partial<FileBackendOptions>): void;
blueprint({ array, instance, string }: Predicates): Blueprint<FileBackendOptions>;
blueprint(predicates: Predicates): Blueprint<FileBackendOptions>;
create(): void;

@@ -15,0 +15,0 @@ read(locale: Locale, namespace: string, handler: (error: Error | null, resources: Resource) => void): ResourceKey;

@@ -25,4 +25,5 @@ import { i18n, InterpolationOptions } from 'i18next';

changeLocale: (locale: Locale) => Promise<void>;
/** @internal */
i18n: i18n;
}
//# sourceMappingURL=types.d.ts.map

@@ -47,11 +47,20 @@ 'use strict';

}
/**
* Create and return a `Translator` instance with the defined namespace.
* A list of resource paths are required for locating translation files.
*/
function createTranslator(namespace, resourcePath, {
autoDetect = true,
debug: debugOpt = false,
fallbackLocale = 'en',
locale,
lookupType = 'all',
resourceFormat = 'yaml'
} = {}) {
function createTranslator(namespace, resourcePath, options = {}) {
const _options$autoDetect = options.autoDetect,
autoDetect = _options$autoDetect === void 0 ? true : _options$autoDetect,
_options$debug = options.debug,
debugOpt = _options$debug === void 0 ? false : _options$debug,
_options$fallbackLoca = options.fallbackLocale,
fallbackLocale = _options$fallbackLoca === void 0 ? 'en' : _options$fallbackLoca,
locale = options.locale,
_options$lookupType = options.lookupType,
lookupType = _options$lookupType === void 0 ? 'all' : _options$lookupType,
_options$resourceForm = options.resourceFormat,
resourceFormat = _options$resourceForm === void 0 ? 'yaml' : _options$resourceForm;
const namespaces = common.toArray(namespace);

@@ -96,3 +105,3 @@ const resourcePaths = common.toArray(resourcePath).map(common.Path.create);

lng = _ref.locale,
options = _objectWithoutProperties(_ref, _excluded);
opts = _objectWithoutProperties(_ref, _excluded);

@@ -103,3 +112,3 @@ return translator.t(key, _objectSpread(_objectSpread({

}, interpolation)
}, options), {}, {
}, opts), {}, {
lng,

@@ -106,0 +115,0 @@ replace: params

@@ -34,7 +34,6 @@ 'use strict';

blueprint({
array,
instance,
string
}) {
blueprint(predicates) {
const array = predicates.array,
instance = predicates.instance,
string = predicates.string;
return {

@@ -41,0 +40,0 @@ format: string('yaml').oneOf(['js', 'json', 'yaml']),

{
"name": "@boost/translate",
"version": "2.2.7",
"version": "2.2.8",
"release": "1594765247526",

@@ -36,3 +36,3 @@ "description": "Package and application level translations made easy.",

"dependencies": {
"@boost/common": "^2.8.1",
"@boost/common": "^2.8.2",
"@boost/internal": "^2.2.3",

@@ -51,3 +51,3 @@ "i18next": "^20.3.2",

},
"gitHead": "ea3128b3fbb716e606b528c42478fcf1434f5c2b"
"gitHead": "a44772937c04f8f818884444faee5c2a9f44b5ac"
}
# Translate - Boost
[![Build Status](https://github.com/milesj/boost/workflows/Build/badge.svg)](https://github.com/milesj/boost/actions?query=branch%3Amaster)
[![npm version](https://badge.fury.io/js/%40boost%translate.svg)](https://www.npmjs.com/package/@boost/translate)
[![npm version](https://badge.fury.io/js/%40boost%2Ftranslate.svg)](https://www.npmjs.com/package/@boost/translate)
[![npm deps](https://david-dm.org/milesj/boost.svg?path=packages/translate)](https://www.npmjs.com/package/@boost/translate)

@@ -36,2 +36,3 @@

[https://boostlib.dev/docs/translate](https://boostlib.dev/docs/translate)
- [https://boostlib.dev/docs/translate](https://boostlib.dev/docs/translate)
- [https://boostlib.dev/api/translate](https://boostlib.dev/api/translate)

@@ -33,6 +33,12 @@ /* eslint-disable @typescript-eslint/no-floating-promises */

/**
* Create and return a `Translator` instance with the defined namespace.
* A list of resource paths are required for locating translation files.
*/
export function createTranslator(
namespace: string[] | string,
resourcePath: PortablePath | PortablePath[],
{
options: TranslatorOptions = {},
): Translator {
const {
autoDetect = true,

@@ -44,4 +50,3 @@ debug: debugOpt = false,

resourceFormat = 'yaml',
}: TranslatorOptions = {},
): Translator {
} = options;
const namespaces = toArray(namespace);

@@ -90,7 +95,7 @@ const resourcePaths = toArray(resourcePath).map(Path.create);

params?: InterpolationParams,
{ interpolation, locale: lng, ...options }: MessageOptions = {},
{ interpolation, locale: lng, ...opts }: MessageOptions = {},
): string {
return translator.t(key, {
interpolation: { escapeValue: false, ...interpolation },
...options,
...opts,
lng,

@@ -97,0 +102,0 @@ replace: params,

@@ -33,3 +33,5 @@ import { BackendModule, Resource, ResourceKey } from 'i18next';

blueprint({ array, instance, string }: Predicates): Blueprint<FileBackendOptions> {
blueprint(predicates: Predicates): Blueprint<FileBackendOptions> {
const { array, instance, string } = predicates;
return {

@@ -36,0 +38,0 @@ format: string('yaml').oneOf<Format>(['js', 'json', 'yaml']),

@@ -31,4 +31,4 @@ import { i18n, InterpolationOptions } from 'i18next';

changeLocale: (locale: Locale) => Promise<void>;
// Testing only
/** @internal */
i18n: i18n;
}

Sorry, the diff of this file is not supported yet

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