Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32.2k
gh-79516: allow msgfmt.py to compile multiple input po files#10875
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Changes from1 commit
73b5ac8
5fb1575
b1968e9
0bc4ad3
a9e67b4
6c59d6c
1ce22c0
863bd97
4390ede
008ea27
8744743
93a6eb7
ba26b80
150cea1
d9afabb
9004387
7556f79
80947d1
12acb83
1ecc1f3
e59ba68
4ffd20a
7505f2b
2c27120
1f4e5ac
4170796
46c08c5
24d89a6
17b4e05
bfc8a44
106dd40
9cb9395
08bc8d7
9d992cd
31fd434
916aec7
51fcf09
d51ad50
677f720
b4ea80a
3120add
d642923
9d91f12
4d83cb7
421272b
09b97d9
12cae51
3760851
d45039c
dde5ef1
bb6e0c5
797990a
c95af16
905ec70
b7a7c48
1b3b73e
1db2c66
3a6e1ef
743bdc5
50e7145
caa8955
a4f1769
11f6e69
0ed3107
d1e0a26
213afcb
4d54e50
ab97edd
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
PO test files are changed to the generic like other po files.
- Loading branch information
Uh oh!
There was an error while loading.Please reload this page.
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
"""Tests for the Tools/i18n/msgfmt.py tool.""" | ||
import filecmp | ||
import os | ||
import shutil | ||
@@ -174,6 +175,7 @@ def update_catalog_snapshots(): | ||
for po_file in data_dir.glob('*.po'): | ||
mo_file = po_file.with_suffix('.mo') | ||
compile_messages(po_file, mo_file) | ||
# cannot use compile_message because of both input files | ||
assert_python_ok(msgfmt, '-o', data_dir /'file12_fr.mo', | ||
data_dir / 'file1_fr_crlf.po', | ||
data_dir / 'file2_fr_lf.po') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. I would use compile_messages, not assert_python_ok There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. The problem is that compile_message only supports one single input po file. Do you suggest that I should change the behavior of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Ah… would it be a big change? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Not so big. It should be ready before end of today. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Done. It was enough to swap parameters and allow an arbitrary number for the second through a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Ah, I assumed that compile_messages came from the tool being tested or the gettext module, but now I see it’s also a test helper – and it calls assert_python_ok! | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -14,7 +14,13 @@ | ||
-o file | ||
--output-file=file | ||
Specify the output file to write to. If omitted, output will go to a | ||
file named filename.mo (based off the input file name(s)). | ||
If more than one input file is given, and if an output file is passed | ||
with -o option, then all the input files are merged. If keys are | ||
repeated (common for "" key for the header) the one from last file is used. | ||
s-ball marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
If more than one input file is given, and no -o option is present, then | ||
every input file is compiled in its corresponding mo file (same name | ||
s-ball marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
with mo replacing po) | ||
-h | ||
--help | ||
@@ -23,14 +29,6 @@ | ||
-V | ||
--version | ||
Display version information and exit. | ||
""" | ||
import os | ||
@@ -255,9 +253,9 @@ def writefile(outfile, output): | ||
print(msg, file=sys.stderr) | ||
def main(): | ||
try: | ||
opts, args = getopt.getopt(sys.argv[1:], 'hVo:', | ||
['help', 'version', 'output-file=']) | ||
except getopt.error as msg: | ||
usage(1, msg) | ||
@@ -285,4 +283,4 @@ def main(argv): | ||
if __name__ == '__main__': | ||
main() |
Uh oh!
There was an error while loading.Please reload this page.