-
Notifications
You must be signed in to change notification settings - Fork 108
Description
Unlike gettext messages, fluent messages don't have a guaranteed fallback (I'm not counting the fluent ID).
fish shell wants to have all messages available in English (which will be the unconditional fallback).
Their CI will probably check this by
- extracting the set of used fluent IDs from Rust sources via a proc-macro
- parsing
en.ftlto get the set of fluent IDs with English translations - checking that both sets of fluent IDs are equal
Step 1 is a bit unorthodox, since there doesn't seem to be a clean way of extracting used IDs, especially in parallel compilation scenarios.
I suppose they could instead have en.ftl be the single source of fluent IDs,
and guard every use of fluent IDs from Rust with a macro that checks (at compile time) that the given message ID is actually contained in en.ftl.
This can be done with include_str("en.ftl"), like done here, but probably build a static set of fluent IDs (using the phf crate).
The downside of this alternative is that it doesn't allow finding unused entries in en.ftl.
I guess that could be mostly remedied with grep...
I'm curious what other people use, since this seems like a common requirement.