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

i18n vue plugin option ? #545

Open
ArcadeCode opened this issue Jul 23, 2024 · 6 comments
Open

i18n vue plugin option ? #545

ArcadeCode opened this issue Jul 23, 2024 · 6 comments
Labels
enhancement New feature or request

Comments

@ArcadeCode
Copy link

Please describe

I use vue I18n who is really helpful for Internationalization but he need some configuration and I will really appreciate if I can have an option in create-vue for this, but I checked the code and I'm not qualified to understand it.

Additional context

To make a fast configuration the vue-i18n doc propose to config all in the main.ts but it's more clear to make a local(s) folder with all traductions and import it in the main.ts or use a i18n folder:
image

Anyone think it will be good idea ?

@ArcadeCode ArcadeCode added the enhancement New feature or request label Jul 23, 2024
@Procrustes5
Copy link

I am developing in Japanese and Korean, totally agree with you.

When the project grows to a certain extent, I have often thought that it would be nice if the i18n was set up at the stage of making the project.

I think it's also good for the configuration of creating folders on i18n.

@Procrustes5
Copy link

#548
Made a pull request based on your issue. If you have any opinions, please give it to me.

@messenjer
Copy link
Contributor

In general, I put my i18n configuration into a separate folder: plugins/i18n.ts

I keep the translation files in the locales folder: src/locales/en.json.

This separation makes it easy to specify the folder containing the translations when using various translation tools:

{
    "i18n-ally.localesPaths": [
        "src/locales"
    ]
}
export default defineConfig({
  plugins: [
    VueI18nPlugin({
      include: [path.resolve(__dirname, './src/locales/**')],
    }),
  ],
})

I find this approach to be more modular.

@ArcadeCode
Copy link
Author

Yes it will be more modular in this way, but in this idea why don't moving router.ts in the plugins folder ?

@messenjer
Copy link
Contributor

In the previous vue installer vue-cli-i18n https://github.com/intlify/vue-cli-plugin-i18n

The file was located here :

src/i18n.(js|ts)

And the default localeDir was src/locales

it should be another solution.

@ArcadeCode
Copy link
Author

Sounds good to me if we take the example from the i18n vue-cli plugin.

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

No branches or pull requests

3 participants