Include en-US description of custom roles in static API #1181
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In #1154, the static-api data (v1/teams.json) included only ids of roles, such as
"roles": ["spec-editor"]
. Separately the public-facing descriptions for the roles would be included in a ftl translation file produced bydump-website
.This worked!
but has the downside that if some new role is introduced into the team repo before the translation for it lands in rust-lang/www.rust-lang.org in locales/en-US/teams.ftl, then the website would temporarily display the following ugly placeholder, until a commit such as rust-lang/www.rust-lang.org#1821 syncs the ftl file.
There are 2 potential fixes:
Hide role from the website if localization is not available. This means roles would be added in rust-lang/team without immediately showing up on the website. They would show up only after the next ftl sync, which happens only about once a year.
Include an en-US description in static-api. As soon as a role appears in rust-lang/team, it will appear on the website with a fallback to the English description from teams.json.
Approach 2 is what the website already does for team names and descriptions. See the logic here: https://github.com/rust-lang/www.rust-lang.org/blob/b35215187ed75d4d2a9a056f1847309aa2d404d2/src/i18n.rs#L151-L169
Pseudocode:
This PR makes it possible to do approach 2 for roles too.