Skip to content

Filter out translated Fluent strings with missing references

As mentioned in tpo/translation!107 (comment 3057465) we have some Fluent strings along the line of

string-2 =
  .title = { string-1 }

because a string is being re-used for an attribute, or vis-versa. In these cases, we often have weblate copy over the en-US string into all locales for us, since we likely want the same in other locales.

However, in cases where the locale is missing a translation of string-1, this would end up being shown in the UI as a literal { string-1 } for that locale, rather than falling back to the next locale or en-US.

At the moment, I'm not aware of any cases where this happens since all our locales have the referenced string already translated (I would have to double check this), but it may become an issue in the future.

I checked with the mozilla Fluent team and apparently it would be hard to check for such missing references at run time within DocumentL10n, so it would be best for us to filter them out pre-build.

I think if we ran a filter within the actual translations repository, it would end up conflicting with the weblate extension. So I think we can either:

  1. Have a "mirror" repository in tpo/translations for each Tor Browser branch that periodically reads from the weblate branch and filters it, and then in tor-browser-build we read from this filtered branch instead.
  2. Perform the filtering in tor-browser-build as part of the build script.

I think the latter is probably easier, and doesn't require much change.

/cc @emmapeel

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information