intlify / intlify/bundle-tools

Provide list of supported locales when lazy loading

Open
#205 0 comments 1 reaction 0 assignees View on GitHub
status: proposal
Dominant language
TypeScript
Stars
270
Forks
46
PR merge metrics
No merged PRs in 30d

Description

### Clear and concise description of the problem

When eagerly loading the locales a list of supported locales is provided by `useI18n().availableLocales`.

There is no such list when lazy loading the locales since `availableLocales` only includes loaded locales.

### Suggested solution

In https://github.com/lukashass/woodpecker/blob/1bfb9a322f9f8b94ec223afc7eb9085d54f3a16b/web/vite.config.ts#L34-L53 I used a vite virtual module that provides a list of supported locales derived from the filenames in the vueI18n include path.

I think this might be a good feature to be included in the vite plugin (or unplugin?)

### Alternative

A manual list of supported locales is of course possible, but not really desirable IMHO.

### Additional context

_No response_

### Validations

- [X] Read the [Contributing Guidelines](https://github.com/intlify/bundle-tools/blob/main/.github/contributing.md).
- [X] Read the README
- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.