Skip to content

Commit 7fb19e3

Browse files
committed
Create a catalog without fuzzy by default, remove add-location
* Mark the catalog as fuzzy after msgcat and msgmerge if there is at least one fuzzy message * Remove add-location as it's unnecessary
1 parent 0eab37d commit 7fb19e3

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

babel/messages/frontend.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -910,7 +910,6 @@ class MessageConcatenation(CommandMixin):
910910
('force-po', None, ''),
911911
('indent', 'i', ''),
912912
('no-location', None, ''),
913-
('add-location', 'n', ''),
914913
('strict', None, ''),
915914
('properties-output', None, ''),
916915
('stringtable-output', None, ''),
@@ -931,7 +930,6 @@ class MessageConcatenation(CommandMixin):
931930
'force-po',
932931
'indent',
933932
'no-location',
934-
'add-location',
935933
'strict',
936934
'properties-output',
937935
'stringtable-output',
@@ -964,8 +962,7 @@ def initialize_options(self):
964962
self.escape = None
965963
self.force_po = None
966964
self.indent = None
967-
self.no_location = None
968-
self.add_location = None
965+
self.no_location = None #
969966
self.strict = None
970967
self.properties_output = None
971968
self.stringtable_output = None
@@ -1006,12 +1003,14 @@ def _prepare(self):
10061003
self.message_count[message.id] += 1
10071004

10081005
def run(self):
1009-
catalog = Catalog()
1006+
catalog = Catalog(fuzzy=False)
10101007
self._prepare()
10111008

10121009
for filename in self.input_files:
10131010
with open(filename, 'r') as pofile:
10141011
template = read_po(pofile)
1012+
if catalog.locale is None:
1013+
catalog.locale = template.locale
10151014

10161015
for message in template:
10171016
if not message.id:
@@ -1024,13 +1023,15 @@ def run(self):
10241023
if message_count > self.more_than and (self.less_than is None or message_count < self.less_than):
10251024
catalog[message.id] = message
10261025

1026+
catalog.fuzzy = any(message.fuzzy for message in catalog)
10271027
with open(self.output_file, 'wb') as outfile:
10281028
write_po(
10291029
outfile,
10301030
catalog,
10311031
width=self.width,
10321032
sort_by_file=self.sort_by_file,
10331033
sort_output=self.sort_output,
1034+
no_location=self.no_location,
10341035
)
10351036

10361037

@@ -1060,7 +1061,6 @@ class MessageMerge(CommandMixin):
10601061
('force-po', None, ''),
10611062
('indent', 'i', ''),
10621063
('no-location', None, ''),
1063-
('add-location', 'n', ''),
10641064
('strict', None, ''),
10651065
('properties-output', None, ''),
10661066
('stringtable-output', None, ''),
@@ -1085,7 +1085,6 @@ class MessageMerge(CommandMixin):
10851085
'force-po',
10861086
'indent',
10871087
'no-location',
1088-
'add-location',
10891088
'strict',
10901089
'properties-output',
10911090
'stringtable-output',
@@ -1127,7 +1126,6 @@ def initialize_options(self):
11271126
self.force_po = None
11281127
self.indent = None
11291128
self.no_location = None #
1130-
self.add_location = None
11311129
self.strict = None
11321130
self.properties_output = None
11331131
self.stringtable_output = None
@@ -1175,11 +1173,13 @@ def run(self):
11751173
catalog.obsolete[message.id] = current.clone()
11761174

11771175
current.string = message.string
1178-
current.flags = [flag for flag in current.flags if flag != 'fuzzy']
1176+
if current.fuzzy:
1177+
current.flags.remove('fuzzy')
11791178

11801179
if not self.no_compendium_comment:
11811180
current.auto_comments.append(self.compendium)
11821181

1182+
catalog.fuzzy = any(message.fuzzy for message in catalog)
11831183
output_path = def_file if self.update else self.output_file
11841184
with open(output_path, 'wb') as outfile:
11851185
write_po(

0 commit comments

Comments
 (0)