- 6 Nov 2010
- 5,212
- 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:
Directory changes (Use Cygwin for this)
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:
(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.
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.