FORUMS
Remove All Ads from XDA

[Q] How to translate settings.apk

26 posts
Thanks Meter: 8
 
By teneke, Junior Member on 12th February 2011, 09:46 PM
Post Reply Email Thread
So I wish to translate the English CM7 to my language, but i can't decompile the settings file without errors. I know i need strings.xml fro the res/values folder inside the apk but with apk_manager_4.9 I can't decompile this system file without errors. It seams it only extracts the file ...
Anyone can help me out here
13th February 2011, 12:06 AM |#2  
Senior Member
Flag Zagreb
Thanks Meter: 14
 
More
use apktool.
to load framework file use apktool if "framework file".apk (if you do not input framework it send error message), after that you can load settings.apk and translate it to your language.
I tried it and it should work.

sry cause bad Eng...
13th February 2011, 12:29 AM |#3  
OP Junior Member
Thanks Meter: 8
 
More
This sounds like a lot of modding ... A d that apktool is not very userfriendly
31st October 2011, 08:59 PM |#4  
underlines's Avatar
Senior Member
Flag Bangkok
Thanks Meter: 408
 
More
Source: http://www.miui-au.com/add-ons/apktool/


Use APKTool to Decompile, Edit, Translate and Recompile an APK
APKTool is an application (made by Brut.all) which decompiles and recompiles android APKs. If you know what you are doing, it also allows you to debug the smali code step by step. In our case it will enable us to build a language pack by translating the .xml strings inside APK files.
This tutorial is for the Windows version of APKtool.
The Google.Code page for APKTool is here, however, we have prepackaged everything you need and uploaded it here
The Video Tutorial is Below:
The Supplementary guide to common errors in APKTool is below:
You need to do the following preparations (the video outlines these steps anyway):
  1. Download the prepackaged APKTool zip.
  2. Extract them to a directory you will remember.
  3. Extract framework-res.apk AND apk files you want to decompile from the MIUI_Au ROM and copy them to the root directory of APKTool.
This step must be completed every time you are dealing with APKTool:
  1. Open a command window
  2. Navigate to the root directory of APKtool and type the following command:
    apktool if framework-res.apk
The output should be:
I: Framework installed to: C:\Users\Josh\apktool\framework\1.apk
This step does the actual decompiling of the APK (I will assume that the chosen APK is Settings.apk):
apktool d Settings.apk
The output should be:
I: Loading resource table…
I: Decoding resources…
I: Copying assets and libs…

After doing that, a new directory with the name of the APK you decompiled should have been created. You need to:
  1. Change into the newly created directory.
  2. Change into the /res folder
  3. Check to see if a values-xx folder exists, where xx is the two letter code of the target language to be translated into. For example, if you are aiming to translate into German, check for a values-de folder. If it does not exist (and chances are that if you are translating into a new language, that it will not exist), you need to create it. Then, copy the arrays.xml and strings.xml files from the /values folder into the folder you just created.
  4. Open these two files (in Notepad ++) and alter the strings (the text inBLACK ONLY). Look out for things that look like %d and %s /’ - Don’t edit these, as they are variables. Also, if you see &, it represents the ‘&’ sign, so feel free to change it. Finally, you MUST be sure to place a backslash ‘\’ before an apostrophe, for example Proxy\’s would be the equivalent of Proxy’s.
  5. Once you have translated and edited your arrays.xml and strings.xml files, save them, and return to the root directory of APKTool.
  6. Open a command prompt to that directory
Enter the following command to recompile your edited and translated APK (assuming that Settings.apk is the chosen APK):
apktool b Settings
The output should be:
I: Checking whether sources has changed…
I: Smaling…
I: Checking whether resources has changed…
I: Building resources…
I: Building apk file…

You may get a couple of these messages:
aapt: warning: string ‘app_killed_message’ has no default translation in C:\Users\Josh\Desktop\NF\framework-res\res; found: fr it ja
aapt: warning: string ‘global_action_reboot’ has no default translation in C:\Users\Josh\Desktop\NF\framework-res\res; found: fr it ja
aapt: warning: string ‘reboot_system’ has no default translation in C:\Users\Josh\Desktop\NF\framework-res\res; found: fr it ja
aapt: warning: string ‘toast_reboot_recommend’ has no default translation in C:\Users\Josh\Desktop\NF\framework-res

However, it will build the apk anyway. These messages mean that some strings don’t have values. It is only an issues if the text im blue includes your translation language.
Once that is done, two directories will have been created within the decompilation directory. One will be called “dist”, and this is where it will place a built, but not signed, apk file. The other one is called “build”, and here it will place everything “loose” (the contents of the APK).
I have trouble using the APK files it spits out in the /dist folder ( they force closes if they are an application, or bootloop it a framework-res.apk; I think the reason is because Android will not accept APK files that are not signed). Instead, copy the resources.arsc from the /build directory into the original framework-res from the rom (just overwrite the old resources.arsc one with the new one).
This tutorial is for the Windows version of APKtool.
The Following 5 Users Say Thank You to underlines For This Useful Post: [ View ] Gift underlines Ad-Free
2nd November 2011, 09:37 PM |#5  
Member
Thanks Meter: 144
 
More
Quote:
Originally Posted by teneke

So I wish to translate the English CM7 to my language, but i can't decompile the settings file without errors. I know i need strings.xml fro the res/values folder inside the apk but with apk_manager_4.9 I can't decompile this system file without errors. It seams it only extracts the file ...
Anyone can help me out here


The true way -- build settings youself from source with new language in res
14th February 2012, 05:03 PM |#6  
Junior Member
Flag Aveiro
Thanks Meter: 1
 
More
The prepackaged link is not working.
Does anyone have the file?

Cheers
13th April 2013, 07:44 AM |#7  
calvooo's Avatar
Senior Member
Thanks Meter: 15
 
More
Great tutorial. I will need them to translate chinese .apk to english
25th April 2013, 11:09 PM |#8  
CoolApps's Avatar
Senior Member
Thanks Meter: 610
 
More
Can't you use the Lauguage and Input settings?

Sent from my Nexus 4
22nd September 2018, 08:41 PM |#9  
Junior Member
Thanks Meter: 0
 
More
Wonderful post!
Quote:
Originally Posted by underlines

Source: http://www.miui-au.com/add-ons/apktool/


Use APKTool to Decompile, Edit, Translate and Recompile an APK
APKTool is an application (made by Brut.all) which decompiles and recompiles android APKs. If you know what you are doing, it also allows you to debug the smali code step by step. In our case it will enable us to build a language pack by translating the .xml strings inside APK files.
This tutorial is for the Windows version of APKtool.
The Google.Code page for APKTool is here, however, we have prepackaged everything you need and uploaded it here
The Video Tutorial is Below:
The Supplementary guide to common errors in APKTool is below:
You need to do the following preparations (the video outlines these steps anyway):

  1. Download the prepackaged APKTool zip.
  2. Extract them to a directory you will remember.
  3. Extract framework-res.apk AND apk files you want to decompile from the MIUI_Au ROM and copy them to the root directory of APKTool.
This step must be completed every time you are dealing with APKTool:
  1. Open a command window
  2. Navigate to the root directory of APKtool and type the following command:
    apktool if framework-res.apk
The output should be:
I: Framework installed to: C:\Users\Josh\apktool\framework\1.apk
This step does the actual decompiling of the APK (I will assume that the chosen APK is Settings.apk):
apktool d Settings.apk
The output should be:
I: Loading resource table…
I: Decoding resources…
I: Copying assets and libs…

After doing that, a new directory with the name of the APK you decompiled should have been created. You need to:
  1. Change into the newly created directory.
  2. Change into the /res folder
  3. Check to see if a values-xx folder exists, where xx is the two letter code of the target language to be translated into. For example, if you are aiming to translate into German, check for a values-de folder. If it does not exist (and chances are that if you are translating into a new language, that it will not exist), you need to create it. Then, copy the arrays.xml and strings.xml files from the /values folder into the folder you just created.
  4. Open these two files (in Notepad ++) and alter the strings (the text inBLACK ONLY). Look out for things that look like %d and %s /’ - Don’t edit these, as they are variables. Also, if you see &, it represents the ‘&’ sign, so feel free to change it. Finally, you MUST be sure to place a backslash ‘\’ before an apostrophe, for example Proxy\’s would be the equivalent of Proxy’s.
  5. Once you have translated and edited your arrays.xml and strings.xml files, save them, and return to the root directory of APKTool.
  6. Open a command prompt to that directory
Enter the following command to recompile your edited and translated APK (assuming that Settings.apk is the chosen APK):
apktool b Settings
The output should be:
I: Checking whether sources has changed…
I: Smaling…
I: Checking whether resources has changed…
I: Building resources…
I: Building apk file…

You may get a couple of these messages:
aapt: warning: string ‘app_killed_message’ has no default translation in C:\Users\Josh\Desktop\NF\framework-res\res; found: fr it ja
aapt: warning: string ‘global_action_reboot’ has no default translation in C:\Users\Josh\Desktop\NF\framework-res\res; found: fr it ja
aapt: warning: string ‘reboot_system’ has no default translation in C:\Users\Josh\Desktop\NF\framework-res\res; found: fr it ja
aapt: warning: string ‘toast_reboot_recommend’ has no default translation in C:\Users\Josh\Desktop\NF\framework-res

However, it will build the apk anyway. These messages mean that some strings don’t have values. It is only an issues if the text im blue includes your translation language.
Once that is done, two directories will have been created within the decompilation directory. One will be called “dist”, and this is where it will place a built, but not signed, apk file. The other one is called “build”, and here it will place everything “loose” (the contents of the APK).
I have trouble using the APK files it spits out in the /dist folder ( they force closes if they are an application, or bootloop it a framework-res.apk; I think the reason is because Android will not accept APK files that are not signed). Instead, copy the resources.arsc from the /build directory into the original framework-res from the rom (just overwrite the old resources.arsc one with the new one).
This tutorial is for the Windows version of APKtool.

Is this still valid for New Android OS?! like 5.0 or 6.0 and above?
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes