Internationalization isn’t just translation. It’s about formatting dates, pluralizing words, sorting names, and more, all according to specific locales. Instead of relying on heavy third-party libraries, modern JavaScript offers the Intl API — a powerful, native way to handle i18n. A quiet reminder that the web truly is worldwide. It’s a common misconception that internationalization (i18n) is sim
JavaScript(ECMAScript)の国際化API、「Intl」について紹介する1人 Advent Calendar です。 2024末時点でのIntl仕様と提案されているProposalを広く紹介することをゴールとしています。合わせてIntlに関連する仕様についても端端で紹介できたらなと思っています。 機能・ドメイン的に関連する話題をまとめて紹介していくので、「既存仕様→関連するProposal」の順で繰り返す流れになる予定です。基本的な機能だけ知りたいよと言う方は適宜読み飛ばしてください。
Clean and readable - Keep your code clean and readable, while the library uses battle-tested and powerful ICU MessageFormat under the hood. Universal - Use it everywhere. @lingui/core provides the essential intl functionality which works in any JavaScript project while @lingui/react offers components to leverage React rendering, including React Server Components (RSC) support. The same extract-and
Stéphane Goetz (@onigoetz) is a performance enthusiast. Working on developer tooling, frontend libraries, and architecture as Principal Software Engineer at Swissquote Bank. Introduction I wish to bring you with me on a journey to learn about optimizing a library for localization, I would like to share my learnings with you on benchmarking, profiling, and optimizing. At Swissquote Bank, we use cli
This post is part of my Byte Series, where I document tips, tricks, and tools that I've found useful. ProblemWhen building a localized JavaScript web-app, the default sorting logic for strings doesn't quite yield the results that you might expect. For example, take the following example… let strings = [ "nop", "NOP", "ñop", "abc", "abc", "äbc" ]; strings.sort(); console.log(strings); // ['NOP', 'a
When you want to display a list of items to a user, I'm afraid .join(', ') just won't cut it: console.log(['apple'].join(', ')) // apple // looks good console.log(['apple', 'grape'].join(', ')) // apple, grape // nah, I want "apple and grape" console.log(['apple', 'grape', 'pear'].join(', ')) // apple, grape, pear // wut? Ok, so bust out your string concat skills right? That's what I did... but ho
Asymmetric Localization Natural-sounding translations with genders and grammatical cases only when necessary. Expressiveness is not limited by the grammar of the source language. Progressive Enhancement Translations are isolated; locale-specific logic doesn't leak to other locales. Authors can iteratively improve translations without impact on other languages. Fully-Featured Date, time, and number
Number#toFixed や Math.round/floor/ceil を駆使して表示用の値を整形することってないでしょうか。カンマ区切りをオレオレユーティリティ関数で実装したりそういったことを実現するライブラリを探したことはないでしょうか。 ほとんどの JavaScript の実行環境にはIntlという i18n のためのオブジェクトが組み込まれており、その中の1つにIntl.NumberFormatというクラスがあります。 オプションが色々あり、かなり便利で多機能なんですが整理された情報が少なく、身の回りで使用してる人も少ないと感じました。 Do you use Intl.NumberFormat? — れこ (@L_e_k_o) February 25, 2019 (2019/03/04あたりに結果表示されると思います。途中経過を見る場合元ツイートに飛んでください。) 「それ自
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く