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.

Please support language source file type of js

See original GitHub issue

Is your feature related to a specific framework or general for this extension

i18next

Is your feature request related to a problem? Please describe.

I use i18next and use js file as language source file not json.

The directory structure is below.

**/foo/bar/
├── locales
    ├── foo.en.js
    ├── foo.ja.js
  • By the way, I can’t show all overview because it is private source.

The content of souce file named foo.{locale}.js like below.

const locales = {
  title: {
    content: "foo"
  },
  body: {
    hoo: "bar"
  },
.
.
.
(ommited)
.
.
.
};

export default locales;

So, the content of tsx file like below.

...(ommited)...
return (
  { i18next.t('title.content') }
  { i18next.t('body.hoo') }
);
...

Finally, { i18next.t('title.content') } supposed to show foo and { i18next.t('body.hoo') } supposed to show bar. But i18n-Ally extension said “there are no translations”.

Describe the solution you’d like So please correspond source language file of js like this.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:13 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
antfucommented, Sep 23, 2020

Did you try with this?

"i18n-ally.enabledParsers": ["js"]
1reaction
Uhucreamcommented, Sep 25, 2020

Did you try with this?

"i18n-ally.enabledParsers": ["js"]
    "i18n-ally.enabledParsers": ["js"],
    "i18n-ally.includeSubfolders": true,
    "i18n-ally.pathMatcher": "foo.{locale}.{ext}",
    "i18n-ally.namespace": true,

Wow, it works! But… My project also contains rails and its parser is yml. I tried to modify settings.json of VSCode like below.

    "i18n-ally.enabledParsers": ["js","yml"],
    "i18n-ally.includeSubfolders": true,
    "i18n-ally.pathMatcher": "{namespaces?}{locale}.{ext}",
    "i18n-ally.namespace": true,

After this, although appears sidebar, but i18n-ally said “does not exist” in both yml and js.

By the way, the directory structure of yml file and content like below.

**/foo/bar/
├── locales
    ├── devise.en.js
    ├── devise.ja.js
    ├── foo.ja.js
    ├── foo.ja.js
---
ja:
  foo:
    bar:
     hello: hello

In ruby file,

I18n.t('foo.bar.hello')

ja is omitted in my project.

Also, if both yaml and js is enabled, keypath copying is not working well

Read more comments on GitHub >

github_iconTop Results From Across the Web

Please support language source file type of js #403 - GitHub
I use i18next and use js file as language source file not json. The directory structure is below. **/foo/bar/ ├── locales ├── foo.en.js...
Read more >
File.type - Web APIs - MDN Web Docs
Returns the media type (MIME) of the file represented by a File object.
Read more >
How to make VS Code treat a file extensions as a certain ...
You can use Ctrl + Shift + P (or View -> Command Palette from the menu) and then type settings JSON . Choose...
Read more >
File type associations | IntelliJ IDEA Documentation - JetBrains
Configure the IDE to recognize different file types and open files of certain types in IntelliJ IDEA by default.
Read more >
Visual Studio Code Display Language (Locale)
If the matching Language Pack is not installed, VS Code will display English. Common questions. Unable to write to file because the file...
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