fabi1cazenave / webL10n

Client-side internationalization / localization library
http://fabi1cazenave.github.com/webL10n/
279 stars 71 forks source link

Add possibility to localize args #43

Closed SunboX closed 10 years ago

SunboX commented 10 years ago

locales.ini

emailFieldName = E-Mail
emptyFieldMessage = Plaese fill out the "{{ fieldName }}" field!

HTML

<span data-l10n-id="emptyFieldMessage" data-l10n-args="{ fieldName: THIS SHOULD BE REPLACED WITH TRANSLATED emailFieldName  }"></span>
SunboX commented 10 years ago

ahh, got it working! :dancer:

var p = document.createElement('p');
p.setAttribute('data-l10n-id', 'emptyFieldMessage');
p.setAttribute('data-l10n-args', '{ "fieldName": "{{ emailFieldName }}" }');