Help
RSS
API
Feed
Maltego
Contact
Domain > i18njs.com
×
More information on this domain is in
AlienVault OTX
Is this malicious?
Yes
No
DNS Resolutions
Date
IP Address
2025-04-25
3.5.164.38
(
ClassC
)
2025-07-01
3.5.164.228
(
ClassC
)
2025-09-20
3.5.165.13
(
ClassC
)
2025-09-22
3.5.169.242
(
ClassC
)
2025-09-28
3.5.167.219
(
ClassC
)
2025-10-21
3.5.165.22
(
ClassC
)
2026-01-06
3.5.167.237
(
ClassC
)
Port 80
HTTP/1.1 200 OKx-amz-id-2: WNygOVQGgfkpY3tHmonseQxyyYd+WCffN+U+ISu3svf6bIxoHXnsEYl5CvNvjUmAHLIN2Zkas2Ux-amz-request-id: MK9EAY9M5R3SEG5GDate: Tue, 06 Jan 2026 09:49:50 GMTLast-Modified: Thu, 03 Sep 2020 04:37:20 GMTETag: 74afc114d7cca01bc40149ec596b1390Content-Type: text/htmlContent-Length: 17194Server: AmazonS3 !doctype html>html langen>head> !-- S3 Version --> meta charsetutf-8> meta http-equivX-UA-Compatible contentIEedge,chrome1> title>i18n/title> meta namedescription contentSimple i18n for JavaScript Apps> meta nameauthor contentSimon Rodwell> meta nameviewport contentwidthdevice-width,initial-scale1> style> html { font-size: 100%; } body { font-family: Helvetica Neue, Helvetica, Arial, sans-serif; background-color: #B69F80; color: #453116; font-weight: 300 } h1, h2, h3 { margin: 0px; font-weight: 100; text-align: right; } h1 { color: #6A5840; font-size: 112px; font-weight: 600; text-align: left; } h2 { font-size: 35px; } .container { width: 100%; max-width: 900px; margin: 0px auto; } .menu { width: 220px; position: fixed; } .menu a { display: block; text-decoration: none; font-size: 20px; line-height: 30px; font-weight: 200; color: #6A5840; } .hr { width: 100%; height: 1px; background-color: #6A5840; margin: 15px 0px; } .panel, code { background-color: #DCD4C9; padding: 20px; display: block; border: 1px solid #6A5840; box-shadow: 1px 1px 10px rgba(0, 0, 0, 0.3); font-family: monospace; } .content { float: right; width: 620px; margin: 30px 0px; } code .keyword { font-weight: 600; } code .string, code .regexp { color: #CC9900; } code .class, code .special { color: #453116; } code .number { color: #FF6633; } code .comment { color: #999999; } /style> script srcjs/i18n.js>/script> script typetext/javascript> function handleLoad(){ i18n.add({ values:{ Yes: Yes, No: No }, contexts: { matches:{ gender:male }, values:{ %{name} updated their profile:%{name} updated his profile, %{name} uploaded %n photos to their %{album} album: 0, 0, %{name} uploaded %n photos to his %{album} album, 1, 1, %{name} uploaded %n photo to his %{album} album, 2, null, %{name} uploaded %n photos to %{album} his album } }, { matches:{ gender:female }, values:{ %{name} updated their profile:%{name} updated her profile, %{name} uploaded %n photos to their %{album} album: 0, 0, %{name} uploaded %n photos to her %{album} album, 1, 1, %{name} uploaded %n photo to her %{album} album, 2, null, %{name} uploaded %n photos to her %{album} album } } })console.log(i18n(%{name} updated their profile, { name:John }, { gender:male}));console.log(i18n(%{name} uploaded %n photos to their %{album} album, 1, { name:John, album:Bucks Night }, { gender:male })); // -> John uploaded 1 photo to his albumconsole.log(i18n(%{name} uploaded %n photos to their %{album} album, 4, { name:Jane, album:Hens Night }, { gender:female })); // -> Jane uploaded 4 photos to her album } /script>/head>body onloadhandleLoad()> div classcontainer> div classmenu> h1>i18n/h1> div classhr>/div> a href#simples_case>The Simplest Case/a> a href#language_files>Language Files/a> a href#pluralisation>Pluralisation/a> a href#fun_with_pluralisation>Fun with Pluralisation/a> a href#formatting>Formatting/a> a href#contexts>Contexts/a> a href#all_together_now>All Together Now/a> a href#remind_me_why>Remind me... Why?/a> a href#a_note_on_keys>A Note on Keys/a> a href#multiple_languages>Multiple Languages/a> a href#extensions>Extensions/a> div classhr>/div> a hrefjs/i18n.js target_blank>Download Regular/a> a hrefjs/i18n.min.js target_blank>Minified/a> a hrefjs/i18n.amd.js target_blank>AMD Compliant/a> a hrefhttps://www.npmjs.com/package/roddeh-i18n target_blank>NPM/a> !-- a href#>Github/a> --> div classhr>/div> !-- a idja-link hrefjavascript:changeLanguage(ja);>日本語/a> a iden-link hrefjavascript:changeLanguage(en);>English/a> --> /div> div classcontent> a namesimples_case>h2>Simple i18n for JavaScript Apps/h2>/a> pre> code>// Adds data that is used to translatei18n.translator.add({ values:{ Hello: こんにちは }})// Then translate somethingi18n(Hello); // -> こんにちは /code> /pre> a namelanguage_files>h2>Language Files/h2>/a> p> In reality we define all of the translations in a separate JSON file that is loaded and passed to the i18n.add method. /p> p> Here is an example of what the JSON file might look like. /p> pre> code>{ values:{ Yes: はい, No: いいえ, Ok: Ok, Cancel: キャンセル }} /code> /pre> p> Then you can use your preffered method to load the JSON, pass it into i18n and away you go. /p> pre> code>// Load the JSON File$.ajax(ja.json).done(function(text){ // Parse it data JSON.parse(text); // Set the data i18n.translator.add(data); // Translate away i18n(Yes); // -> はい i18n(No); // -> いいえ}) /code> /pre> a namepluralisation>h2>Pluralisation/h2>/a> p> Pluralisation is how we take care of all the funny rules langauges have when talking about a number of things. /p> p> Even if you are not translating your application, i18n can help you make the English on your site sound more natural. /p> pre> code>{ values:{ %n comments: 0, 0, %n comments, 1, 1, %n comment, 2, null, %n comments }} /code> /pre> p> Instead of just supplying a single translation we supply a series of translations. As we supply each translation we supply the range which tells i18n when to use it. /p> pre> code>i18n(%n comments, 0); // -> 0 commentsi18n(%n comments, 1); // -> 1 commenti18n(%n comments, 2); // -> 2 comments /code> /pre> p> Notice that the keys passed in for each of the above examples are identical. /p> p> In Japanese it is all the same so we only need to provide single entry. /p> pre> code>{ values:{ %n comments: 0, null, %n コメント }} /code> /pre> pre> code>i18n(%n comments, 0); // -> 0 コメントi18n(%n comments, 1); // -> 1 コメントi18n(%n comments, 2); // -> 2 コメント /code> /pre> a namefun_with_pluralisation>h2>Fun with Pluralisation/h2>/a> p> You can also do more creative things with pluralisation /p> pre> code>{ values:{ Due in %n days: null, -2, Due -%n days ago, -1, -1, Due Yesterday, 0, 0, Due Today, 1, 1, Due Tomorrow, 2, null, Due in %n days }} /code> /pre> pre> code>i18n(Due in %n days, 2); // -> Due in 2 daysi18n(Due in %n days, 1); // -> Due Tomorrowi18n(Due in %n days, 0); // -> Due Todayi18n(Due in %n days, -1); // -> Due Yesterdayi18n(Due in %n days, -2); // -> Due 2 days ago /code> /pre> a nameformatting>h2>Formatting/h2>/a> p> Sometimes you want to mix variables into the text you are translating. /p> pre> code>i18n(Welcome %{name}, { name:John }); // -> Welcome John /code> /pre> p> Just pass in a formatting object with the keys matching the replacements. /p> a namecontexts>h2>Contexts/h2>/a> p> And then there will be times when you want to pass in extra information to be used when translating. A common example is working with genders. /p> pre> code>{ values:{ Yes: Yes, No: No }, contexts: { matches:{ gender:male }, values:{ %{name} updated their profile: %{name} updated his profile } }, { matches:{ gender:female }, values:{ %{name} updated their profile: %{name} updated her profile } } } /code> /pre> p> And then to use the context... /p> pre> code>i18n(%{name} updated their profile, { name:John }, { gender:male }); // -> John updated his profilei18n(%{name} updated their profile, { name:Jane }, { gender:female }); // -> Jane updated her profile /code> /pre> a nameall_together_now>h2>All Together Now/h2>/a> p> And of course, you can combine all of these concepts to achieve very sophisticated translation. /p> pre> code>{ values:{ Yes: Yes, No: No }, contexts: { matches:{ gender:male }, values:{ %{name} uploaded %n photos to their %{album} album: 0, 0, %{name} uploaded %n photos to his %{album} album, 1, 1, %{name} uploaded %n photo to his %{album} album, 2, null, %{name} uploaded %n photos to his %{album} album } }, { matches:{ gender:female }, values:{ %{name} uploaded %n photos to their %{album} album: 0, 0, %{name} uploaded %n photos to her %{album} album, 1, 1, %{name} uploaded %n photo to her %{album} album, 2, null, %{name} uploaded %n photos to her %{album} album } } } /code> /pre> pre> code>i18n(%{name} uploaded %n photos to their %{album} album, 1, { name:John, album:Bucks Night }, { gender:male }); // -> John uploaded 1 photo to his Bucks Night albumi18n(%{name} uploaded %n photos to their %{album} album, 4, { name:Jane album:Hens Night }, { gender:female }); // -> Jane uploaded 4 photos to her Hens Night album /code> /pre> a nameremind_me_why>h2>Remind me... Why?/h2>/a> p> So, that may look like a lot of work for a bit of string concatenation. At this point let me remind you of the original objective of i18njs -> internationalisation. /p> p> So, here is the equivalent Japanese language file. /p> pre> code>{ values:{ Yes: はい, No: いいえ }, contexts: { matches:{ gender:male }, values:{ %{name} uploaded %n photos to their %{album} album: 0, 0, %{name}は彼の%{album}アルバムに写真%n枚をアップロードしました } }, { matches:{ gender:female }, values:{ %{name} uploaded %n photos to their %{album} album: 0, 0, %{name}は彼女の%{album}アルバムに写真%n枚をアップロードしました } } } /code> /pre> p> And then without changing any of our application code we get a beautifully translated sentence with pluralisation, formatting and context. /p> p> You may also notice that the word order in Japanese is completely different compared to English. This is why it is so important to use formatting rather than string concatenation. /p> pre> code>i18n(%{name} uploaded %n photos to their %{album} album, 1, { name:John, album:Bucks Night }, { gender:male }); // -> Johnは彼のBucks Nightアルバムに写真1枚をアップロードしましたi18n(%{name} uploaded %n photos to their %{album} album, 4, { name:Jane album:Hens Night }, { gender:female }); // -> Janeは彼女のHens Nightアルバムに写真4枚をアップロードしました /code> /pre> a namea_note_on_keys>h2>A Note on Keys/h2>/a> p> In all of the examples above I have used the actual English text as the keys for the translation. You dont have to do it this way. It is perfectly legitimate to do the following. /p> pre> code>{ values:{ loginFail: There was an error logging in, please check your email and password. }} /code> /pre> p> And then you would grab the translation like so. /p> pre> code>i18n(loginFail);// -> There was an error logging in, please check your email and password. /code> /pre> p> Advantages: ul> li>Shorter keys are easier to maintain./li> li>If the language in your application changes you dont have to update your keys./li> li>Shorter keys will perform faster when translating. Though for 99% of applications the difference in speed is insignificant/li> /ul> /p> p> You can also provide a default string in case the key can not be found. /p> pre> code>i18n(emailRequired, We require an email when signing up.);// -> We require an email when signing up. /code> /pre> a namemultiple_languages>h2>Multiple Languages/h2>/a> p> Sometimes you may want to have multiple languages working simultaneously. /p> p> You can create additional instances of i18n like so. /p> pre> code>en i18n.create({ values:{ Hello:Hello }})ja i18n.create({ values:{ Hello:こんにちは }})pt i18n.create({ values:{ Hello:Olá }}) /code> /pre> p> And then call /p> pre> code>en(Hello)// -> Helloja(Hello)// -> こんにちはpt(Hello)// -> Olá /code> /pre> p> This is particularly useful in a node environment when you will want to have all of the languages initialised and then simply select a particular language instance for each incoming request. /p> a nameextensions>h2>Extensions/h2>/a> p> In most cases the features above will suffice. But every now and then you will have more complex translation requirements. This is where extensions can help. The extension will be called when the value for a given key is an object. How you structure that object is entirely up to you. The expectation is that the extension will simply return a string that will then have the same formatting, context and pluralisation replacements applied to it. Extensions have the limitation of a single extension being available per instance of i18n. That is, each language may have its own extension, but a single language can only support one. /p> p> The following is an example of using extensions to handle the pluralisation rules for the Russian language. /p> pre> code>let ru i18n.create({ values:{ // Note, the value of the key %n results is an // object which will trigger the extension to be called. %n results:{ zero: нет результатов, one: %n результат, few: %n результата, many: %n результатов, other: %n результаты } })function getPluralisationKey(num) { if (!num) { return zero } if (num % 10 1 && num % 100 ! 11) { return one } if (2, 3, 4.indexOf(num % 10) > 0 && 12, 13, 14.indexOf(num % 100) 0) { return few } if (num % 10 0 || 5, 6, 7, 8, 9.indexOf(num % 10) > 0 || 11, 12, 13, 14.indexOf(num % 100) > 0) { return many } return other}function russianExtension(text, num, formatting, data){ let key getPluralisationKey(num) return datakey}ru.extend(russianExtension)ru(%n results, 0)// -> нет результатовru(%n results, 1)// -> 1 результатru(%n results, 11)// -> 11 результатовru(%n results, 11)// -> 4 результатаru(%n results, 101)// -> 101 результат /code> /pre> /div> /div> script srcjs/hijs.js>/script>/body>/html>
View on OTX
|
View on ThreatMiner
Please enable JavaScript to view the
comments powered by Disqus.
Data with thanks to
AlienVault OTX
,
VirusTotal
,
Malwr
and
others
. [
Sitemap
]