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
with_locales_no_fallback
does fallback
#4879
Comments
Context: I'm trying to replace https://github.com/robertbastian/icu4x/blob/ec32ad4a79707b1ddb7852ed1653ac2d86c27f3f/provider/datagen/src/baked_exporter.rs#L25 by a version that doesn't use the network (the current test does). However I cannot figure out an invocation for baked that doesn't use fallback. |
You can avoid the datagen-time fallback by using |
The invocation I've used in a number of other places to avoid this problem is .with_locales_and_fallback([LocaleFamily::FULL], Default::default()) |
It's not a bug, so unassigning myself. |
The function docs say: "Sets this driver to generate the given locales assuming no runtime fallback." It's totally reasonable that the driver needs datagen-time fallback in order to generate data that requires no runtime fallback. That's the only way to ensure that the input list of langids can all be fully resolved at datagen time. We may have previously avoided loading the fallbacker if the explicit langid had an exact match with the supported locales, but now we always load the fallbacker in order to pick up any aux keys and locale extensions from the parent locales, which was a bug before. |
This invocation works with icu4x/provider/blob/src/export/mod.rs Lines 23 to 27 in 51bd08e
It uses implicit exporter-derived defaults - what's the equivalent invocation for a baked provider? |
I guess it's |
.with_all_locales().with_fallback_mode(FallbackMode::Hybrid) is the same as .with_locales_and_fallback([LocaleFamily::FULL], FallbackOptions {
deduplication_strategy: Some(DeduplicationStrategy::None),
runtime_fallback_location: Some(RuntimeFallbackLocation::External),
}) |
This transformation is implemented in code (_, Some(legacy_locales), FallbackMode::Hybrid) => {
LocalesWithOrWithoutFallback::WithFallback {
families: map_legacy_locales_to_locales_with_expansion(legacy_locales),
options: FallbackOptions {
runtime_fallback_location: Some(RuntimeFallbackLocation::External),
deduplication_strategy: Some(DeduplicationStrategy::None),
},
}
} |
I think you should be good if you set all three of those. |
So what's the difference between |
It might be mechanically the same as |
Does this issue change your position on flattening these options to DatagenDriver? impl DatagenDriver {
pub fn with_locale_families(...)
pub fn with_deduplication(...)
pub fn with_runtime_fallback_location(...)
} And perhaps change |
I think I'm fine flattening it. |
The following snippet panics because
HelloWorldProvider
doesn't have fallback dataThe text was updated successfully, but these errors were encountered: