Skip to content

How do people check in CI that en.ftl is complete #397

@krobelus

Description

@krobelus

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

  1. extracting the set of used fluent IDs from Rust sources via a proc-macro
  2. parsing en.ftl to get the set of fluent IDs with English translations
  3. 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.

cc @danielrainer

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions