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.

No locale files loaded for `react-i18next` using TS/Yaml

See original GitHub issue

Describe the bug I have a workspace that contains 2 framework i18n’s. Rails and React-I18Next. i18n-ally automatically scan the workspace and properly find both frameworks and their localization folder paths. But only Rails is works. Even react-i18next is identified byyour extension, its not parsed. If I manually disable rails, react is not parsed.

Error:

No locale files loaded. Probably there is something wrong with your project config.

Extension Version 2.0.9

Framework/i18n package you are using react-i18next

To Reproduce Steps to reproduce the behavior:

  1. Open workspace
  2. You will get No locale files loaded. Probably there is something wrong with your project config.
  3. See error

Device Infomation

  • OS: Ubuntu
  • Version: 20.04 LTS
  • VS Code Version: 1.44.2

Extension Log

🈶 Activated, v2.0.9

――――――

💼 Workspace root changed to "/home/gencer/sources/nienbo/gitsby"
📦 Packages file "package.json" found
🕳 Packages file "pubspec.yaml" not exists
🕳 Packages file "composer.json" not exists
📦 Packages file "Gemfile" found
🌞 Enabled
🧩 Enabled frameworks: React
🧬 Enabled parsers: yaml, js, ts

🚀 Initializing loader "/home/gencer/sources/nienbo/gitsby"
📂 Directory structure: file
🗃 Path Matcher Regex: /^(?<locale>[\w-_]+)\.(?<ext>ya?ml|m?js|ts)$/

📂 Loading locales under /home/gencer/sources/nienbo/gitsby/app/javascript/components/locales

👀 Watching change on /home/gencer/sources/nienbo/gitsby/app/javascript/components/locales
✅ Loading finished

――――――

Screenshots

This is how my locale structure for react-i18next is look like:

image

Instead of en.yml or cn.yml, I use folders like en/translations.yml or cn/translations.yml. Could this be the problem?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:15 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
antfucommented, Apr 30, 2020

Hi @gencer, current I think the rails support won’t work with others. I understand your request and #218. To do this requires an overhaul of this project and sorry I couldn’t be able to make it in v2.0. But before I doing the implementation, maybe we can figure out what we are asking for first.

First, I am wondering why would you need to use the same frameworks at the same time? I assume you are using different locales and i18n solutions for frontend and backend. If so, even if this feature got supported, the locales from different sources will be mixed up. Which I think is not something you would expect to see either.

Another solution is to open your frontend project and backend project separately. In this case, you can have different settings for each project and they will never be messed up. Also, something to be mentioned is that VS Code has a “workspace” feature which allows you to open several projects in a single VS Code instance. It’s supported by i18n Ally from some very early releases.

Please get it try and hope that would solve your issues. Thanks!

1reaction
Andariuscommented, May 31, 2020

I had

  "i18n-ally.localesPaths": [
        "i18n",
        "i18n/locales"
    ],

which were auto setup I guess, removing i18n fixed the issue

Read more comments on GitHub >

github_iconTop Results From Across the Web

No locale files loaded for react-i18next using TS/Yaml #277
Steps to reproduce the behavior: Open workspace; You will get No locale files loaded. Probably there is something wrong with your project config...
Read more >
Step by step guide (v9) - react-i18next documentation
Lets assume your project started to grow and you like to split translations into multiple files. Without configuration i18next will always load one...
Read more >
A Guide to React Localization with i18next | Phrase
Learn how to use it to internationalize your React apps. ... i18next provides a mechanism for this lazy loading of translation files via...
Read more >
React-native i18next make use yaml files - Stack Overflow
I have used i18n for multiple language select. In assets/lang/en.json,.../hi.json,.../ma.json,.../te.json Based on user selection u need to ...
Read more >
React-i18next: Internationalization and translation ... - Lokalise
Learn how to use the i18next library for internationalization with ... separate translations into multiple files and to load them on demand.
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