Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for fuzzy translations #9618

Closed
topogps opened this issue Sep 7, 2021 · 1 comment
Closed

Support for fuzzy translations #9618

topogps opened this issue Sep 7, 2021 · 1 comment
Labels
internals:internationalisation type:enhancement enhance or introduce a new feature
Milestone

Comments

@topogps
Copy link

topogps commented Sep 7, 2021

Problem

Entries in po files that are currently marked as "fuzzy" are not used in "mo" files. The original source language is used instead of the translated language. Fuzzy translations are translations that in general need to be reviewed by a translator. For example all machine translations could be marked as fuzzy. It would be desirable to let the user decide whether to include these fuzzy translations in the generated documentation.

Proposed solution

Add a new configuration parameter "use_fuzzy_translations".

Change in line 72 of the file sphinx/sphinx/util/i18n.py

write_mo(file_mo, po)

to

write_mo(file_mo, po, use_fuzzy_translations)

Writing mo files with fuzzy translations is supported by the babel package, as can be seen in the documentation:

http://babel.pocoo.org/en/latest/api/messages/mofile.html

@topogps topogps added the type:enhancement enhance or introduce a new feature label Sep 7, 2021
@tk0miya tk0miya added this to the 4.3.0 milestone Sep 11, 2021
@tk0miya
Copy link
Member

tk0miya commented Sep 11, 2021

+1: Reasonable. I prefer to name it as gettext_allow_fuzzy_translations for the setting because we've given "gettext_" prefix to the i18n settings so far.
https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-internationalization

tk0miya added a commit to tk0miya/sphinx that referenced this issue Nov 8, 2021
tk0miya added a commit to tk0miya/sphinx that referenced this issue Nov 8, 2021
tk0miya added a commit to tk0miya/sphinx that referenced this issue Nov 9, 2021
@tk0miya tk0miya closed this as completed in 203094b Nov 9, 2021
tk0miya added a commit that referenced this issue Nov 9, 2021
…ations

Close #9618: i18n: Add gettext_allow_fuzzy_translations
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 10, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
internals:internationalisation type:enhancement enhance or introduce a new feature
Projects
None yet
Development

No branches or pull requests

2 participants