@bigcommerce/stencil-paper
Advanced tools
Comparing version 3.0.0-rc.25 to 3.0.0-rc.26
# Changelog | ||
## 3.0.0-rc.26 (2019-10-16) | ||
- Fix Stencil language translation in Safari[#186](https://github.com/bigcommerce/paper/pull/186) | ||
## 3.0.0-rc.25 (2019-10-15) | ||
@@ -4,0 +7,0 @@ - Bump paper-handlebars version to 4.2.3 [#183](https://github.com/bigcommerce/paper/pull/183) |
@@ -40,7 +40,14 @@ 'use strict'; | ||
return _.map(localeObjects, localeObject => { | ||
const locales = _.map(localeObjects, localeObject => { | ||
return _.isString(localeObject.region) ? `${localeObject.code}-${localeObject.region}` : localeObject.code; | ||
}); | ||
} | ||
// Safari sends only one language code, this is to have a default fallback in case we don't have that language | ||
// As an example we may not have fr-FR so add fr to the header | ||
if (locales.length === 1 && locales[0].split('-').length === 2) { | ||
locales.push(locales[0].split('-')[0]); | ||
} | ||
return locales; | ||
} | ||
/** | ||
@@ -47,0 +54,0 @@ * Normalize locale |
{ | ||
"name": "@bigcommerce/stencil-paper", | ||
"version": "3.0.0-rc.25", | ||
"version": "3.0.0-rc.26", | ||
"description": "A Stencil plugin to load template files and render pages using backend renderer plugins.", | ||
@@ -10,3 +10,3 @@ "main": "index.js", | ||
"linter": "eslint .", | ||
"test": "npm run linter && lab -v -t 94 --ignore i18n,WebAssembly,SharedArrayBuffer,Atomics,BigUint64Array,BigInt64Array,BigInt,URL,URLSearchParams spec", | ||
"test": "npm run linter && lab -v -t 94 --ignore i18n,WebAssembly,SharedArrayBuffer,Atomics,BigUint64Array,BigInt64Array,BigInt,URL,URLSearchParams,TextEncoder,TextDecoder,queueMicrotask spec", | ||
"coverage": "lab -c -r console -o stdout -r html -o coverage.html spec" | ||
@@ -13,0 +13,0 @@ }, |
@@ -65,2 +65,12 @@ 'use strict'; | ||
it('should return translated strings in default language if it cannot find a translation file for a specified language', done => { | ||
const translator = Translator.create('fr-FR', translations); | ||
expect(translator.translate('bye')).to.equal('au revoir'); | ||
expect(translator.translate('hello', { name: 'Joe' })).to.equal('Bonjour Joe'); | ||
expect(translator.translate('level1.level2')).to.equal('nous sommes dans le deuxième niveau'); | ||
done(); | ||
}); | ||
it('should return translated strings in English if cannot locate the preferred translation file', done => { | ||
@@ -67,0 +77,0 @@ const translator = Translator.create('es', translations); |
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
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
63428
22
895