Skip to content

Commit

Permalink
Merge branch 'hotfix/v1.12.1' into feature/add-purgeConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomasz Kostuch authored Jun 14, 2020
2 parents be60418 + 084f408 commit 21c6f9a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [1.12.0] - 2020.06.01

### Added
### Fixed

- use `config.i18n.defaultLocale` as fallback locale instead of `'en-US'` - @gibkigonzo (#4489)

### Changed / Improved

## [1.12.0] - 2020.06.01

### Added

- Add `vsf-capybara` support as a dependency and extend CLI to support customization - @psmyrek (#4209)
Expand Down
9 changes: 5 additions & 4 deletions core/i18n/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@ once('__VUE_EXTEND_I18N__', () => {
Vue.use(VueI18n)
})

const loadedLanguages = ['en-US']
const defaultLocale = config.i18n.defaultLocale || 'en-US'
const loadedLanguages = [defaultLocale]
const i18n = new VueI18n({
locale: config.i18n.bundleAllStoreviewLanguages ? config.i18n.defaultLocale : 'en-US', // set locale
fallbackLocale: 'en-US',
locale: defaultLocale, // set locale
fallbackLocale: defaultLocale,
messages: config.i18n.bundleAllStoreviewLanguages ? require('./resource/i18n/multistoreLanguages.json') : {
'en-US': require('./resource/i18n/en-US.json')
[defaultLocale]: require(`./resource/i18n/${defaultLocale}.json`)
}
})

Expand Down
4 changes: 2 additions & 2 deletions core/i18n/scripts/translation.preprocessor.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function convertToObject (array) {

module.exports = function (csvDirectories, config = null) {
const currentLocales = currentBuildLocales()
const fallbackLocale = 'en-US'
const fallbackLocale = config.i18n.defaultLocale || 'en-US'
let messages = {}
let languages = []

Expand All @@ -43,7 +43,7 @@ module.exports = function (csvDirectories, config = null) {

// create fallback
console.debug(`Writing JSON file fallback: ${fallbackLocale}.json`)
fs.writeFileSync(path.join(__dirname, '../resource/i18n', `${fallbackLocale}.json`), JSON.stringify(messages[fallbackLocale]))
fs.writeFileSync(path.join(__dirname, '../resource/i18n', `${fallbackLocale}.json`), JSON.stringify(messages[fallbackLocale] || {}))

// bundle all messages in one file
if (config && config.i18n.bundleAllStoreviewLanguages) {
Expand Down

0 comments on commit 21c6f9a

Please sign in to comment.