fabi1cazenave/webL10n

Add possibility to localize args

SunboX opened this issue · 1 comments

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>

ahh, got it working! 💃

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