Skip to content

Commit 6068b47

Browse files
committed
feat: issue2551287 - roundup-gettext extracts strings from detectors/extensions
Enhance roundup_gettext.py to extract strings from detectors/extensions. If the polib module is available, roundup-gettext will extract translatable strings from the tracker's Python code. If polib is missing, it will print a warning. Marcus did most of the work, I had to do a python 2-> conversion of pygettext.py.
1 parent e0e39a3 commit 6068b47

File tree

5 files changed

+772
-8
lines changed

5 files changed

+772
-8
lines changed

CHANGES.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,18 @@ Roundup 2.0 supports Python 3.4 and later. Roundup 2.1.0 supports
1313
python 3.6 or newer (3.4/3.5 might work, but they are not tested).
1414
Roundup 2.4.0 is the last release to support Python 2.
1515

16+
2025-XX-XX 2.5.0
17+
18+
Fixed:
19+
20+
Features:
21+
22+
- issue2551287 - Enhance roundup_gettext.py to extract strings from
23+
detectors/extensions. If the polib module is available,
24+
roundup-gettext will extract translatable strings from the tracker's
25+
Python code. If polib is missing, it will print a warning. (Patch
26+
Marcus Priesch, cleanup to remove python 2 issues, John Rouillard.)
27+
1628
2024-07-13 2.4.0
1729

1830
Fixed:

doc/developers.txt

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -540,11 +540,12 @@ For on-site i18n, Roundup provides command-line utility::
540540

541541
roundup-gettext <tracker_home>
542542

543-
extracting translatable messages from tracker's html templates.
543+
extracting translatable messages from tracker's html templates and
544+
detectors / extensions (assuming `polib`_ is installed) [2]_.
544545
This utility creates message template file ``messages.pot`` in
545546
``locale`` subdirectory of the tracker home directory. Translated
546-
messages may be put in *locale*.po files (where *locale* is selected
547-
locale name) in the same directory, e.g.: ``locale/ru.po``.
547+
messages may be put in *locale*.po files (where *locale* is the two
548+
character locale name) in the same directory, e.g.: ``locale/ru.po``.
548549
These message catalogs are searched prior to system-wide translations
549550
kept in the ``share`` directory.
550551

@@ -562,6 +563,10 @@ If you use ``roundup-gettext`` it will add a full preamble including
562563
of the ASCII range will cause Roundup to crash with a
563564
UnicodeDecodeError.
564565

566+
.. [2] Note that it will not extract `deferred translations`_
567+
from detectors or extensions. Those have to be manually
568+
added to messages.pot.
569+
565570
Translating Messages
566571
^^^^^^^^^^^^^^^^^^^^
567572

@@ -666,6 +671,7 @@ At run time, Roundup automatically compiles message catalogs whenever
666671
.. _po filetype plugin:
667672
https://www.vim.org/scripts/script.php?script_id=64
668673
.. _PO utilities: https://github.com/pinard/po-utils
674+
.. _polib: https://polib.readthedocs.io
669675
.. _poEdit: https://poedit.net/
670676
.. _pology: http://pology.nedohodnik.net/doc/user/en_US/ch-poformat.html
671677
.. _pylint: https://pylint.pycqa.org/en/latest/

doc/installation.txt

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -285,9 +285,18 @@ redis
285285
guide`_ for details.
286286

287287
pyjwt
288-
To use JWT (JSON web tokens) for login (experimental), install `pyjwt`_
289-
(v1.7.1, v2.0.1 tested). If you don't have it installed, JWT's
290-
are not supported.
288+
To use JWT (JSON web tokens) for login (experimental), install
289+
`pyjwt`_ (v1.7.1, v2.0.1 tested). If you don't have it
290+
installed, JWT's are not supported.
291+
292+
polib
293+
Roundup includes translations in various languages. To extract
294+
strings designated for translation from your tracker's HTML
295+
templates, you can utilize `roundup-gettext`. However, if you
296+
wish to extract translatable strings from the Python code in
297+
tracker's detectors or extensions directories using
298+
roundup-gettext, you must install polib_. See the `developer's
299+
guide`_ for details on translating your tracker.
291300

292301
pywin32 - Windows Service
293302
You can run Roundup as a Windows service if pywin32_ is installed.
@@ -2361,6 +2370,7 @@ the test.
23612370
https://dev.mysql.com/doc/refman/8.0/en/creating-accounts.html
23622371
.. _apache: https://httpd.apache.org/
23632372
.. _brotli: https://pypi.org/project/Brotli/
2373+
.. _`developer's guide`: developers.html
23642374
.. _docutils: https://pypi.org/project/docutils/
23652375
.. _flup: https://pypi.org/project/flup/
23662376
.. _gpg: https://www.gnupg.org/software/gpgme/index.html
@@ -2372,6 +2382,7 @@ the test.
23722382
.. _mod_wsgi: https://pypi.org/project/mod-wsgi/
23732383
.. _MySQLdb: https://pypi.org/project/mysqlclient/
23742384
.. _Olson tz database: https://www.iana.org/time-zones
2385+
.. _polib: https://polib.readthedocs.io
23752386
.. _Psycopg2: https://www.psycopg.org/
23762387
.. _pyjwt: https://pypi.org/project/PyJWT/
23772388
.. _pyopenssl: https://pypi.org/project/pyOpenSSL/

0 commit comments

Comments
 (0)