QLocale::Language — traditional and simplified chinese?

独自空忆成欢 提交于 2019-12-13 05:49:25

问题


According to:

http://doc.qt.io/qt-5/qlocale.html

there is only one language for Chinese: QLocale::Chinese (value: 25). How to differentiate between traditional and simplified Chinese?


回答1:


it's not about country. it's about script:

QLocale::setDefault(QLocale(QLocale::Chinese, QLocale::SimplifiedChineseScript)); QLocale::setDefault(QLocale(QLocale::Chinese, QLocale::TraditionalChineseScript));




回答2:


You should use an alternative method by locale name. This:

QLocale chiness("zh"); // for Chinese
QLocale chiness("zh_Hans"); // for Simplified Chinese
QLocale chiness("zh_Hant"); // for Traditional Chinese



回答3:


How about

QLocale::setDefault(QLocale(QLocale::Chinese, QLocale::China));  // Simplified Chinese
QLocale::setDefault(QLocale(QLocale::Chinese, QLocale::Taiwan)); // Traditional Chinese

You can set the country with the second parameter.



来源:https://stackoverflow.com/questions/36345709/qlocalelanguage-traditional-and-simplified-chinese

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!