Skip to content

Commit 0eab37d

Browse files
committed
Refactor test for msgmerge with compendium-overwrite option
* Implemented a helper function `_get_expected` to standardize the expected PO file structure. * Renamed the option `c-overwrite` to `compendium-overwrite`
1 parent b00f215 commit 0eab37d

2 files changed

Lines changed: 226 additions & 163 deletions

File tree

babel/messages/frontend.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1040,7 +1040,7 @@ class MessageMerge(CommandMixin):
10401040
('input-files', None, ''),
10411041
('directory=', 'D', ''),
10421042
('compendium=', 'C', ''),
1043-
('c-overwrite', '', ''),
1043+
('compendium-overwrite', '', ''),
10441044
('no-compendium-comment', '', ''),
10451045
('update', 'U', ''),
10461046
('output-file=', 'o', ''),
@@ -1092,7 +1092,7 @@ class MessageMerge(CommandMixin):
10921092
'no-wrap',
10931093
'sort-output',
10941094
'sort-by-file',
1095-
'c-overwrite',
1095+
'compendium-overwrite',
10961096
'backup',
10971097
'no-compendium-comment',
10981098
]
@@ -1106,7 +1106,7 @@ def initialize_options(self):
11061106
self.directory = None
11071107

11081108
self.compendium = None #~
1109-
self.c_overwrite = False #
1109+
self.compendium_overwrite = False #
11101110
self.no_compendium_comment = None #
11111111

11121112
self.update = None #
@@ -1170,8 +1170,8 @@ def run(self):
11701170

11711171
for message in compendium_catalog:
11721172
current = catalog[message.id]
1173-
if message.id in catalog and (not current.string or current.fuzzy or self.c_overwrite):
1174-
if self.c_overwrite and not current.fuzzy and current.string:
1173+
if message.id in catalog and (not current.string or current.fuzzy or self.compendium_overwrite):
1174+
if self.compendium_overwrite and not current.fuzzy and current.string:
11751175
catalog.obsolete[message.id] = current.clone()
11761176

11771177
current.string = message.string

0 commit comments

Comments
 (0)