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

Be able to have different dictionary instances #190

Closed
EmeraldSnorlax opened this issue Jun 22, 2022 · 1 comment
Closed

Be able to have different dictionary instances #190

EmeraldSnorlax opened this issue Jun 22, 2022 · 1 comment

Comments

@EmeraldSnorlax
Copy link

EmeraldSnorlax commented Jun 22, 2022

Is your feature request related to a problem? Please describe.
Currently, it seems that loading dictionaries registers it to a single global store. While this is fine for most use cases, this doesn't (easily) allow mixing and matching of languages in the same UI. For example, someone might want the UI in one language but have place names in another. An example of what I mean:

locales/
	ui/
		en_US.json
		de_DE.json
	places/
		en_US.json
		de_DE.json

Somewhat similar to Google maps, where if you view a foreign country it shows the localised version of the name in addition to the native name.

en
jp

Describe the solution you'd like
Able to have register different i18n instances with their own dictionary files.

Then, maybe have each instance as a child of _, (eg _.ui("nav.home"), _.places("locations.berlin"))
Or alternatively, in the init of the library, be able to assign each i18n instance to their own store

Describe alternatives you've considered
Loading the secondary language manually, just not localising things separately and forcing a global choice of localisation

How important is this feature to you?
Somewhat important. The use-case I had in mind for this is showing info related to a game in an overlay most likely to be used by streamers. They might want the app UI to be in their native languages, but have placenames from the game and/or other viewer-facing parts of the stream in English

Additional context
I'm writing a desktop app with Tauri that uses Sveltekit for the UI.
From a preliminary glance, it seems that #179 might allow this to happen?

@EmeraldSnorlax EmeraldSnorlax changed the title Be able to mix and match dictionaries Be able to different dictionary instances Jun 22, 2022
@EmeraldSnorlax EmeraldSnorlax changed the title Be able to different dictionary instances Be able to have different dictionary instances Jun 22, 2022
@EmeraldSnorlax
Copy link
Author

Using airbnb's polyglot seems to be a better usecase for this.

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