C++ 中的 I18N 资源 [英] Resources for I18N in C++

查看:23
本文介绍了C++ 中的 I18N 资源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在玩 c++ 中的语言环境和 I18N 的东西,并且一直在寻找真实世界的例子.我已经阅读了 Josuttis 在他的 book (C++11 到第 2 版)中关于 I18N 的章节于 2012 年 4 月发布),并发现它很有用,但没有可借鉴的真实世界示例我不知道我是否遵循最佳实践正在犯初学者错误.StackOverflow 可以为我在网络上和印刷品上提供哪些资源来用 C++ 做 I18N 的事情?

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++?

还有哪些可用于 C++ 的库使 i18n 更容易?标准库中没有什么需要?乍一看,标准库中似乎不存在对 UTF8 的支持.

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.

在做了更多阅读之后,似乎 C 和 C++ 都是 Unicode不可知论".似乎还需要使用第三方库来处理以 Unicode/UTF8/16/32 编码的数据.关键在于标准库本身只考虑 ISO 8859 和相关字符页面,这些页面会根据您的语言环境设置而变化.这意味着我可能想将 ICU 库用于字符串,而不是使用 std::string 甚至 std::wstring.

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.

推荐答案

你已经被指向 GNU gettext,它允许您在运行时用本地化版本替换文字字符串 - 本地化的一个方面(这是在您完成国际化之后发生的事情,当有人在特定语言环境中实际使用您的国际化代码时).您还被指出了 Boost(特别是 Boost.Locale) 库;对于与 C++ 相关的任何事情,这通常是一个很好的答案.

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++.

您可能会看到的另一个地方是 ICU(Unicode 国际组件)项目.作为数据源,您可以将 CLDR(通用区域设置数据存储库)作为有关不同地区的信息;Unicode 网站还包含许多关于不同文化其他方面的信息,因为它涉及多种语言.

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.

这篇关于C++ 中的 I18N 资源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆