Binary catalogs are more space efficient (total translations disk usage:
14MB instead of 35MB), and easier and faster (roughly 10 times) to load:
no parsing, and less processing (no need to unescape strings).
Not much difference on the Android APK size (a ~600KB reduction), but
other TAR.GZ / ZIP distributions see a reduction of ~3.5MB.
The code would incorrectly load part of them, examples:
- the fuzzy translation is not ignored (because of the context, which is itself ignored):
```
msgctxt "Status of group of books"
msgid "All"
msgstr "Kaikki"
```
- not ignored, with an invalid original string (`"Please configure it in the settings."`):
```po
msgid ""
"The download folder is not valid.\n"
"Please configure it in the settings."
msgstr ""
"Le répertoire de téléchargement est invalide.\n"
"Veuillez le configurer dans les paramètres."
```
- and in this case the second fuzzy entry end up overwriting the valid translation (with `"لم يتم حفظ الملف في:\n%1"`):
```po
msgid ""
"%1\n"
"%2"
msgstr ""
"%1\n"
"%2"
msgid ""
"Could not save file to:\n"
"%1\n"
"%2"
msgstr ""
"لم يتم حفظ الملف في:\n"
"%1"
```
Everything in string.gsub() is replaced, not only the matching group. By using two groups, we can correctly return the full matched string when none of the special conditions apply.
Fixes <https://github.com/koreader/koreader/issues/8486>.
In case of no environment language. I suppose that doesn't tend to happen much in the wild since I added the offending code early in 2020. ;-)
Fixes <https://github.com/koreader/koreader/issues/6873>.
Strings are prefilled by msgmerge with closely matching ones to reduce the amount of labor required by the translator. Often the string requires only minor adjustment, making the process faster, and when the string isn't a good match it's no big deal. However, these so-called fuzzy strings shouldn't be treated as if they were actually translated.
Fixes the effect seen in <https://github.com/koreader/koreader/issues/5806>.
References https://github.com/koreader/koreader/issues/5232
Given an entry in the PO file like the following:
```
msgctxt "systemstat"
msgid " Total"
msgstr "Totaal"
```
It can be addressed using:
```lua
local _ = require("gettext")
local C_ = _.pgettext
C_("systemstat", " Total")
```
This allows to distinguish between separate instances of the same string, for example "Pages" meaning "Number of pages" and "Pages" meaning "Display of pages".
Extraction of this code pattern is not yet implemented by nightswatcher. xgettext didn't yet support Lua back in 2013 when all this was first added to the program, but now it does. Therefore it might make the most sense to replace the current Python extraction script with xgettext itself.
By default it only understands gettext.pgettext(), but that can be addressed by passing some extra command line arguments, for example:
```
xgettext -l lua -c --keyword=C_:1c,2 *.lua
```
* use product as device model
* print android version (codename + number) + api at launch
* exit the application properly
* fix fullscreen switching (and disable it on newer android versions)
* gettext: lower log level for message: cannot open translation file
* android common settings refactor