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

How to internationalize our programs? #1815

Open
thunderstorm010 opened this issue Jun 1, 2021 · 6 comments
Open

How to internationalize our programs? #1815

thunderstorm010 opened this issue Jun 1, 2021 · 6 comments

Comments

@thunderstorm010
Copy link

No description provided.

@cmyr
Copy link
Member

cmyr commented Jun 2, 2021

This is tricky. There is support for localization, but there is not currently any support for bundling localization resources with your program.

There is a mechanism by which you can kind of make this work, though, by manually instantiating your own L10nManager that points to a specific set of string files; take a look in druid/src/localization.rs to get a sense of how this works.

This does not handle other aspects of internationalization, such as number or date formatting, which is firmly in the "one day" category.

@changhe3
Copy link

But everything in druid/src/localization.rs other than LocalizedString are private. We cannot use any of them.

@changhe3
Copy link

changhe3 commented Jun 30, 2021

Currently it seems you can only use LocalizedString::with_args to build your localization manually. You probably need to reinvent wheels again by yourself if you want to have something ergonomic to work with.

@cmyr
Copy link
Member

cmyr commented Jun 30, 2021

Localization is based on the fluent project. You create localization files as described there, and then you can pass your custom resources in when starting your app, with AppLauncher::localization_resources.

There might be some more information in #1528.

@zbraniecki
Copy link

hi all, we finished first revision of the higher level API based on FluentBundle - it's in fluent-fallback and binds with l10nregistry-rs. I documented the resource manager here: #397 (comment)

For Localization class you may explore how we structure the "generic" one - https://searchfox.org/mozilla-central/source/dom/webidl/Localization.webidl and then extend for DOM bindings needs for our UI - https://searchfox.org/mozilla-central/source/dom/webidl/DOMLocalization.webidl

I also recommend my notes on how I believe UI should generally hook in localization bindings - raphlinus/crochet#7 and unicode-org/message-format-wg#118

The latter comes from a Unicode WG where we work on standardization of MessageFormat 2.0 which hopefully will be a straight superset of Fluent and we'll provide automated migration tools and the higher level APIs should work without changes.

@cmyr
Copy link
Member

cmyr commented Aug 15, 2021

Thanks @zbraniecki, will take a look!

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

4 participants