-
Notifications
You must be signed in to change notification settings - Fork 143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can I use i18n for DOM attrs like title or placeholder? #65
Comments
The jQuery plugin function $.fn.i18n() updates only the text value of the DOM node. It is convenient shortcut for that purpose. But as you said, there will be lot of other places you need a message in certain language. There you need to use In your case it will be like var i18n = $.i18n();
i18n.locale = 'de'; //set the locale
$( 'div.content > input' ).prop( {
placeholder: $.i18n( 'appname-placeholder' ),
title: $.i18n( 'appname-title' )
} ); |
Thanks a lot. |
There's a much simpler way to add translations for placeholders that the creator of jQuery i18n recommends
and then in your translation.json file
|
best and simple solution thanks |
Save me lot of time 👍👍👍 |
Hi, i have tried this one but in my searchbar i can't write any entry after doing this :( |
Can I use i18n for DOM attrs like title or placeholder without using JS to change it's attribute? for example:
How can I use:
To update the translated messages for placeholder or title?
The text was updated successfully, but these errors were encountered: