Skip to content

Change "settings['vue-i18n'].localeDir" to can specify object options. #75

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

Merged
merged 1 commit into from
Jul 17, 2020

Conversation

ota-meshi
Copy link
Member

This PR changes settings['vue-i18n'].localeDir to allow object option.

fixes #10

The option allows the user to specify the following options in the object:

  • pattern (string) ... A glob for specifying files that store localization messages of project.
  • localeKey ('file' | 'key') ... Specifies how to determine the locale for localization messages.
    - 'file' ... Determine the locale name from the filename. The resource file should only contain messages for that locale. Use this option if you use vue-cli-plugin-i18n. This option is also used when String option is specified.
    - 'key' ... Determine the locale name from the root key name of the file contents. The value of that key should only contain messages for that locale. Used when the resource file is in the format given to the messages option of the VueI18n constructor option.

I considered how to let the user specify the depth of the hierarchy instead of the localeKey, but I realized that when I specified the depth of the hierarchy, the locale could not be specified.
I thought perhaps the user would either use vue-cli-plugin or give it directly to the VueI18n constructor and use it.
So I decided to provide two options, file and key.

The other change was to show in the message of the no-missing-keys rule which locale is missing.

Copy link
Member

@kazupon kazupon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect! 💯
Thank you so much!

@kazupon kazupon merged commit 21017fd into intlify:master Jul 17, 2020
@ota-meshi ota-meshi deleted the issue10 branch July 17, 2020 16:46
@kazupon kazupon added the Type: Improvement Includes backwards-compatible fixes label Jul 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Improvement Includes backwards-compatible fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

No support for multi-locale JSON files
2 participants