Tutorial MIUI DEVELOPERS TRANSLATION GUIDE (V1.0) MUCH TO ADD!


MarkHUK

Site Founder
Staff member
Nov 6, 2010
5,251
1,000,000
This is a work in progress but something i feel I need to share to the devs out there so we can help make things work more streamlined each week.

Guide assumes the following:

1. You are a developer with some experience with android sdk tools e.g. adb

2. You have or have the ability to install or use Cygwin or a Linux / OSX system with access to the sort command.

3. You are happy using a command line and diffmerge (Google the program and you will find it for free download, its like WinMerge but nicer and newer).

Preparing and translation of XML strings for English)

1. sort xml in both values and values-en using the command:

Code:
	sort strings.xml > new.xml

Directory changes (Use Cygwin for this)

Code:
	cd Decompiled/res/values   < Chinese

Code:
	cd PrevWeekDecompiled/res/values-en/   < English

2. Fix xml header and remove spaces. No spaces should be at the end or the start of any xml file! This will break build using apktool b Decompiled new.apk

3. Open files to check for changes, changes in diffmerge are highlighted in red, if there is no line change then you can assume its just chinese but be vigilant for string name changes as well.

4. Copy the values-en with new inclusions to the res folder of the new Version (e.g 1.1.21) apk you decompile

5. Re-build and copy resources.arsc to the orginal apk. (additionally classes.dex if editing small code as well).

Done.

Other helpful info / tips:

Use Cygwin and the following command to decompile ALL Apks in one go:

Code:
for apk in *; do apktool d $apk; done   < decompile all apks in one hit

Code:
for apk in *; do apktool b $apk; done   < recompile (build) all apks in one hit

(new.apk will make a build folder, this is where you can find, resources.arc and classes.dex and also the resources images files e.g. drawable-en-hdpi xml-en layout-en)

Same principal to rebuild all when completely done translating and editing smali (Smali requires the classes.dex to be moved from the new.apk to the original.apk)

APKs requiring major mods:

1. Mms.apk - this file requires one smali edit, one layout edit, and drawable replacements.

2. MiuiMusic.apk - 2 smali edits, one layout edit, drawable (full replacements)

3. MiuiCamera.apk - multiple layout edits (should move ours to values-en (will do this week)) also a drawable change for the exposure icon. (BETA app changes may vary week to week).

4. Mms.apk - requires 1 smali edit to remove chinese text in the demo theme conversation header also replace 35 images for the apk.

5. framework-res.apk - there is some drawables in 'en' marked folders to add to the apk you are modding. A keyguard
xml is also replaced and is found in layout-en (does not require editing each week). Also some english drawables for sym_keyboard_ok.png and 2 other pngs in drawable-en-hpi.

6. Settings.apk - this file requires xml edits for the about_device.xml (i think thats the name) to prevent
a FC issue when looking at 'About Phone' as it looks for Updater.apk which we remove.

7. FileExplorer.apk requires several smali edits to remove chines text eg.

Ringtones, Photos, Bytes, MiuiScreenshots (roughly these)

8. Modification to TelocationProvider.apk strings.xml (nothing to do here) also ensure telocation.db is
used from previous weeks pack as its small and not 5mb + like the original which inclues chinese city data locations
and area codes.

9. Launcher2.apk requires one xml-en folder adding with default_workspace.xml inside of it. Additionally some drawables need to be changed. e.g. widget_folder.png

(eri.xml is requires edits for CDMA networks found in framework-res.apk)

values-en-rGB / values-en-rUS / values-en-rAU / values-en-rNZ / values-en-rCA / values-en-rIE and used in framework-res.apk THESE MUST BE USED FOR ALL ENGLISH IN THE FRAMEWORK)

(The reason I do this is to allow the removal of locale / morelocale2 and revert to the correct method of using: Settings > System > Language & Input Settings) Same applies to other country codes ensure you have values-countrycode-rCOUNTRYCODE e.g. values-it-rIT

TO-DO:

- Make examples of smali unicodes to be modified
- Show methods to be removed in smali for Mms.apk (gives us two tabs instead of the 3 default on ui base)
- indication of which layouts and drawables to include.
- indiction of which 'xml' folder files require modifications.
- Show examples of edits and where they need to be placed.

More work will be done on this file as I have time. Users of other languages can apply this methodology to their work using values-countrycode e.g. values-fr / values-it

You can get more details on the locales options in the Android SDK guides available at http://www.android.com/

SUMMARY / CREDITS:

MarkHUK v1.0 MIUI TRANSLATION DEV GUIDE 2011.
http://www.miui-dev.com/

IRC: irc.freenode.net #miui

Thanks to all the developers and MIUI community for keeping the project alive. I hope this guide is helpful to people.
 
Nice 1, Mark.
Yesterday I tried to PM you (but your inbox was full) asking for a general translation thread under the translation section so the translators from different languages could share knowledge. I see there's no need now.

As usual, many thanks for your great effort.
 
Hey Mark,
I'm trying to add Hebrew phrases to the SMS favorites but it only show squares instead of letters. Any thoughts??

Thanks
 
nice work Mark :) if you want, i've made a "small" script in .cmd, all the working folder is on my github (https://github.com/mnlk2/MIUI-tools) , the only thing to add is 7-zip and SDK, if you want take a look, and maybe make it easier to use for new user

I'm downloading it right now. Looks promising.
Thanks for the tool.
Hopefully I'll be able to fix the FC problem I have every time I add a localized XML folder to the package.
 
Hi Mark,
we are trying to dig out some chinese characters in the smali of contacts.apk but what I think are chinese characters just display as "?" when I open the smali. Can you point me in the right direction as to why I can't find the chinese. I'm using the windows version of apktool and opening the smali with notepad++ - does it have to be edited on a linux machine?
 
Hey Mark, first i want to say that the new UI looks just awesome!!!!
I was trying to localize it to my Hebrew translation by adding a copy of the drawable-en-hdpi, layout-en and xml-en as -iw (hebrew code for google) including exactly the same stuff as the -en folders but the Mms.apk just crushes (FC) when i press on any conversation.
The same happened with phone.apk when trying to make or receive a call, but in this case the phone crashes (reboots) going to the bootanimation and starting again.
It's a pity with just a great UI it can't be localized. May be is just me doing something wrong.
If you want to recreate it just change the locale on your phone to Chinese and try to make a call, see what happens.

Thanks for your time and effort and sorry if i bother you.
 
Make sure to check ALL files for \@layout it should be @layout without the \

Cheers,

Mark
 
Mark, u have the mail recipient full, i cant send u a MP. Im outta my house now, but if u want i can chat on GTalk... miuispan@gmail.com

Sent from my Nexus One using the miui-dev.com Forums App
 
Make sure to check ALL files for \@layout it should be @layout without the \

Cheers,

Mark

It works, I had same problem translating in Italian apks with new UI (Launcher, Mms, Phone), just check in their layout-xx for all "\@" and change in "@", repack and it will works.
Thanks Mark :)
 
Hi all,

I have some questions around this whole thing of decompile/compile/assemble APKs. I would be greatful if someone could answer the questions below.

- What version of apktool should be used, 1.3.2 or older? I'm on Linux.
- What version of Java jdk to use? I'm using jdk is jdk-6u23-linux-i586.bin
- What about signing the system APKs you build? If you should sign, which tools and versions to use? If you shouldn't sign, could someone explain why?
- Can the <apk>/dist/<apk>.apk be used for anything?
- Which files from <apk>/build/apk/res/ can safely or should be added to the original APK? (Adding the lot causes FC, at least for me)
- When adding files to the original APK, e.g.: classes.dex, resources.arsc, should you use compression or not? ("zip -0 FileManager.apk resources.arsc" or "zip FileManager.apk resources.arsc")

Kind Regards
PClaren
 
Hi all,

I have some questions around this whole thing of decompile/compile/assemble APKs. I would be greatful if someone could answer the questions below.

- What version of apktool should be used, 1.3.2 or older? I'm on Linux.
- What version of Java jdk to use? I'm using jdk is jdk-6u23-linux-i586.bin
- What about signing the system APKs you build? If you should sign, which tools and versions to use? If you shouldn't sign, could someone explain why?
- Can the <apk>/dist/<apk>.apk be used for anything?
- Which files from <apk>/build/apk/res/ can safely or should be added to the original APK? (Adding the lot causes FC, at least for me)
- When adding files to the original APK, e.g.: classes.dex, resources.arsc, should you use compression or not? ("zip -0 FileManager.apk resources.arsc" or "zip FileManager.apk resources.arsc")

Kind Regards
PClaren

Hi,

- The latest version is good

- The latest version is good

- You don't need to sign apks with this method (you'll use original signature within original apks). You'll need to sign only the packs you'll create, here you can find a guide --> Guide

- Dunno

- Resources.arsc and all localized folders (layout-xx, xml-xx, etc)

- You simply open "original.apk" and "translated.apk" with 7zip, then drag & drop files and folders you need, from "translated.apk" to "original.apk".
 
Hi Mish,

Thank you for your assistance.

Is there a reason why you don't sign changed system APKs like you would do with home made APKs?

//PClaren
 

Similar threads

Replies
106
Views
28K
  • Locked
HyperOS 1.0 24.3.4
Replies
150
Views
42K
  • Locked
HyperOS 1.0 24.2.26
Replies
161
Views
49K
Replies
259
Views
66K