ttag-org / ttag

:orange_book: simple approach for javascript localization
https://ttag.js.org/
MIT License
345 stars 44 forks source link

xgettext format compatibility #99

Closed AlexMost closed 6 years ago

AlexMost commented 6 years ago

For now, c-3po extracts expressions in ${ expr } form. There are also some tools that use { 0 } format (xgettext). There is a feature request to implement some kind of compatibility with xgettext - https://github.com/metabase/metabase/issues/6680#issuecomment-369546923 . What do you think? @vharitonsky @MrOrz @alxpy

tlrobinson commented 6 years ago

As a workaround I'm just running sed on the .pot file

sed -E 's/\$\{ *([0-9]+) *\}/{\1}/g'

and reversing it before compiling the .po files

sed -E 's/\{ *([0-9]+) *\}/${ \1 }/g'
AlexMost commented 6 years ago

https://ttag.js.org/docs/plugin-api.html#confignumberedexpressions