@@ -92,6 +92,8 @@ pub struct MessageBuilder<'a> {
9292 options : & ' a LinguiOptions ,
9393 elements_tracking : Vec < ( String , JSXOpeningElement ) > ,
9494 element_index : usize ,
95+ // Counter for auto-generated numeric placeholders
96+ numeric_index : usize ,
9597}
9698
9799impl < ' a > MessageBuilder < ' a > {
@@ -105,6 +107,7 @@ impl<'a> MessageBuilder<'a> {
105107 options,
106108 elements_tracking : Vec :: new ( ) ,
107109 element_index : 0 ,
110+ numeric_index : 0 ,
108111 } ;
109112
110113 builder. process_tokens ( tokens) ;
@@ -292,6 +295,12 @@ impl<'a> MessageBuilder<'a> {
292295 }
293296 }
294297
298+ fn next_numeric_index ( & mut self ) -> String {
299+ let index = self . numeric_index . to_string ( ) ;
300+ self . numeric_index += 1 ;
301+ index
302+ }
303+
295304 fn push_exp ( & mut self , mut exp : Box < Expr > ) -> String {
296305 exp = expand_ts_as_expr ( exp) ;
297306
@@ -334,7 +343,7 @@ impl<'a> MessageBuilder<'a> {
334343 }
335344
336345 // fallback for {...spread} or {}
337- let index = self . values_indexed . len ( ) . to_string ( ) ;
346+ let index = self . next_numeric_index ( ) ;
338347
339348 self . values_indexed . push ( ValueWithPlaceholder {
340349 placeholder : index. clone ( ) ,
@@ -344,7 +353,7 @@ impl<'a> MessageBuilder<'a> {
344353 index
345354 }
346355 _ => {
347- let index = self . values_indexed . len ( ) . to_string ( ) ;
356+ let index = self . next_numeric_index ( ) ;
348357
349358 self . values_indexed . push ( ValueWithPlaceholder {
350359 placeholder : index. clone ( ) ,
0 commit comments