When I implemented support for traditional and simplified Chinese in my Android application, I wondered how it should work.
After reading the
documentation and some discussions like this one and this one, I learned Simplified Chinese in
and traditional Chinese in
Everything works well, but somehow it doesn’t make sense to me (sorry if I don’t understand the simplified use compared to the traditional Chinese use).
As far as I know, the user can change the locale to Simplified Chinese or Traditional Chinese in the local settings dialog in the emulator and on the headphones.
Here’s the question. How does the system know where to get simplified or traditional Chinese .xml channels? Is there a basic assumption that I need to show simplified Chinese from the value-j chain and traditional Chinese from the value-j-r-TV chain?
But what if the user is in HK and sets his device to Simplified Chinese? What if an expatriate, somewhere in the world, points his camera at traditional Chinese, but his region, for example, is the United States or California?
What should I do to ensure that my users set their location and that my application is displayed with the correct location?
After further research, I believe that the user of an Android phone cannot define the country separately from the language. You can only define a so-called locale in the user interface. It consists of language and country, but the list is limited, so many combinations are not possible.
For example, a Chinese person living in the United States who wants to use traditional Chinese could set the language to traditional Chinese (at least by phone) and then have the zh-rTW country. He couldn’t determine that his country was the United States. Similarly, an emigrant cannot associate his or her mother tongue with the country in which he or she currently lives….
This essentially means that only a few language and country combinations are supported. The question now is how we know what they are.
How can I solve this problem?
So I guess after further investigation and with Marx’s own reaction, I’ll give the answer. Let’s go, let’s go, let’s go, let’s go, let’s go:
Android has only two default locations: zh_rCN, which is simplified Chinese, and zh_rTW, which is traditional Chinese. As you can see in the program Settings, these are the only locations that are included:
However, any other Android system manufacturer, for example B. for a phone sold in China, change what they add. For a common, theoretically supported set, see the list of locations in the icu4c application:
As you can see, for the Chinese there are
Hunt is the ISO code for Traditional Chinese and Hunt is the ISO code for Simplified Chinese. So, theoretically, that would mean that we’d be
- Simplified Chinese in China, Hong Kong, Macao and Singapore.
- the traditional Chinese language in Hong Kong, Macao and Taiwan.
Note, however, that the application settings need to be changed in order to select different locations. So, at this point, simplified Chinese has been translated into zh_rCN and traditional zh_rTW, and you need to be separated for users who have a similar custom Android image that supports other locations.
In any case, you can at least use the Configuration class to get a locale, for example. For example, in your application class with getResources().getConfiguration().locale.
For example, you can save it and send the data to your tracking system (whatever system you use) or you can check if it is supported and make an exception with the local setting in a message that will appear in your market interface. However, this will at least mean a crash of your application (if you are in the loop, you can publish and update a few minutes later).
So, in a nutshell… The minimal configuration reflects what is done in the setup application (there is only zh-rCN and zh-rTW), but if you want to deliver standard language environments for Singapore, Hong Kong, Macau that traditionally deliver Chinese, you can do that too and it should work. However, I have no evidence that this configuration is being used anywhere.
I hope this helps.
The previous question and answers are quite old. It’s hard to say how good they still are. This answer is for other people who come here and just want to support traditional Chinese and simplified Chinese in their application, but don’t worry too much about the details of the field.
string.xml files for Traditional and Simplified Chinese
In Android Studio, right-click on the res folder and select New > Android Resource File. Enter the strings for the file name and select Local from the list.
Scroll down to zh for the tongue. Add a file to a line for CN : China (simplified) and one for TW : Taiwan (traditional). If you only use one, just select any region.
If I understand the literature correctly, the research first checks if there is an exact match with the language and the region (example: Traditional Chinese Taiwan). Then it returns to the larger controls. (This system is from Android 7.0.)
1. zh-Hant // Chinese – Traditional – Taiwan
2. zh-Hant // Chinese – Traditional
3. zh // Chinese
I’m not sure how it all works, so read this and this documentation.
By following this method in my own application, changing the system settings between traditional and simplified has also changed the display of the application.
Conversion between traditional and simplified system
If you already have a translation in traditional or simplified form, you can automatically convert the text online. Start using Google Translate to convert to another language (just paste it into your string.xml file). He’s doing pretty well already. Then repeat the process several times using one of the many online converters. Use a text comparison tool or a website (text comparison.com is fine) to compare the conversion results. In this way you can detect any errors made by Google.
Android 7.0 (API level 24) has introduced support for language
tags on PCO 47, which can be used to qualify language and region sources
. A language label consists of a set of one or more
sub-labels, each specifying or limiting the range of
languages identified by a common label.
You can now define in a traditional or simplified way using the BCP 47 tags. (To use the BCP 47 language tag, concatenated b+ and the two-letter ISO 639-1 language code, if desired, followed by additional sub-tags separated by a +).
more specifically –
b+zh values (simplified by default)
b+zh+Hans values or
b+zh+Hans+CN values (if you want to include regions)
b+zh+Hant values or
b+zh+TW values (traditional default)
b+zh+Hant+TW values (if you want to include regions)
You can search for other interesting combinations at https://tools.ietf.org/html/bcp47. Including: – –
zh-cmn-Hans-CN (Chinese, Mandarin, simplified script, used in China
cmn-Hans-CN (Mandarin Chinese, simplified script, used in China
Zh-yue-HK (Chinese, Cantonese, as used in the Hong Kong SAR)
yue-HK (Cantonese Chinese, used in the Hong Kong SAR)
Zhaan-Nan TV (Chinese Min Nan, as used in Taiwan)
zh-hak-CN (Chinese, hakka, Chinese).
Don’t forget to add and replace -b in each tag with +.
should i learn traditional or simplified chinese,does china use traditional or simplified,what is simplified chinese?,simplified chinese vs traditional chinese,traditional vs simplified chinese characters list,is simplified or traditional chinese more common,traditional vs simplified chinese examples,traditional chinese language,is mandarin chinese simplified or traditional,traditional or simplified chinese for business