首页›Stefan Judis›文章

Intl can localize units, too! (#tilPost)

Stefan Judis · 2026年4月5日

AI 摘要 AI 生成,可能有误

The author shares a today-I-learned tip that JavaScript's built-in Intl.NumberFormat can format numbers with currencies and units, localized per locale. Examples show EUR formatting in German, JPY in Japanese, km/h in Portuguese, and kilobytes in French, including details like currency symbol placement and translated unit names. The takeaway is to avoid writing custom userland JavaScript for currency/unit formatting since it's already baked into the language.

Today I learned that Intl allows you to format numbers with currencies or units!

Did you notice how the Japanese Yen symbol (¥) moved in front of the numbers? Or that, apparently, French folks translate the unit kilobyte? Fun!

Whenever you put currency/unit logic into userland JavaScript, don't. It's all baked into the language these days.

继续阅读全文

为了尊重作者,这里只展示开头几段。你可以去原文阅读,或者在 HorizonReader 里读:划线做笔记、让 AI 帮忙。

更多来自 Stefan Judis

Web Weekly #204 (#blogPost)

AI 摘要Web Weekly #204 is a developer newsletter covering recent web platform news, including Firefox 161 shipping CSS Typed Object Model into Baseline, Microsoft working on CSS mixins for Chromium, Chrome's interestfor attribute adoption status, and Node.js abort signals for incoming requests. It also discusses the State of JS survey, an Open Web Advocacy petition urging Apple to open iOS to other browser engines under the DMA, compression dictionaries, and useful UI components from Vercel. The issue wraps up with a song recommendation, sponsor segment, community project highlights, and a reflection on the gap between the software humans could build versus what they actually build.

Web Weekly #203 (#blogPost)

AI 摘要Web Weekly #203 is a newsletter edition covering web development topics, including cross-browser support for scroll-driven animations, the CSS scroll-target-group property for scroll spy, and new fonts like Allo, Paper Mono, and Ductus. It also discusses concerns about missing MDN documentation for new browser features, the negative web performance impact of AI-generated sites, Google's Modern Web Guidance 1.0, and newly available features like the revert-rule CSS value and Intl.Segmenter. The issue rounds out with recommended tools and projects, a sponsor message, and a community song pick.

Knowember 2026 (#blogPost)

AI 摘要In this 'Knowember' post, the author shares their newly discovered passion for long-distance cycling, including participation in multiple 200km+ events such as the Berlin bike marathon. They reveal they have lived in Berlin, Germany for nearly twenty years, and mention that their blog, once focused on tech and frontend topics, may open up to any subject they feel like writing about.

Web Weekly #202 (#blogPost)

AI 摘要Web Weekly #202 is an indie newsletter roundup of web development news, headlined by Geoff Graham buying back CSS-Tricks from DigitalOcean and featuring topics like JPEG XL vs. AVIF, Safari's new adaptive dark mode, and the newly baseline-available ariaNotify. It also collects practical tips and resources, including modern FLIP animations with @property, workarounds for flex-wrap: balance, the Navigation API, the :state() pseudo-class, and various tools and projects. The issue closes with a manifesto against AI slop and a reflection that successful developers are those whose output others genuinely value.

Blake Watson on the state of the industry (#note)

AI 摘要The article discusses Blake Watson's conflicted feelings about AI in software development: he is excited to build things he never could before, but fears his hard-earned skills are becoming worthless and that he may be replaceable if prompting an AI is all the job requires. The author strongly agrees, noting that AI coding tools have advanced dramatically and 'personal software' is now real, while also sharing the same ambivalence—alternating between anxiety about being replaced and hope that everything will work out. Both conclude with the wish that Blake's optimism proves correct despite the unsettling changes in the industry.