question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

cant read messages from .js files

See original GitHub issue

i make en-Us.js file in lang folder and put this code export default { "welcome" : "sdfs", account_description: 'Account description', } but not loaded. i found problem there `/**

  • Asynchronously load messages from translation files
  • @param {VueI18n} i18n vue-i18n instance
  • @param {String} lang Language code to load
  • @return {Promise} / export function loadLanguageAsync (i18n, lang) { if (!i18n.loadedLanguages) { i18n.loadedLanguages = [] } if (!i18n.loadedLanguages.includes(lang)) { const langOptions = i18n.locales.find(l => l.code === lang) if (langOptions) { const { langFile } = langOptions; return import(/ webpackChunkName: “lang-[request]” */ ‘~/<%= options.langDir %>’+langFile) .then(msgs => { i18n.setLocaleMessage(lang, msgs) i18n.loadedLanguages.push(lang) return }) } } return Promise.resolve() }`

in line i18n.setLocaleMessage(lang, msgs)

to

i18n.setLocaleMessage(lang, msgs.default)

its true?

<div align="right">This question is available on Nuxt.js community (#c34)</div>

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:9 (1 by maintainers)

github_iconTop GitHub Comments

12reactions
manniLcommented, Apr 18, 2018

@amazzoccone Location files can be js files as well! They need the correct export though (Example)

1reaction
rchlcommented, May 9, 2019

This should be fixed in current version as it takes into account possible export.default property: https://github.com/nuxt-community/nuxt-i18n/blob/a6172ec0b2387c24424d50189fee015e20232a95/src/templates/utils.js#L23-L25

Read more comments on GitHub >

github_iconTop Results From Across the Web

cant read messages from .js files · Issue #54 · nuxt-modules/i18n
i make en-Us.js file in lang folder and put this code export default { "welcome" : "sdfs", ... cant read messages from .js...
Read more >
'Cannot GET /messages/' in node.js - Stack Overflow
Try to change the the order. First declare the /message route, and after that declare the static files. You want to first use...
Read more >
What went wrong? Troubleshooting JavaScript - MDN Web Docs
Go to the tab that you've got number-game-errors.html open in, and open your JavaScript console. You should see an error message along the ......
Read more >
(DISCORD BOT) typeerror: cannot read properties of ...
Node.js. Hey all, I'm coding a discord bot and I've coded a ... Cannot read properties of undefined (reading 'messages') at file:///C:/Users ...
Read more >
Chapter 1, Writing Your First JavaScript Program - O'Reilly
When adding the src attribute to link to an external JavaScript file, don't add any JavaScript code between the opening and closing <script>...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found