I'm playing around with the locale and I18N stuff in c++ and have been looking for real world examples. I've read through the Josuttis chapter on I18N in his book (2nd Edition for C++11 to be released April 2012), and found it useful but with no real world examples to draw from I've no idea if I'm following best practices are committing beginner mistakes. What resources can StackOverflow point me towards both on the web and in print for doing I18N stuff in C++?
Also what libraries are available for C++ that makes i18n easier? What's not in the standard library that needs to be? At first glance, it seems that UTF8 support doesn't exist in the standard library.
Edit:
After doing some more reading, it seems that C and C++ are both Unicode "agnostic". It also seems that for dealing with data encoded in Unicode/UTF8/16/32 one needs to use a third party library. The crux of this is that the standard library itself only thinks about ISO 8859 and related character pages, which change based on what you're locale is set to. That means I probably want to use the ICU library for strings rather than using std::string
or even std::wstring
.
I18n frameworks are third-party code packages used to simplify internationlization and localization for various development platforms. With i18n frameworks, developers can add i18n and l10n features to applications without making too many changes to existing code.
Internationalization (sometimes shortened to "I18N , meaning "I - eighteen letters -N") is the process of planning and implementing products and services so that they can easily be adapted to specific local languages and cultures, a process called localization .
Internationalization (i18n) is an essential part of global software development and needs to be integrated into your workflow from the very beginning. Akio Morita, Sony's co-founder, coined a phrase that's the mantra of some of the most successful entrepreneurs: “Think globally, act locally.”
In computing, internationalization and localization (American) or internationalisation and localisation (British English), often abbreviated i18n and L10n, are means of adapting computer software to different languages, regional peculiarities and technical requirements of a target locale.
You've been pointed to GNU gettext, which allows you to replace literal strings with localized versions at run time - one aspect of localization (which is what happens after you've done the internationalization, when someone actually uses your internationalized code in a specific locale). You've also been pointed to the Boost (in particular Boost.Locale) libraries; that is usually a good answer for anything related to C++.
Another place you might look is the ICU (International Components for Unicode) project. And as a source of data, you might look at the CLDR (Common Locale Data Repository) as a source of information about different locales; the Unicode web site also has lots of information about other aspects of different cultures because it deals with many languages.
And as a final resource for now, a rather specialized one, there is the Olson Time Zone database, which is updated multiple times each year to keep track of the way different countries change their rules on when to change between winter and summer (daylight saving and standard) time.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With