Internationalization

Most real projects have a target audience in multiple countries. The most notable difference between them is the spoken language, but there are other aspects some developers may not think of. For example, dot "." and comma "," are both fairly common as the decimal separator throughout the world. Date formats are also very different and incompatible, and using a wrong format (for example, mm/dd/yyyy instead of dd/mm/yyyy) will result in a completely different date.

Qt provides the QLocale class for dealing with locale-dependent operations, including conversions between numbers in strings. In the following code, text and number may have different values, depending on the system locale:

QLocale locale = QLocale::system(); ...

Get Game Programming using Qt 5 Beginner's Guide - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.