Skip to content

gettext: fix handling of fuzzy translations#13966

Merged
Frenzie merged 2 commits into
koreader:masterfrom
benoit-pierre:pr/fix_gettext_fuzzy_translations
Jun 20, 2025
Merged

gettext: fix handling of fuzzy translations#13966
Frenzie merged 2 commits into
koreader:masterfrom
benoit-pierre:pr/fix_gettext_fuzzy_translations

Conversation

@benoit-pierre

@benoit-pierre benoit-pierre commented Jun 19, 2025

Copy link
Copy Markdown
Member

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."):
    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"):
    msgid ""
    "%1\n"
    "%2"
    msgstr ""
    "%1\n"
    "%2"
    
    msgid ""
    "Could not save file to:\n"
    "%1\n"
    "%2"
    msgstr ""
    "لم يتم حفظ الملف في:\n"
    "%1"

This change is Reviewable

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"
```
@Frenzie Frenzie merged commit 0594f61 into koreader:master Jun 20, 2025
4 checks passed
@Frenzie

Frenzie commented Jun 20, 2025

Copy link
Copy Markdown
Member

Thanks!

@Frenzie Frenzie added this to the 2025.06 milestone Jun 20, 2025
@benoit-pierre benoit-pierre deleted the pr/fix_gettext_fuzzy_translations branch June 20, 2025 12:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants