Irrelon / jquery-lang-js

i18n Allow instant language switching on HTML pages without reloading the page.
https://www.irrelon.com
362 stars 132 forks source link

Concat translation #120

Closed CMonjo closed 4 years ago

CMonjo commented 5 years ago

Hi, How can i concat translated string ? I mean :

const customer = "Random name";
<p lang="en" data-lang-token="user">'Welcome' + customer + '!'<p>

On my json file : { "token": { "user": "Welcome !" } }

I had the idea to do like this { "token": { "user": "Welcome {variable} !" } }

But if I have to put two or more variables, how can I do it? I saw Irrelon, in 2014, say to use the window.lang.convert() function. But the convert function no longer exist.

Irrelon commented 4 years ago

Version 4.0.0 of the library (released today) includes this feature: https://github.com/Irrelon/jquery-lang-js#dynamic-data--template-strings