In this chapter, we discussed some important aspects of internalization and localization of projects based on the Dart language. The development of globalized software includes internationalization and covers designing and developing web applications, and localization that includes translating and customizing web applications for a specific locale.
The intl
package from the pub manager helps you design and develop applications for the server side and client side in a pretty straightforward manner. All the executable code must be separated from the programming code that implements the UI. You must avoid converting numbers and dates into strings directly because various cultures have different ways of presenting numbers and dates.
The NumberFormat
class contains special constructors to quickly create the frequently used patterns, which can be very handy to measure units and currencies. The BidiFormatter
class helps manage messages that contain text in both directions with the BiDi
wrapping, automatic directionality estimation, and character escaping. The DateFormat
class has a huge set of naming patterns that are useful to avoid mistakes and display data in the correct format. The internalization of messages is based on the lookup via the named localized version of messages and returns the translated messages, possibly those interpolated with a list of specified arguments.
The plural
method of the Intl
class can help use parentheses to combine the singular and the plural forms to one string. The gender
method of the Intl
class provides out-of-the-box support for gender-based selection. The select
method from the Intl
class helps format the message differently based on the available choice. The message
method of the Intl
class can represent messages as simple expressions with possibilities of interpolating them with attributes.
In the next chapter, we will show you how to properly organize client to server communication. You will find answers on presumably important questions about the right choice of Dart classes using the client-to-server communication.
3.145.66.94