Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
"i18nice" is an internationalization library written in JavaScript. It provides a simple and easy way to handle i18n (interpolation,plural)."i18nice" has zero dependencies.
It is licensed under MIT license.
https://riversun.github.io/i18nice/index.html
clone this project and type as follows
npm start
You can import standalone js into your front-end app on the browser with <script> tag.
https://raw.githubusercontent.com/riversun/i18nice/master/dist/i18nice.js
npm install i18nice
First, create an instance of the i18nice
class, which you will use for translation.
var i18n = new i18nice();
i18nice.t() provides translation.
i18n.init({
en: {
hello: "Hello.",
},
ja: {
hello: "こんにちは。",
}
});
i18n.setLocale("en");
i18n.t("hello");
=> "Hello."
i18n.setLocale("ja");
i18n.t("hello");
=> "こんにちは。"
i18nice.t() also provides interpolation.
i18n.init({
en: {
hello: "Hi,#{user1}.",
},
ja: {
hello: "#{user1}さん、こんにちは。",
}
});
i18n.setLocale("en");
i18n.t("hello", {user1:"Tom"});
=>"Hi,Tom!"
i18n.init({
en: {
hello: "Hi,#{user1}.Come into the #{ordinal} room.",
ordinal:["first","second","third"],
},
ja: {
hello: "#{user1}さん、こんにちは。#{ordinal}のお部屋にお入りください",
ordinal:["1つめ","2つめ","3つめ"],
}
});
i18n.setLocale("en");
i18n.t("hello", {user1:"Tom",ordinal_index:1});
=>"Hi,Tom.Come into the second room."
i18n.init({
en: {
hello: "Hi,#{user1}.Come into the #{ordinal} room.",
ordinal:["first","second","third"],
},
ja: {
hello: "#{user1}さん、こんにちは。#{ordinal}のお部屋にお入りください",
ordinal:["1つめ","2つめ","3つめ"],
}
});
i18n.setLocale("en");
i18n.t("ordinal",{ordinal_index:1});
=>"first"
i18n.init({
en: {
hello: "Hi,#{user1}.Come into the #{ordinal} room.",
ordinal:["first","second","third"],
},
ja: {
hello: "#{user1}さん、こんにちは。#{ordinal}のお部屋にお入りください",
ordinal:["1つめ","2つめ","3つめ"],
}
});
i18n.setLocale("en");
i18n.t("ordinal");
=>["first","second","third"] // returns array itself
You can use ((case of single | case of multiple)) for pluralization.
i18n.init({
en: {
cars: "You have ((#{numCar} car|#{numCar} cars)).",
}
});
i18n.t("cars", {numCar:0});
=>"You have 0 cars."
i18n.t("cars", {numCar:1});
=>"You have 1 car."
i18n.t("cars", {numCar:2});
=>"You have 2 cars."
Also you can use ((case of zero | case of single | case of multiple)) for pluralization.
i18n.init({
en: {
cars: "You have ((no car|a car|#{numCar} cars)).",
}
});
i18n.t("cars", {numCar:0});
=>"You have no car."
i18n.t("cars", {numCar:1});
=>"You have a car."
i18n.t("cars", {numCar:2});
=>"You have 2 cars."
i18n.setFallback("en");
FAQs
Simple and easy i18n library
The npm package i18nice receives a total of 0 weekly downloads. As such, i18nice popularity was classified as not popular.
We found that i18nice demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.