Skip to content

Pull initial translations and fix to translation workflow

I did a straightforward pull of fdroid-website from Weblate.

Without making any changes, it breaks because Weblate is not configured to run the hook-json_restore_hierarchy as documented in TRANSLATIONS.md.

After manually running that script over each of _data/*/strings.json, it worked, but ended up with a lot of empty strings in the resulting website. It turns out this is due to untranslated values in strings.json defaulting to "" instead of the English equivalent.

Here is a severe example of an empty translation (Persian) not falling back to English:

website-fa

And here is a less severe example of a partially translated (German) not falling back:

website

Initially, I saw this as a bug in jekyll polyglot, and so logged an upstream bug there.

However, it occurred to me that we could get around this by directly using the po2json + json2po tools from translate-toolkit. These are likely the exact tools which Weblate is using to manage our .json files anyway, and if we can extract them into .po files, then we can actually merge the _pages/*.md and _data/strings.json strings into a single Weblate project after all.

The problem is, there is a similar (what I would consider) bug in translate-toolkit whereby untranslated strings in .po files don't fall back to the default values when converted to JSON. Instead, they also show as an empty string. Sooooo, I logged an upstream bug there too.

So, in the meantime as a proof of concept, I've hacked together a script which is in the top commit of this branch, just to show that we needn't be help up by upstream. The script takes the English strings.json, and then populates it with any translated strings it finds in the translated version, overwriting the English string. It then saves the output to the translated file. This means that untranslated strings end up falling back to English.

This is what it looks like with this hack:

website

Edited by username-removed-25042

Merge request reports