What’s today’s date? Is it 07/20/2023 or 20/07/2023? Or maybe it’s 2023/07/20? How many elePHPants do you want to buy? Is it 1,500 or 1.500? Will that be $30,000.00 or 30.000,00 $? We represent dates, times, numbers, and currency in a variety of ways, depending on where we are in the world, and writing software to accommodate these different formats can be scary. It’s worse when you find out you need to put these formatted values inside a translated string like, “Sign up before July 20th, and you’ll get 20% off the regular price of $30,000.” String concatenation and standard placeholders won’t work because different languages and regions follow different rules.
Fortunately, we have tools to make our jobs easier, and in this talk, we’ll take a look at FormatPHP and FormatJS, libraries designed to help with internationalization and localization of web applications. We’ll see how these libraries aid in formatting dates, times, numbers, and currency, as well as messages with plural conditions. We’ll learn how to format messages for translation, and by the end of this talk, you’ll know what a translation management system (TMS) is and how to extract strings from your application to send to your translators.