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

Can i configure key prefix for settings.vue-i18n.localeDir? #401

Open
szulcus opened this issue Jul 14, 2023 · 0 comments
Open

Can i configure key prefix for settings.vue-i18n.localeDir? #401

szulcus opened this issue Jul 14, 2023 · 0 comments

Comments

@szulcus
Copy link

szulcus commented Jul 14, 2023

Tell us about your environment

  • ESLint version: ^8.34.0
  • eslint-plugin-vue version: 9.14.0
  • @inlify/eslint-plugin-vue-i18n version: ^2.0.0
  • Node version: v16.19.0

The problem you want to solve.
I have this structure of locales:

import layerBase from '@frontend/nuxt-layer-base/assets/locales/en';
import main from './main.json';
import errors from './errors.json';
import views from './views.json';
import misc from './misc.json';

export default {
	...main,
	errors,
	views,
	misc,
	'layer-base': layerBase,
};

image
In .eslintrc.json:

{
	// ...
	"settings": {
		"vue-i18n": {
			"localeDir": "./locales/**/*.json",
			"messageSyntaxVersion": "9.3.0-beta.16"
		}
	}
}

And I want to use @intlify/vue-i18n/no-missing-keys rule.
image

Your take on the correct solution to problem.
Maybe:

{
	// ...
	"settings": {
		"vue-i18n": {
			"localeDir": [
				"./locales/**/main.json",
				{
					"pattern": "./locales/**/errors.json",
					"keyPrefix": "errors"
				},
				{
					"pattern": "./locales/**/misc.json",
					"keyPrefix": "misc"
				},
				{
					"pattern": "./locales/**/views.json",
					"keyPrefix": "path"
				}
			],
			"messageSyntaxVersion": "9.3.0-beta.16"
		}
	}
}

Or:

{
	// ...
	"settings": {
		"vue-i18n": {
			"localeDir": [
				"./locales/**/main.json",
				{
					"pattern": "./locales/**/*.json",
					"keyPrefix": true
				},
			],
			"messageSyntaxVersion": "9.3.0-beta.16"
		}
	}
}
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

1 participant