Published: Thu, May 04, 2017
World | By 215

Android Studio Tricks: How to change the LANGUAGE of our Android application in Android Studio. Automatic adaptation by country.

Android Studio Tricks: How to change the LANGUAGE of our Android application in Android Studio. Automatic adaptation by country.

Today's entry speaks of one of the most important things to take into account when creating a good app: the translation and adaptation of our application for each country.

It's simple: more languages, more countries can be distributed, more public. So I'll show you the way to do it step by step. Let's start.

- You have to have ISO 639-1 codes for each country / language. It will also serve -2 and -3. Android Studio can recognize all these codes and you have to go testing until the country flag is displayed (see below):

Now, create a new STRING.XLM file where we will translate each STRING into The language we want.

In Android Studio, we must create the new VALUES resource directories that are within RES and host the STRINGS.XLM resources:

Ari Batchelder in Maximum Ride: The Angel Experiment
The flock members are shocked to see him, though, because it turns out that he's Jeb's son and he used to be a normal, sweet kid. He's become a monster, but not by his own doing-and Max's ability to recognize this shows how true his heart is.

- Right click on RES - & gt; New resource directory - & gt; And in the same name VALUES we add a script and the code of the country (first column, although we must try until we see the country flag right next to the resource STRING) - & gt; Copy the default resource where all our STRINGS are in our main language - & gt; Paste into the new folder VALUES- (code) directory of the new language - & gt; Translate each STRING

- We open the tab:

- And it appears with the flag:

- We can now modify each STRING of the new STRING resource .XLM that will be read by the device according to the language settings chosen by the user:

I suggest that you do the compilation test on an external PC device (connected via USB) and you can change the language and See if you have successfully completed translations. Greetings to everyone by the visit!

Like this: