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

ResourceManager::get_bundle and get_bundles is inconsistent and confusing #279

Open
gregtatum opened this issue Nov 8, 2022 · 0 comments
Labels
bug crate:fluent-resmgr design-decision Issues pending design decision, usually Rust specific

Comments

@gregtatum
Copy link
Member

get_bundle will only load the resources for a single locale, but supports fallback behavior for i18n formatters like date time format (at least it claims to). This bundle will provide no fallback behavior for missing messages.

let res = self.get_resource(res_id, &locales[0].to_string());

get_bundles will iterate over bundles for each locale in the list. I guess you could implement your own fallback behavior for messages here, but the i18n formatters are not provided with a list of locales to fallback upon, so the behavior is different than get_bundle. This seems a bit weird and inconsistent. Firefox is not using this crate, but as an example resource manager, the behavior is a bit odd and inconsistent.

let mut bundle = FluentBundle::new(vec![locale.clone()]);

To make them consistent you would either:

A. Remove fallbacking for get_bundle and only provide a single locale, not a Vec of locales.
B. Pass the locale fallbacks to FluentBundle.

For B I'm unsure which behavior should provided for the fallback list, given:

Locale list: ["en-US", "en-CA", "pl", "es-ES"]
And en-CA as the iteration step.

Would the locale list be:

i. A slice of the remaining;["en-CA", "pl", "es-ES"]
ii. A rearranged list:["en-CA", "en-US", "pl", "es-ES"]

@gregtatum gregtatum added bug design-decision Issues pending design decision, usually Rust specific labels Nov 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug crate:fluent-resmgr design-decision Issues pending design decision, usually Rust specific
Projects
None yet
Development

No branches or pull requests

2 participants