intlify / vue-cli-plugin-i18n

:globe_with_meridians: Vue CLI plugin to add vue-i18n to your Vue Project

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fix initialization on ui

orblazer opened this issue · comments

Hello,
When we load UI i don't have locales.

I have investigate on this error and this is because the currentProject and currentConfig.
This is caused because when start vue ui the plugin is not reloaded.

And now i have fix that with write next code in onProjectOpen

const rawConfig = require(`${project.path}/vue.config`)
const config = (rawConfig.pluginOptions && rawConfig.pluginOptions.i18n)
  ? rawConfig.pluginOptions.i18n
  : { localeDir: 'locales' }
if (!config.localeDir) { config.localeDir = 'locales' }
debug('onProjectOpen : load vue.config', config)
setupAddon(project.path, config)
currentProject = project
currentConfig = config

Thanks.