ttag-org / ttag

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

Use position number for expressions in babel-plugin-c-3po #97

Closed AlexMost closed 6 years ago

AlexMost commented 6 years ago

The global configuration option - useNumberedExpressions, that will use position number for expressions in translations instead of variable names. This option will allow using complex expressions inside translations like:

Option

name - useNumberedExpressions default value - false

configuration

{ "useNumberedExpressions": true } 

Example extract

t`Hello ${ getUserName() }`

will be extracted to

msgid: "Hello ${ 0 }"
msgstr: ""

Example resolve

t`Hello ${ getUserName() }`
msgid: "Hello ${ 0 }"
msgstr: "Привет ${ 0 }"

will be resolved to:

`Привет ${ getUserName() }`

Roadmap

Prerequisite for this issue https://github.com/c-3po-org/c-3po/issues/95

AlexMost commented 6 years ago

this task is already done and available in the preminor version of plugin 0.8.0-0 for test.