They aren’t just for dominating a game of Scrabble, localization & internationalization refer to the process of making a product feel at home in

Understanding International Numbers & Currency

submited by
Style Pass
2024-09-05 02:30:03

They aren’t just for dominating a game of Scrabble, localization & internationalization refer to the process of making a product feel at home in a different country.

Showing a currency in the wrong local format is a dead give-away: you’ve put in no effort. If you can’t format a price, how could you handle shipping?

Internationalization is a big topic, covering everything from text translation to date formatting. In this post we’ll focus in on a particular subtopic, formatting numbers and currency.

Chaos! Right? There are symbols, whitespace and punctuation flying all over! It’s amazing the EU can agree on anything if they can’t agree on how to show Euros! 😅

Locales are (typically) set at the OS/Device level, and browsers make it available via navigator.language. Since every one of your users could have a different locale, it only makes sense to format numbers and currency on the client side.

Ok, good news! Modern programming languages have built-in support for this. In JavaScript, we have the Intl class and Intl.NumberFormat!

Leave a Comment