Coder Social home page Coder Social logo

Comments (6)

pixelomo avatar pixelomo commented on May 21, 2024 19

There's a much simpler way to add translations for placeholders that the creator of jQuery i18n recommends

<input data-i18n="[placeholder]name" value="name">

and then in your translation.json file

"name" : "Name"

https://stackoverflow.com/questions/22728797/translate-custom-attributes-with-i18next-placeholder-value

from jquery.i18n.

santhoshtr avatar santhoshtr commented on May 21, 2024 3

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 $.i18n(messageKey, params) after setting the correct locale.

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' )
} );

from jquery.i18n.

hustcer avatar hustcer commented on May 21, 2024

Thanks a lot.

from jquery.i18n.

HusseinElGanzory avatar HusseinElGanzory commented on May 21, 2024

There's a much simpler way to add translations for placeholders that the creator of jQuery i18n recommends

<input data-i18n="[placeholder]name" value="name">

and then in your translation.json file

"name" : "Name"

https://stackoverflow.com/questions/22728797/translate-custom-attributes-with-i18next-placeholder-value

best and simple solution thanks

from jquery.i18n.

rene-guerrero avatar rene-guerrero commented on May 21, 2024

There's a much simpler way to add translations for placeholders that the creator of jQuery i18n recommends

<input data-i18n="[placeholder]name" value="name">

and then in your translation.json file

"name" : "Name"

https://stackoverflow.com/questions/22728797/translate-custom-attributes-with-i18next-placeholder-value

Save me lot of time 👍👍👍

from jquery.i18n.

JustineMiko avatar JustineMiko commented on May 21, 2024

There's a much simpler way to add translations for placeholders that the creator of jQuery i18n recommends
<input data-i18n="[placeholder]name" value="name">
and then in your translation.json file
"name" : "Name"
https://stackoverflow.com/questions/22728797/translate-custom-attributes-with-i18next-placeholder-value

Save me lot of time

Hi, i have tried this one but in my searchbar i can't write any entry after doing this :(

from jquery.i18n.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.