filaraujo / gulp-i18n-localize

localization plugin for gulp
MIT License
8 stars 5 forks source link

Using dynamic content #8

Open lchandelier opened 4 years ago

lchandelier commented 4 years ago

Hi,

I need to have a variable in the JSON file and replace it dynamically in the code like this example but it doesn't seem to work:

JSON: "users": "You have selected $1 people."

Code: ${{ myFile.users, 10}}

Expected result: You have selected 10 people.

How can it be implemented?

Thanks

filaraujo commented 4 years ago

it doesn't support interpolation of values. Your best bet is to create 2 values and construct it in markup

{
  "users": "You have selected",
  "people": "people"
}
${{ myFile.users}} 10 ${{ myFile.people }}`;
lchandelier commented 4 years ago

I thought about this solution as last resort. Do you plan or have an idea how to implement it?