Skip to content

Commit 2dababc

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 7228cea commit 2dababc

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
@@ -875,7 +875,6 @@ class MessageConcatenation(CommandMixin):
875875
('force-po', None, ''),
876876
('indent', 'i', ''),
877877
('no-location', None, ''),
878-
('add-location', 'n', ''),
879878
('strict', None, ''),
880879
('properties-output', None, ''),
881880
('stringtable-output', None, ''),
@@ -896,7 +895,6 @@ class MessageConcatenation(CommandMixin):
896895
'force-po',
897896
'indent',
898897
'no-location',
899-
'add-location',
900898
'strict',
901899
'properties-output',
902900
'stringtable-output',
@@ -929,8 +927,7 @@ def initialize_options(self):
929927
self.escape = None
930928
self.force_po = None
931929
self.indent = None
932-
self.no_location = None
933-
self.add_location = None
930+
self.no_location = None #
934931
self.strict = None
935932
self.properties_output = None
936933
self.stringtable_output = None
@@ -971,12 +968,14 @@ def _prepare(self):
971968
self.message_count[message.id] += 1
972969

973970
def run(self):
974-
catalog = Catalog()
971+
catalog = Catalog(fuzzy=False)
975972
self._prepare()
976973

977974
for filename in self.input_files:
978975
with open(filename, 'r') as pofile:
979976
template = read_po(pofile)
977+
if catalog.locale is None:
978+
catalog.locale = template.locale
980979

981980
for message in template:
982981
if not message.id:
@@ -989,13 +988,15 @@ def run(self):
989988
if message_count > self.more_than and (self.less_than is None or message_count < self.less_than):
990989
catalog[message.id] = message
991990

991+
catalog.fuzzy = any(message.fuzzy for message in catalog)
992992
with open(self.output_file, 'wb') as outfile:
993993
write_po(
994994
outfile,
995995
catalog,
996996
width=self.width,
997997
sort_by_file=self.sort_by_file,
998998
sort_output=self.sort_output,
999+
no_location=self.no_location,
9991000
)
10001001

10011002

@@ -1025,7 +1026,6 @@ class MessageMerge(CommandMixin):
10251026
('force-po', None, ''),
10261027
('indent', 'i', ''),
10271028
('no-location', None, ''),
1028-
('add-location', 'n', ''),
10291029
('strict', None, ''),
10301030
('properties-output', None, ''),
10311031
('stringtable-output', None, ''),
@@ -1050,7 +1050,6 @@ class MessageMerge(CommandMixin):
10501050
'force-po',
10511051
'indent',
10521052
'no-location',
1053-
'add-location',
10541053
'strict',
10551054
'properties-output',
10561055
'stringtable-output',
@@ -1092,7 +1091,6 @@ def initialize_options(self):
10921091
self.force_po = None
10931092
self.indent = None
10941093
self.no_location = None #
1095-
self.add_location = None
10961094
self.strict = None
10971095
self.properties_output = None
10981096
self.stringtable_output = None
@@ -1140,11 +1138,13 @@ def run(self):
11401138
catalog.obsolete[message.id] = current.clone()
11411139

11421140
current.string = message.string
1143-
current.flags = [flag for flag in current.flags if flag != 'fuzzy']
1141+
if current.fuzzy:
1142+
current.flags.remove('fuzzy')
11441143

11451144
if not self.no_compendium_comment:
11461145
current.auto_comments.append(self.compendium)
11471146

1147+
catalog.fuzzy = any(message.fuzzy for message in catalog)
11481148
output_path = def_file if self.update else self.output_file
11491149
with open(output_path, 'wb') as outfile:
11501150
write_po(

0 commit comments

Comments
 (0)