How do I support multiple languages on Android?

Asked 2 years ago, Updated 2 years ago, 90 views

I'm going to release the app on Google Store. I want to print it out in English on the US account and Korean on the Korean account, is that possible?

android localization resources

2022-09-21 16:28

1 Answers

When you develop Android, you have to display the language of each country. In that case, it's going to be, uh, it's going to be a huge challenge. For that reason, Android provides the ability to automatically set the language according to the system language set on your device.

The function is to use the string.xml folder called -> values in the Android Project -> res folder. Usually, when you develop a project, you use one string.xml for one value. However, if you create a separate folder for each language as shown below, you will automatically refer to the values folder specified based on the system language set on your device.

1

As you can see above, I created folders called "values-en" and "values-ko." And you can see that "string.xml" exists in each folder. Each device is referred to "string.xml" in its folder by language in its settings.

Well, but why are the names en and ko next to the values folder? Yes, that’s right. Because that's the value that the system language uses as a delimiter. In Korean, "ko" is used, in American, "en" is used, and in Japanese, "ja" is used. (If you want to use another language, type in Eclipse to Locale. and you'll see more of the languages available.)

2 If you want to add Japanese, you can create a folder called "values-ja" and use it, right? Now, let's take a look at the inside of the strings.xml.

The strings.xml file in the values-en folder.

<string name="hello">Hello World, TestHHimLocationActivity!</string>
<string name="app_name">TestHHimLocation</string>

The strings.xml file in the values-ko folder.

<string name="hello">Hello.!!</string>
<string name="app_name">Ko-Hangul.</string>

This configuration makes it easy to specify a country-specific language depending on the system language. Because the Views refer to the string value "hello", if you specify "hello" in any folder, the Views will refer to the "hello" value.

http://yth2626.blogspot.kr/2012/07/blog-post.html


2022-09-21 16:28

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.