Open sffc opened 1 year ago
Conclusion: retain 1.2 behavior for the time being; print a log statement for the error cases; revisit in 2.0
Proposal:
und
@ro in an unexpected wayLGTM: @robertbastian @sffc
Discussion:
Conclusion: @sffc/@robertbastian to design an API for this.
First thing we need is a clear definition of what it means when we say "failed to generate". The main thing is that all data can fall back to root, and this is the expected behavior in many cases.
I might propose the following definition: "the requested langid has no ancestors that are in the list in availableLocales.json". Unfortunately this definition only works with DatagenProvider as a data source.
A cleaner definition might be to just require that source providers in DatagenDriver return non-und data for all languages they support (i.e. RetainBaseLanguages-like behavior), and we can make sure DatagenProvider does this.
Once we decide on the definition, for the API, I think DatagenDriver::export
should return a struct such as
#[non_exhaustive]
pub struct ExportResult {
pub missing_locales: Vec<LanguageIdentifier>
}
On the CLI, we just send the list through log::info!
.
Feedback? @robertbastian @zbraniecki
unrelated to missing locales, but I have another use case for ExportResult
, returning the crates that a baked exporter needs. This is currently only logged.
Proposal:
ExportResult
and return it from datagen driverLGTM: @sffc @robertbastian
tl;dr, what should we do when a user tries to export a locale from datagen that isn't in CLDR?
At first thought, it seems that we should inform the client by failing datagen. However, this is more nuanced. Some caveats:
Because of caveats 2 and 3, we cannot always simply run fallback and fill in the data based on fallback.
@Manishearth suggested tagging data keys that aren't expected to fall back to root with some extra metadata. This fixes caveats 2 and 3 but not 1.
Related questions:
CC @robertbastian