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

@computerrock/formation-i18n

Package Overview
Dependencies
Maintainers
12
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@computerrock/formation-i18n - npm Package Compare versions

Comparing version 0.3.3 to 0.4.0

4

package.json
{
"name": "@computerrock/formation-i18n",
"version": "0.3.3",
"version": "0.4.0",
"description": "Formation framework - i18n layer",

@@ -34,3 +34,3 @@ "license": "MIT",

},
"gitHead": "e1228ddfecfb4b9cb06a68d62bea0dcff5e84781"
"gitHead": "86434675736b86b3ffb6a524c8888c2ee04fd809"
}

@@ -20,2 +20,3 @@ import handleResponse from './handleResponse';

let activeLocaleSet = {};
let availableLocaleSets = {};
let availableLocales = [];

@@ -78,2 +79,3 @@

activeLocaleSet = allLocaleSets[activeLocale];
availableLocaleSets = allLocaleSets;
availableLocales = Object.keys(allLocaleSets).map(key => ({

@@ -109,6 +111,9 @@ locale: key,

const translate = (key = 'key', params = {}) => {
if (typeof activeLocaleSet[key] === 'undefined') return key;
const translate = (key = 'key', params = {}, locale) => {
const localeSet = typeof locale !== 'string' ? activeLocaleSet
: (typeof availableLocaleSets[locale] !== 'undefined' ? availableLocaleSets[locale] : {});
let translation = activeLocaleSet[key];
if (typeof localeSet[key] === 'undefined') return key;
let translation = localeSet[key];
Object.keys(params).forEach(key => {

@@ -121,4 +126,4 @@ translation = translation.replace(new RegExp(`{${key}}`, 'g'), params[key]);

const createTranslateShorthand = (keyRoot = 'key_root') => {
return (shorthandKey = 'shorthand_key', params) => translate(`${keyRoot}.${shorthandKey}`, params);
const createTranslateShorthand = (keyRoot = 'key_root') => (shorthandKey = 'shorthand_key', params, locale) => {
return translate(`${keyRoot}.${shorthandKey}`, params, locale);
};

@@ -125,0 +130,0 @@

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