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

Discussion in 'Mi Fans General Chat' started by MarkHUK, Jan 20, 2011.

  1. MarkHUK

    MarkHUK MIUIAndroid.com founder Staff Member

    Trophy Points:
    320
    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.
  2. Google Adsense

  3. MarkHUK

    MarkHUK MIUIAndroid.com founder Staff Member

    Trophy Points:
    320
    RESERVED SLOT 2
  4. MarkHUK

    MarkHUK MIUIAndroid.com founder Staff Member

    Trophy Points:
    320
    RESERVED SLOT 3 FOR SCREENSHOTS
  5. MarkHUK

    MarkHUK MIUIAndroid.com founder Staff Member

    Trophy Points:
    320
    RESERVED SLOT 4 MISC
  6. aiccucs

    aiccucs Members

    Trophy Points:
    0
    Very nice.
  7. MarkHUK

    MarkHUK MIUIAndroid.com founder Staff Member

    Trophy Points:
    320
    yea - hopefully now people see how much effort goes into this each week! :)
    Bestonius likes this.
  8. k_chupe

    k_chupe Members

    Trophy Points:
    0
    Wow! Very extensive! Thanks

    Sent from my ADR6300 using the miui-dev.com Forums App
  9. roenano

    roenano Members

    Trophy Points:
    55
    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.
  10. roenano

    roenano Members

    Trophy Points:
    55
    Hey Mark,
    I'm trying to add Hebrew phrases to the SMS favorites but it only show squares instead of letters. Any thoughts??

    Thanks
  11. MarkHUK

    MarkHUK MIUIAndroid.com founder Staff Member

    Trophy Points:
    320
    You need to unicode the characters :)
  12. roenano

    roenano Members

    Trophy Points:
    55
    meaning???
    put instead of the letters the ascii code????
    is strange because there are hebrew fonts in android...
  13. roenano

    roenano Members

    Trophy Points:
    55
    Any chance you can be a little more specific?
    Thanks
  14. mnlk2

    mnlk2 Members

    Trophy Points:
    0
    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
  15. roenano

    roenano Members

    Trophy Points:
    55
    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.
  16. Talbess

    Talbess Members

    Trophy Points:
    0
    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?
  17. roenano

    roenano Members

    Trophy Points:
    55
    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.
  18. jcg_vazquez

    jcg_vazquez Members

    Trophy Points:
    0
    i have problems translating new ui too...
  19. MarkHUK

    MarkHUK MIUIAndroid.com founder Staff Member

    Trophy Points:
    320
    Make sure to check ALL files for \@layout it should be @layout without the \

    Cheers,

    Mark
  20. jcg_vazquez

    jcg_vazquez Members

    Trophy Points:
    0
    thx man! i'll be testing it in the next hours! :p
  21. royalina

    royalina Members

    Trophy Points:
    0

Share Our Site