
Security News
Opengrep Adds Apex Support and New Rule Controls in Latest Updates
The latest Opengrep releases add Apex scanning, precision rule tuning, and performance gains for open source static code analysis.
jquery-i18next
Advanced tools
Source can be loaded via npm, bower or downloaded from this repo.
NEWS: localization as a service - locize.com
Needing a translation management? Want to edit your translations with an InContext Editor? Use the orginal provided to you by the maintainers of i18next!
With using locize you directly support the future of i18next and react-i18next.
If you don't use a module loader it will be added to window.jqueryI18next
# npm package
$ npm install jquery-i18next
# bower
$ bower install jquery-i18next
Simplifies i18next usage in projects built based on jquery, like:
page source:
<ul class="nav">
<li><a href="#" data-i18n="nav.home"></a></li>
<li><a href="#" data-i18n="nav.page1"></a></li>
<li><a href="#" data-i18n="nav.page2"></a></li>
</ul>
loaded resource file (locales/en/translation.json):
{
"nav": {
"home": "Home",
"page1": "Page One",
"page2": "Page Two"
}
}
javascript code:
$(".nav").localize();
// results in
// <ul class="nav">
// <li><a href="#" data-i18n="nav.home">Home</a></li>
// <li><a href="#" data-i18n="nav.page1">Page One</a></li>
// <li><a href="#" data-i18n="nav.page2">Page Two</a></li>
// </ul>
jqueryI18next.init(i18nextInstance, $, {
tName: 't', // --> appends $.t = i18next.t
i18nName: 'i18n', // --> appends $.i18n = i18next
handleName: 'localize', // --> appends $(selector).localize(opts);
selectorAttr: 'data-i18n', // selector for translating elements
targetAttr: 'i18n-target', // data-() attribute to grab target element to translate (if diffrent then itself)
optionsAttr: 'i18n-options', // data-() attribute that contains options, will load/set if useOptionsAttr = true
useOptionsAttr: false, // see optionsAttr
parseDefaultValueFromContent: true // parses default values from content ele.val or ele.text
});
<a id="btn1" href="#" data-i18n="myKey"></a>
$("#btn1").localize(options);
or
<a id="btn1" href="#" data-i18n="myKey" data-i18n-options='{ "a": "b" }'></a>
$("#btn1").localize();
data-i18n-options
attribute must be a valid JSON object.
<a id="btn1" href="#" data-i18n="myKey"></a>
$("#btn1").localize(options);
myKey: same key as used in i18next (optionally with namespaces) options: same options as supported in i18next.t
<ul class="nav">
<li><a href="#" data-i18n="nav.home"></a></li>
<li><a href="#" data-i18n="nav.page1"></a></li>
<li><a href="#" data-i18n="nav.page2"></a></li>
</ul>
$(".nav").localize();
<div class="outer" data-i18n="ns:key" data-i18n-target=".inner">
<input class="inner" type="text"></input>
</div>
$(".outer").localize();
<a id="btn1" href="#" data-i18n="[title]key.for.title"></a>
$("#btn1").localize();
<a id="btn1" href="#" data-i18n="[title]key.for.title;myNamespace:key.for.text"></a>
$("#btn1").localize();
<a id="btn1" href="#" data-i18n="[html]key.for.title"></a>
$("#btn1").localize();
<a id="btn1" href="#" data-i18n="[prepend]key.for.title">insert before me, please!</a>
$("#btn1").localize();
<a id="btn1" href="#" data-i18n="[append]key.for.title">append after me, please!</a>
$("#btn1").localize();
<a id="btn1" href="#" data-i18n="[data-someDataAttribute]key.for.content"></a>
$("#btn1").localize();
FAQs
i18next plugin for jquery usage
The npm package jquery-i18next receives a total of 15,186 weekly downloads. As such, jquery-i18next popularity was classified as popular.
We found that jquery-i18next demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The latest Opengrep releases add Apex scanning, precision rule tuning, and performance gains for open source static code analysis.
Security News
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
Research
/Security News
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.