We're getting .arb files using ICU syntax that we cannot parse with regular expressions, these include different syntaxes like these three examples below:
({carsCount} {carsCount, plural, =1{car} other{cars}})
The translatable content would be:
car
cars
{nCars,plural, =1{{nCars} car} other{{nCars} cars}}
The translatable content would be:
car
cars
{approved,plural, =0{No visitors} =1{{approved} visitor} other{{approved} visitors}}
The translatable content would be:
No visitors
visitor
visitors
Locking the above with pure regular expressions is complicated. Specially when you also have strings like this in the same file:
Read the {url}
In this example, the content between brackets is not translatable, which is the opposite of the examples above, making it almost impossible to use regular expressions only to parse the whole document.
It would be wonderful to have an ICU syntax embedded content processor that can be cascaded to the .json file type (which we use for .arb files).
More information:
Online ICU Message Editor - Localizely
Top Comments