nuxt-i18n: 6.13.6
nuxt: 2.14.1
[
'nuxt-i18n', {
strategy: 'prefix_except_default',
locales: [
{
code: 'ru',
file: 'ru/index.js',
name: 'RU',
iso: 'ru-RU'
},
{
code: 'en',
file: 'en/index.js',
iso: 'en-US',
name: 'EN'
}
],
defaultLocale: 'en',
vueI18n: {
fallbackLocale: 'en'
},
lazy: true,
langDir: 'locales/',
vuex: {
moduleName: 'i18n'
}
}]
0) Create locales/en/index.js
1) Create locales/en/actions.js like this:
export default {
add: 'Add item',
reset: 'Reset form',
save: 'Save',
create: 'Create item',
saveDraft: 'Save draft',
}
2) Import module from actions.js to index.js
3) Export from locales/en/index.js like this
import actions from './actions'
export default () => {
return new Promise(function (resolve) {
resolve({
actions
})
})
}
It should work as before
These relative modules were not found: friendly-errors 18:10:35 friendly-errors 18:10:35
* ./actions in ./.nuxt/nuxt-i18n/default-lang/en/index.js
Same here, but I use and import json.
Hmm... that one is tricky.
Previously everything from langDir (including imported stuff) would end up in their own bundles. So I think that was not ideal.
The new approach requires that we copy individual files so that we can separate the file for default locale and other locales so that we can include default locale in the main bundle.
@thefoxie You can point locale's file to JSON file directly (unless you are doing something more than just importing that one file).
Fix released in v6.13.7
Great. v6.13.7 fixes this issue for me.
Most helpful comment
Fix released in v6.13.7