Sam vichea. Powered by Blogger.


How to translate Android system files into Khmer

Stage 1: If you haven’t read about Stage 1 on how to add Khmer Language support to Android OS yet click here
(it contains links to download all required tools to translate apk)

Stage 2.a how to translate an apk file.

2.b Translate Android System files into Khmer

Translate android system file and android app are pretty much the same. The differences are:
- You need to put frameworks-res.apk in the apk folder, in order to make it decompiles properly.
- There is a strict instructions that must be followed in order to replace the kernel system files, otherwise, you would brick your phone.

  1. Use apktool to decompile the android system files.
  2. modify the resources in res folders
  3. recompile them back.
  4. replace resources.arsc and other xml and images resources with the  modified one using winrar make you sure save in zip format and “store” as compression method.
  5. when replace the modified files system/framework or system/app with modified files. make sure you set the permission to all 777.
Understanding MIUI android system files and its functions (credit: MarkHUK)
in /system/app
AccountAndSyncSettings.apk (Account manager for sync contacts, pictures e.g. Google (Gmail))
AntiSpam.apk (phone filter, block unwanted number, you don’t like, delete it)
Backup.apk (MIUI Backup utility including Cloud backup and automatic backup, don’t want it, just delete it)
Contacts.apk (MIUI Contacts app)
ContactsProvider.apk (Provider for Contacts, background app)
CloudService.apk (MIUI User account management apk)
DefaultContainerService.apk (service for contact list, must keep)
DownloadProviderUi.apk (Used for Download management UI)
FileExplorer.apk (MIUI File manager)
Gallery.apk (MIUI Gallery app)
Launcher2.apk (MIUI Launcher)
MediaProvider.apk (media provider service, must keep)
MiuiCamera.apk (MIUI Camera)
MiuiMusic.apk (MIUI Music player)
Mms.apk (MIUI SMS / MMS app)
Monitor.apk (System application monitoring and firewall app)
Notes.apk (MIUI / Xiaomi notes app)
PackageInstaller.apk (apk installer service)
Phone.apk (MIUI Phone app)
Settings.apk (Common system settings)
SettingsProvider.apk (Background provider for settings app)
SideKick.apk (Search app in MIUI for global searching)
Superuser.apk (MIUI Customised superuser for application permissions management)
SoundRecorder.apk (MIUI Sound recording app)
SystemUI.apk (System user interface for status bar and toggle interactions etc)
TelephonyProvider.apk (Used for number lookup in framework etc)
TelocationProvider.apk (Used for GPS tracking)
ThemeManager.apk (mtz Theme manager from MIUI)
Torch.apk (CM Torch app customised by MIUI)
UserDictionaryProvider.apk (must keep)
in /system/framework
Frameworks-res.apk (contains icon files, lockscreen message, date time settings….)
The red colour apk files are hard core kernel files, it is a bit tricky when you replace it.
To translate non hard core kernel system file stock app, you can use the same method as translating a normal apk, example: FileExplorer, MiuiMusic, Torch,
But when you install it, you need to use RootAppDelete to delete the stock app

  1. Click  on SysApp button, disable the apk (example, deskclock.apk)
  2. play with your phone, if it stable, then to go Recycler of RootAppDelete to uninstall it
  3. install the translated apk file (signed-deskclock.apk) to replace it.

2.b.1 Translate Framworks-res.apk

Let’s work on the frameworks-res.apk
step 1: extract your Apktool to c:\apktool (note: I use the original apktool, not the ICS one)
step 2: extract frameworks-res.apk from your phone located in /system/frameworks/ using Root Explorer to copy it to your sdcard, and  transfer the file on to your desktop.
step 3: copy the frameworks-res.apk from your desktop to the same folder as apktool which is c:\apktool in this example. (now you should have 2 copies of frameworks-res.apk, one on your desktop and one in c:\apktool folder)
step 4: go to command prompt (run command prompt, if you don’t know just google it ), and type following commands (as shown in the photo above)
cd c:\apktool
apktool if frameworks-res.apk
apktool d framworks-res.apk
At this point, don’t close the command prompt windows.  Go to c:\apktool you will see framework-res folder.
Now you can start translating files in res folder of the framework-res. (Please refer to  Stage 2.a on how to translate an apk file)
Ok, now I assume that you have completed the translation. So, let’s rebuild the frameworks-res using the command below.
apktool b frameworks-res
Once it’s done. you find framework-res.apk in C:\apktool\framework-res\dist folder
Let’s resources into the original framework-res.apk
The main different between translating an apk and a kernel system file is that you can re-sign the apk, it will brick your phone. To solve this problem you need to transfer the translated resources into the orignal system file (in here, frameworks-res.apk).

Step 1:
- open the modified framework-res.apk in C:\apktool\framework-res\dist folder with winrar
- extract resources.arsc  or other resources that you modified such images from the drawable-hdpi onto desktop folder. 
Step 2:
- Open the original frameworks-res.apk that you first saved on desktop  with winrar.
- drag the modified resources.arsc that you just extracted from the modified frameworks-res.apk to replace the original resources.arsc in the original frameworks-res.apk on the desktop. make you sure save in zip format and “store” as compression method
- replace other original xml and images resources with the  modified xml and images files one using the same method as replacing resource.arsc
Step 3: make you sure save in zip format and “store” as compression method.
Step 4: install copy the frameworks-res.apk from your desktop to your phone.
WARNING!: Make sure you backup your phone first. 
This is the tricky bit.
1. First, you need to copy it into /system/ folder of your phone first. (don’t skip this step)
2. Then, change the permission to 777. Refer to below image.  (user, group, other, all read, write, execute). That’s the only permission that works for me.

3. restart your phone. If everything goes well, you can boot into you home screen. otherwise. you just bricked your phone, and need to restore it from backup. and try it again. :)


Pretty much the same step as translating frameworks-res.apk
  1. copy settings.apk from phone to desktop. And make another copy from desktop to c:\apktool\, make you that you have frameworks-res.apk in the same folder as well.
  2. run command prompt:
       cd c:\apktool
       apktool if frameworks-res.apk
       apktool d settings.apk
Note: you see the problem in the image about. This is because the miui_logo.9.png is corrupted, make sure you delete it from drawable-en-hdpi and drawable-hdpi of the res folder.
       3.  find the settings folder in c:\apktool\ and start translating the resources in settings folder.
Note: there is one problem in here. Due to the problem of miui_logo.9.png file, you won’t be about to click on “About Phone” in the settings page, it will crash your phone. To fix that issue, you can remove “About Phone” from the settings page. It is located in C:\apktool\settings\res\xml\settings.xml

4 now, rebuild the settings.apk using command prompt:
apktool b settings
If you got errors, it means that you haven’t deleted the miui_logo.9.png in the drawable-hdpi and drawable-en-hdpi.
Now, you should have a modified settings.apk in C:\apktool\settings\dist
The same as frameworks-res.apk
  1. exract resources.arsc and the xml (settings.xml) from the modified settings.apk.
  2. replace resource.arsc
  3. replace settings.xml in your original settings.apk\res\xml with the modified one.
  4. copy it to /system/ on your phone, change permission, then copy to /system/app (this one doesn’t need 777 permission, just user: read write, group: read, others: read)
  5. restart your phone.
! Article Title "How to translate Android system files into Khmer"

Back To Top