You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As a follow-up to #11509: a little quirk is that if you translate a paragraph, but the translation is the same as the original, which can happen, e.g., with paragraphs like
You can install packages from
- `PyPI <https://pypi.org>`_
...
then the paragraph is wrongly marked as "untranslated".
How to Reproduce
conf.py:
translation_progress_classes = True
index.rst:
$ cat index.rst
Foo bar baz.
Foo bar baz 2.
Foo bar baz 3.
locales/fr/LC_MESSAGES/index.po:
# SOME DESCRIPTIVE TITLE.
# Copyright (C)
# This file is distributed under the same license as the Python package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: Python \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-08-01 17:07+0200\n"
"PO-Revision-Date: 2023-08-01 17:08+0200\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: ../index.rst:1
msgid "Foo bar baz."
msgstr "Foo bar baz translated."
#: ../index.rst:3
msgid "Foo bar baz 2."
msgstr ""
#: ../index.rst:5
msgid "Foo bar baz 3."
msgstr "Foo bar baz 3."
Build command: sphinx-build -Dlanguage=fr . build
Excerpt from HTML output:
<pclass="translated">Foo bar baz translated.</p><pclass="untranslated">Foo bar baz 2.</p><pclass="untranslated">Foo bar baz 3.</p>
As far as I can see, in the Python gettext API, the original message is returned unchanged when there is no translation, which doesn't allow distinguishing this case from the case where the translation is present but happens to be the same as the original.
However, it should be possible to force a distinction to be made using a fallback:
The text was updated successfully, but these errors were encountered:
jeanas
changed the title
"Untranslated" class added on paragraph which are translated but not different from original
"Untranslated" class added on paragraphs which are translated but not different from original
Aug 1, 2023
Although I never use localization, it is quite important if two acronyms are used the same way in two languages. For instance NATO in English translates to NATO in German but OTAN in French. And if there are a lot of NATO occurrences, you might end up having an incorrect amount of "untranslated" content (which may not be that good I think).
Describe the bug
As a follow-up to #11509: a little quirk is that if you translate a paragraph, but the translation is the same as the original, which can happen, e.g., with paragraphs like
then the paragraph is wrongly marked as "untranslated".
How to Reproduce
conf.py
:index.rst
:locales/fr/LC_MESSAGES/index.po
:Build command:
sphinx-build -Dlanguage=fr . build
Excerpt from HTML output:
Environment Information
Sphinx extensions
None
Additional context
As far as I can see, in the Python
gettext
API, the original message is returned unchanged when there is no translation, which doesn't allow distinguishing this case from the case where the translation is present but happens to be the same as the original.However, it should be possible to force a distinction to be made using a fallback:
https://docs.python.org/3/library/gettext.html#gettext.NullTranslations.add_fallback
(this is the approach I used in my hand-made extension for translation progress before #11509).
@AA-Turner
The text was updated successfully, but these errors were encountered: