@@ -264,7 +264,6 @@ def _replace_translations(self, template, stringset, is_real_stringset):
264
264
self .stringset = stringset
265
265
self .stringset_index = 0
266
266
267
- self .depth = 0
268
267
self .metadata_blocks = []
269
268
270
269
parsed = DumbJson (template )
@@ -279,8 +278,7 @@ def _insert(self, parsed, is_real_stringset):
279
278
elif parsed .type == list :
280
279
return self ._insert_from_list (parsed , is_real_stringset )
281
280
282
- def _insert_item (self , value , value_position , is_real_stringset , key_position = 0 ):
283
-
281
+ def _insert_item (self , value , value_position , is_real_stringset ):
284
282
at_least_one = False
285
283
286
284
if isinstance (value , (six .binary_type , six .text_type )):
@@ -320,14 +318,10 @@ def _insert_item(self, value, value_position, is_real_stringset, key_position=0)
320
318
self ._insert_regular_string (value , value_position , "" , False )
321
319
322
320
elif isinstance (value , DumbJson ):
323
- self .depth += 1
324
- if self .depth == 1 :
325
- self .metadata_blocks .append ((key_position - 1 , value .end + 1 ))
326
321
items_still_left = self ._insert (value , is_real_stringset )
327
322
328
323
if not items_still_left :
329
324
self ._copy_until_and_remove_section (value .end + 1 )
330
- self .depth -= 1
331
325
else :
332
326
at_least_one = True
333
327
@@ -355,7 +349,7 @@ def _insert_from_dict(self, parsed, is_real_stringset):
355
349
self .transcriber .mark_section_start ()
356
350
357
351
tmp_at_least_one = self ._insert_item (
358
- value , value_position , is_real_stringset , key_position
352
+ value , value_position , is_real_stringset
359
353
)
360
354
361
355
if tmp_at_least_one :
@@ -630,24 +624,7 @@ def compile(self, template, stringset, language_info=None, **kwargs):
630
624
for openstring in stringset
631
625
]
632
626
new_template = self ._replace_translations (template , fake_stringset , False )
633
- num_of_mdb = len (self .metadata_blocks )
634
- while num_of_mdb > 0 :
635
- idx = num_of_mdb - 1
636
- new_template = "{}{}" .format (
637
- new_template [: self .metadata_blocks [idx ][0 ]],
638
- new_template [self .metadata_blocks [idx ][1 ] :],
639
- )
640
- num_of_mdb -= 1
641
-
642
- # Remember whether the root JSON ends with "}" on a separate line
643
- closed_on_new_line = new_template [new_template .rfind ("}" ) - 1 ] == "\n "
644
-
645
627
new_template = self ._clean_empties (new_template )
646
- end_of_root_json = new_template .rfind ("}" )
647
- if closed_on_new_line and new_template [end_of_root_json - 1 ] != "\n " :
648
- new_template = "{}{}{}" .format (
649
- new_template [:end_of_root_json ], "\n " , new_template [end_of_root_json :]
650
- )
651
628
652
629
if language_info is not None :
653
630
match = re .search (r"(\"@@locale\"\s*:\s*\")([A-Z_a-z]*)\"" , new_template )
0 commit comments