26 Commits

Author SHA1 Message Date
Ivo Julca
4d2cb1ce7f Build: Update scripts for .pot, .po files to support Python files
- Rewrites some of the commands to use Python.
- Also implements wmlxgettext --force-po, similar to xgettext.
2023-06-14 09:58:56 +02:00
Slayer95
be991e027d
wmlxgettext: Support extracting all textdomains at once (#7624)
* wmlxgettext: Support extracting all textdomains at once

- -o now expects a folder.
- --domain is now treated as an optional filter.

* wmltools/gui/wmlxgettext: Update input handling

- Fix --initialdomain
- Textdomain is no longer mandatory.
- Accept output dir rather than output file.
2023-05-24 22:08:18 +02:00
Steve Cotton
5c07604c01 wmlxgettext: add a --no-sort-by-file option
Some users of wmlxgettext have scripts that already provide the file list in
a deterministic order, and the sorting added in 3761faf925 was choosing a
different order to the one desired.

(cherry picked from commit 904bb9bfb82c391d20e89dfbaacc1e71749dc3d9)
2022-03-28 10:36:12 +02:00
Alexander Lacson
518becac59 [wmltools] Fix Docstrings
docstrings of the keyboardinterrupt handler.
2022-02-16 12:12:37 +01:00
Alexander Lacson
24098cb54a wmlxgettext and wmlindent change exit code
For keyboard interrupt change exit code from 0 to 1.
2022-02-16 12:12:37 +01:00
Steve Cotton
3761faf925 wmlxgettext: sort-by-filename before processing files
Add a sort inside wmlxgettext so that the order of filenames on the command
line doesn't affect the output. The sort is run unconditionally, because I
don't see a usecase for not enabling it. For consistency with xgettext and
msgcat, if there was an option to enable it then it would be called
`--sort-by-file`.

The aim of this change is to reduce the number of changes in .po files caused
by a pot-update. When multiple comments refer to the same translatable string,
separate runs of pot-update could generate them in a random order. If I've
understood the root cause correctly, wmlxgettext itself was deterministic, but
the order of the files on wmlxgettext's command line was not deterministic.

For testing, I tried reversing the sort order; the resulting reordering hit
lines that commonly swap order during pot-updates.

This affects the ordering of the lines beginning `#.` that are generated from
`#po:` comments and also those auto-generated from `[message]speaker=`, etc.
2021-12-02 09:54:26 +01:00
max-torch
78f37713f5 Define KeyboardInterrupt Exception Handler in wmlxgettext
Note: The signal class object was used to avoid wrapping the entire main routine in a try...except clause.
2021-11-17 23:08:37 +01:00
Nobun
e1c7c84957 wmlxgettext: fix #4275: not handle objectives.lua's turn counter 2019-09-11 14:32:16 +02:00
josteph
e642223017 wmlxgettext: Fix crash if no *.cfg file is found
fixes #3719
[ci skip]
2018-11-14 20:14:44 +01:00
Celtic Minstrel
42c48d1483 Move wmlxgettext to the data/tools directory so that it's automatically included in official packages
(cherry-picked from commit 59e78e556593cea7650998611640aeff3a6b288f)
2018-10-07 03:24:58 +00:00
Ignacio R. Morelle
8b59af444d Remove broken Python port of wmlxgettext 2015-06-21 22:44:22 -03:00
Alexander van Gessel
6439916e9f Disable the python wmlxgettext script...
...so people don't spend days trying to figure out why it doesn't do
what it should
2012-03-19 03:30:19 +01:00
Nils Kneuper
2cee070a75 add a clarifying message in the python wmlxgettext script...
...saying that it is not used for mainline since some confusion seems
to have come up there...
2011-10-29 19:38:34 +00:00
Thibault Févry
6674487fb0 Remove W604 pep8 warning on files. Use repr(x) instead of deprecated 2011-03-25 20:46:50 +00:00
Thibault Févry
2288ef0939 Removed a lot of trailing whitespaces. Shouldn't be anymore in python scripts. 2011-03-12 02:22:21 +00:00
Eric S. Raymond
6a60c523a3 Cope better with attributes at toplevel. 2009-09-20 16:22:18 +00:00
Eric S. Raymond
ae20489ec0 Croak more gracefully on a file with no element structure. 2009-09-20 15:40:28 +00:00
Eric S. Raymond
3c5bc16d0a Don't generate exiguous space. 2009-04-04 16:14:47 +00:00
Eric S. Raymond
b332f4a054 Remove pointless -i/--initialdomain option inherited from Perl. 2009-04-04 16:00:03 +00:00
Eric S. Raymond
b7ae3a1134 Add to new wmlgettext the ability to embed translation notes 2009-04-04 13:56:48 +00:00
Eric S. Raymond
20b27ed164 Generate Wesnoth version into .po. 2009-03-31 14:56:42 +00:00
Eric S. Raymond
2fc3eb541a Generate po headers. 2009-03-31 01:27:49 +00:00
Eric S. Raymond
c20896690c Beginnings of attribute filtering. 2009-03-31 00:59:42 +00:00
Eric S. Raymond
54c8c733c3 Speed up and improve parsing. 2009-03-30 23:59:05 +00:00
Eric S. Raymond
51dc220f3a Parsing stage for new wmlgettext is working. 2009-03-30 23:26:47 +00:00
Eric S. Raymond
47b7a82e46 A start on a wmlgettexct replacement in Python. 2009-03-30 10:48:54 +00:00