Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File name as root key for this file #336

Open
boris-dibrov opened this issue Sep 8, 2022 · 2 comments
Open

File name as root key for this file #336

boris-dibrov opened this issue Sep 8, 2022 · 2 comments

Comments

@boris-dibrov
Copy link

boris-dibrov commented Sep 8, 2022

Tell us about your environment

  • ESLint version: 8.4.1
  • eslint-plugin-vue version: 7.19.1
  • eslint-plugin-vue-i18n version: 2.0.0
  • Node version: 16.16.0

The problem you want to solve.

Localization messages are divided into files. I'm trying to set up a plugin to take the filename as the parent of the messages in the file. For example, we have files common.json validation.json etc.
In app we use key common.messageKey and validation.messageKey.
But as far as I understand, there is no setting for this in plugin.

Your take on the correct solution to problem.

localeDir: {
    pattern: '...',
    localePattern: /^.+\/(?<locale>[A-Za-z]+)\/.+\.(json5?|ya?ml)$/,
    localeKey: 'path',
    useFilenameAsGroupKey: true // For example
}

Additional context
A very strange situation when I pass localePattern as a regular expression, for some reason it is not applied and the default regular expression is used, if i pass a string, then everything is OK

@its-lee
Copy link

its-lee commented Jan 26, 2023

Has there been any further action on this? This bug makes this rule a non-starter for us as we use it exactly as outlined above.

The existence for 'path' localeKey indicates that this arrangement of i18n files is supported - and the vue-i18n plugin supports this too. So it's strange that it's not a use-case that this rule supports.

@its-lee
Copy link

its-lee commented Jan 27, 2023

Would love to get this merged, let me know if there's anything else that's needed here or any more work required.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants