[ROM] MIUI | Stock | Language & Discussion Thread

Status
Not open for further replies.
Search This thread

djmcnz

Retired Recognized Developer
Oct 13, 2009
5,691
1,640
Auckland, NZ

MIUI ROM from the Far East
Official Links
MIUI English Site: http://en.miui.com/
MIUI Download Site: http://www.miui.com/download.html

Other Sites
Russian Support: http://4pda.ru/forum/index.php?showtopic=197606
Spanish Support: http://miui.es/
Italian Support: http://www.nexus-lab.com/miui-rom-italian-packs/
Additional English Support: http://forums.miui-dev.com/
Some North American love: http://miui.us/


Translation Instructions in Third Post

PM me if this post needs updating!​
 
Last edited:

djmcnz

Retired Recognized Developer
Oct 13, 2009
5,691
1,640
Auckland, NZ
[HOW TO] Create a MIUI Language Pack

Okay guys, there's a lot of demand for this rom and for language packs but not yet a lot of people who know how to make the packs. Whilst I set up the crowdin translation project I can not create or maintain language packs.

So, here's a summary of the instructions required to create a language pack for MIUI (indeed for any app/rom). You need a collection of tools and a little patience but the process isn't too difficult so do give it a go.

Also note that this summary includes generalisations for brevity. These instructions assume you have a deodexed rom.

Introduction
For the purposes of this post language information is stored in XML strings in files on the Android system. In the case of MIUI and these instructions we will be dealing with .apk files (applications).

Within the apk files is a resources directory (/res) and within this are various values directories, there is a default values directory (/res/values) and alternative language values directories (e.g. /res/values-DE and /res/values-IT).

If the rom is set to use it's default language it will read values from /res/values although these may NOT be in English. In MIUI, all of the common Android ASOP values in /res/values are English but the (additional) custom MIUI strings are in Simplified Chinese.

If you select a different language in the ROM than the default then the appropriate values directory will be searched. If a suitable string that matches your language selection is found in the alternative /res/values-xx directory then that string will be used instead. If an alternative does not exist then the default will be used.

Example:

Code:
/res/[COLOR="red"]values[/COLOR]/strings.xml
<stop_button_text>[COLOR="Red"]Stop[/COLOR]</stop_button_text>

/res/[COLOR="red"]values-DE[/COLOR]/strings.xml
<stop_button_text>[COLOR="red"]Halt[/COLOR]</stop_button_text>

/res/[COLOR="red"]values-IT[/COLOR]/strings.xml
<stop_button_text>[COLOR="red"]Basta[/COLOR]</stop_button_text>

In this example, if the language is set to the default the word "Stop" will be used, if it is set to German the word "Halt" will be substituted in, likewise "Basta" for Italian.

So, to add languages to a rom (or app) or to make an app multi-lingual you need to either change the default strings in /res/values/strings.xml to the ones you want to use or, and this is the preferable approach, add a /res/values-xx/strings.xml with the translations you want. The first approach will work (changing the default strings) but is not recommended because the Android Open Source Project and Android development in general, defaults to English. It's best to use the built in language substitution capabilities of Android rather than to work around them. Indeed, if the MIUI devs actually added their strings in English to /res/values/strings.xml and the Chinese equivalents in the appropriate directory this rom would already be in English!

Adding Languages
To add a translation file (strings.xml) to an apk you need to:

  1. decode the apk
  2. create a language directory
  3. add the translation files
  4. recompile the strings
  5. add the new strings to the apk

Which all sounds a little daunting but it's really quite straight-forward, rewarding when you see the result and a good way to understand how parts of Android work. Here's how you can do it.

1. decode the apk
You will need the excellent apktool from brut.all which you can get from the link below. apktool is relatively easy to use but includes some little tricks so you will need to read the wiki and thread about it.

Do NOT just post problems about apktool if you can't get it to work. The tool DOES work so if it's not decoding (or encoding) your apps correctly then you're probably doing something wrong. If you start with this understand BEFORE you ask for support you'll get a lot more help... :)

apktool: http://code.google.com/p/android-apktool/
wiki: http://code.google.com/p/android-apktool/w/list
thread: http://forum.xda-developers.com/showthread.php?t=640592

Please make sure you run the following command to include the MIUI framework in apktool. You only need to do this once for each framework. If apktool works with one rom and not the next then (re)install the framework for that rom.

Code:
apktool if framework-res.apk

Where framework-res.apk is the one from the rom you are working with. Make sure apktool can find (the correct) framework-res.apk before you run this command.

This thread is not for apktool support.

Now, before you proceed, decode a simple app from MIUI (such as updater.apk) using apktool, do not make ANY changes, then re-encode it using apktool. For example:

Code:
apktool d Updater.apk ./decoded/
apktool b ./decoded/ new_updater.apk

Use the -v (verbose) flag in apktool if you have problems and need to diagnose further.

Remember, Android uses a case-sensitive file system, make sure your capitalisation is correct.

Typically you will not be able to install this apk because it is not signed so if you want to test the process further you can now just try step 5 below using the two apks you have.​

2. create a language directory
Assuming you can decode/encode now, this is the easy bit. For your decoded app, navigate to the directory it was decoded in, then to the /res/ directory and simply create an empty directory for your language (e.g. /values-FR/) - use international naming conventions.

3. add the translation files
Again, not too difficult this. Download the appropriate language file for your apk from the crowdin project linked below and, using the same structure as exists in /res/values/strings.xml create a new file called strings.xml in your alternative language directory (e.g. /res/values-ES/strings.xml).

The news strings.xml may contain as many or as few translations as you like. Remember, if a translation does not exist the default value from /res/values/strings.xml will be used.

Crowdin: http://crowdin.net/project/miui-rom-translation/invite

The xml formatting and tag names need to match exactly with the default strings.xml in /res/values although the translated file does NOT need to be complete.

It is worth remembering here that unless your source apk is already translated to English then some of the default values in /res/values/strings.xml will still be in Chinese, it would pay to check these.​

4. recompile the strings
Now, if you've done everything carefully and correctly this step is really easy, all you need to do is recompile the apk with apktool using the b (for Build) switch.

Code:
apktool b ./<decoded_apk_dir>/ <output_apk_name>.apk

If this throws errors or does not work then use the -v switch to turn on verbose mode and diagnose your problem. If you did the test in step #1 and it worked then any problem at this step is likely related to your news strings.xml. Back out the changes one by one until you have found the problem and try again.

If you simply can't get it to compile with your changes then try just making a single change to the default strings.xml file in /res/values and see if that works for you.

Do NOT sign the apk!​

5. add the new strings to the apk
Easy. Open your new apk with a zip program (like 7Zip for Windows) and copy out the resources.arsc file in the root directory of the apk. Now take that file and copy it into the source apk from the rom overwriting the existing one. This process replaces the strings but keeps the integrity of the signatures on the files.

You can now push the modified file to your phone, replacing the stock one, reboot and you're translated. Push the file using "adb push" or copy it into place using a root file manager, do not "install" the new apk. Make sure you put it in the correct place (replace the original) and reboot.​

Conclusion
This process will help you add languages to any app including those in the MIUI rom. Because it's a rom the strings are contained in many different apps as well as framework-res.apk. To completely translate the rom you will need to edit every apk that has strings in it.

You will need to do this every time an apk in the rom changes. If a new version is released and say launcher2.apk is changed but updater.apk is not, then you can retain your updater.apk but you'll need to re-edit your launcher2.apk.

When an app changes the default strings.xml may also change. In this case you will need to make corresponding changes to your translations.

Good luck and if you get really stuck there's lots of people in this that have achieved success and may be willing to help!
HOW TO SPEED-UP THE TRANSLATION-PROCESS:

I've created a simple application (java-based) which tries to merge orginal-froyo-translation (taken from the official repository) into the miui-value-files. (only strings.xml are currently supported).

This program is available here:
http://www.multiupload.com/HVZXDBHIVU


How it work / what you have to do:

1) Extract the Translator.tar.gz file (windows-users use winrar or whatever) - a directory named "Tanslator" will be created.

2) Extract the strings.xml file from the miui-package you want to translate.
This can be done with the apk-tool: apktool -d Contact.apk Contact_decoded
Copy the "res/values/strings.xml" to the created "Translator"-direcory. Open that folder and rename (the previous copied) strings.xml to "untranslated.xml".

3) Copy the strings.xml from the official froyo-sources for the package and the language you want to "merge" to the "Translator"-directory and rename the string.xml-file to "translation-file-from-froyo-repo.xml".

4) Run the program. Open a command-prompt/console. Change directory into the "Translator"-Directory and run:
java Translator untranslated.xml translation-file-from-froyo-repo.xml
This will generatre a file named "translated.xml"

For some safety reasons not all string which match "by key" are merged. (Stuff wich contains characters like '<' or '%'). You probably see some warnings printed in console (with the key) that needs to be translated manually.
If you want to override this "safety-featiure". Run the app with:
java Translator untranslated.xml translation-file-from-froyo-repo.xml psycho
(psycho at the end)

Hope this helps somehow.
 
Last edited:

archangelugp

Member
Dec 22, 2008
40
0
Lake Forest, CA
I ran the language file you posted above through Google Translate so we can get a better idea how the text should read... (For the people like me that don't understand Chinese :eek: )

Code:
<string name="breathing_light_color_title"> trackball color </ string>
    <string name="breathing_light_color_summary"> received a new notification, tracking the ball indicator color </ string>
    <string name="breathing_light_freq_title"> trackball flicker frequency </ string>
    <string name="breathing_light_freq_summary"> trackball pause time between two flashes </ string>
    <string name="trackball_wake_title"> trackball light up the screen </ string>
    <string name="battery_settings"> power settings </ string>
    <string name="battery_settings_title"> power </ string>
    <string name="battery_indicator_style"> power status bar style </ string>
    <string name="battery_low_level"> low battery warning value </ string>
    <string name="battery_saving_rules_title"> Automatic power rules </ string>
    <string name="battery_saving_rules_summary"> alert when the power is lower than the value of the operation will be applied when the </ string>
    <string name="battery_auto_saving_category_general"> the page the next time all the changes will take effect when entering a low-power </ string>
    <string name="battery_auto_saving"> value into the low battery warning when the automatic power saving </ string>
    <string name="battery_setting_quick_entry"> power to set Quick Entry </ string>
    <string name="battery_setting_quick_entry_summary"> when the low battery, the drop-down box in the status bar display the prompt, and click to enter the current settings page </ string>
    <string name="battery_auto_saving_category_rule"> power rule </ string>
    <string name="battery_auto_saving_rule_brightness"> reduce the screen brightness </ string>
    <string name="battery_auto_saving_rule_brightness_summary"> brightness to a minimum, you can significantly reduce battery consumption </ string>
    <string name="battery_auto_saving_rule_background_data"> disable the background </ string>
    <string name="battery_auto_saving_rule_background_data_summary"> save power at the same time and save network traffic costs </ string>
    <string name="battery_auto_saving_rule_auto_sync"> disable automatic sync </ string>
    <string name="battery_auto_saving_rule_auto_sync_summary"> close contacts, messages and other account synchronization </ string>
    <string name="battery_auto_saving_rule_apn"> disable the mobile network </ string>
    <string name="battery_auto_saving_rule_apn_summary"> off GPRS, 3G and other data connections </ string>
    <string name="battery_auto_saving_rule_wifi"> disable WiFi wireless network </ string>
    <string name="battery_auto_saving_rule_wifi_summary"> can significantly reduce battery consumption </ string>
    <string name="battery_auto_saving_rule_bluetooth"> disable Bluetooth </ string>
    <string name="battery_auto_saving_rule_bluetooth_summary"> can significantly reduce battery consumption </ string>
    <string name="battery_auto_saving_rule_gps"> disable the GPS satellite positioning </ string>
    <string name="battery_auto_saving_rule_gps_summary"> prevent background programs using the GPS, power consumption </ string>
    <string name="battery_auto_saving_rule_vibrate"> disable the vibration </ string>
    <string name="battery_auto_saving_rule_vibrate_summary"> shock in general consumes little power, but in a time of low power consumption is to save a little bit </ string>
    <string name="battery_auto_saving_rule_haptic"> disable tactile feedback </ string>
    <string name="battery_auto_saving_rule_haptic_summary"> principle above </ string>
    <string name="battery_auto_saving_rule_wallpaper"> disable dynamic wallpaper </ string>
    <string name="battery_auto_saving_rule_wallpaper_summary"> wallpapers will consume a lot of power but also slow down the system speed </ string>
    <string name="battery_auto_saving_rule_screen_time_out"> reduce screen timeout </ string>
    <string name="battery_auto_saving_rule_screen_time_out_summary"> timeout to a minimum, you can reduce the battery consumption to some extent </ string>
    <string name="battery_auto_saving_rule_cpu"> reduce the CPU frequency </ string>
    <string name="battery_auto_saving_rule_cpu_summary"> can reduce the "cottage" lock screen when the program is produced by CPU power consumption </ string>
    <string name="battery_auto_saving_category_practise"> want more power? </ string>
    <string name="battery_auto_saving_practise"> saving tips </ string>
    <string name="battery_auto_saving_practise_summary"> 1 usually minimize the program running in the background \ n2 unless the bright light, usually no need to use the highest brightness \ n3 sleep can be considered to set flight mode </ string>
    <string name="battery_auto_saving_practise_more"> More energy saving tips to the forums> </ string>
    <string name="sd_ext_memory"> A2SD </ string>
    <string name="usage_type_power"> power consumption </ string>
    <string name="current_ime"> the current input method </ string>
    <string name="experimental_settings"> developer-specific settings, the average user to use at your own risk </ string>
    <string name="experimental_category_control_title"> system control </ string>
    <string name="overscroll_mode_title"> elastic default list style </ string>
    <string name="menu_style_title"> menu style </ string>
    <string name="experimental_category_launcher_title"> Desktop </ string>
    <string name="app_icon_background_title"> enable the icon background </ string>

I'm going to work a bit on refining the language tonight.

Going to work backwards.

1) Uploading this language file in place of the Chinese language file.
2) Load up the ROM.
3) Start browsing the menus and figure out how they should read and make the text more accurate to English.
4) Make the changes needed to the language file.
 
Last edited:

xghostyxjokerx

Senior Member
Sep 26, 2009
919
13
all your base are belong to us

miui rom from the far east

if you've not heard about this rom yet then check out this excellent thread started by dai323 who deserves credit for bring it to our attention.

This is an excellent rom if for no other reason than it introduces the first non-cyanogenmod/carrier/manufacturer framework overhaul of android 2.2, and boy what an overhaul. It's hard to ignore the conspiracy theory that this includes leaked elements of gingerbread... The next android. Don't ask me, i have no idea...

de-odexed | themeable | ready for translation

i will pull this at the request of the devs, pm me if you wish.


important notice

  1. this is for advanced users only.
  2. this is a no questions rom, you are not allowed to ask questions that you could work the answers out for yourself. Don't dare.
  3. this is a no complaints rom, you are not allowed to complain if it does not work, breaks your phone or has sex with your sister.
  4. please contribute to the enhancement of this rom in a constructive fashion, see the next post.
  5. if you agree to all of the above then you may download the rom by clicking on the appropriate answer below.
changes from base rom
  1. fully de-odexed
  2. added adw.launcher
  3. added launcherpro
  4. added locale
  5. added htc ime mod
  6. updated apps2sd to 2.7.5 final
  7. (mostly) updated gapps (including new gmail)
  8. resigned (any recovery)
  9. some other stuff perhaps (?)
installation
  1. as per any other rom & remember no questions!
  2. and if you got this far without finding the download link then you did not read the post!

md5 hash
27933619e3fa658a1db42286cd8f6c9c

enjoy




where is the download link to this rom with english...?
 

archangelugp

Member
Dec 22, 2008
40
0
Lake Forest, CA
Wow, thats was pleasant, way to slam a guy.

Did you really expect people not ask?

In all fairness, it does say in the original post that there are no questions, and also the Title of the post says specifically that its "Ready to Translate." It hasn't been translated yet...

where is the download link to this rom with english...?

"Ready to Translate".... It's still in Chinese.

It's been DeODEXed, so people willing to help translate can do it much more easily.
 

Dameon45

Senior Member
Dec 4, 2007
95
4
I wish i had google translate when i was in highschool spanish sleeping. It really would have helped a lot more than my portable translator from CVS!
 

NexuGsx

Senior Member
May 13, 2010
137
46
Is it english ready?

Then, four posts down:

where is the download link to this rom with english...?

Loled hard. I guess some people don't read.

EDIT: Went back to the "No, I'm A Bit of a Tool" link, this thread is hilarious.

Thanks djmcnz & Dai323. I'll have to try this guy out.
 

yamsyams

Member
Feb 2, 2010
12
0
<string name="breathing_light_color_title">跟踪球颜色</string> Trackball Flash Color
<string name="breathing_light_color_summary">在收到新通知时,跟踪球指示灯的颜色</string>Color of Trackball flash when new notifications are received
<string name="breathing_light_freq_title">跟踪球闪烁频率</string>Trackball Flash Frequency
<string name="breathing_light_freq_summary">跟踪球两次闪烁之间的停顿时间</string>Interval between consecutive flashes
<string name="trackball_wake_title">轨迹球点亮屏幕</string>Trackball Wake
<string name="battery_settings">电量设置</string>Power Settings
<string name="battery_settings_title">电量</string>Power
<string name="battery_indicator_style">状态栏电量样式</string>Battery Indicator Style
<string name="battery_low_level">低电量警戒值</string>Alarm Level for Low Battery
<string name="battery_saving_rules_title">自动省电规则</string>Power Saving Mode
<string name="battery_saving_rules_summary">当电量低于警戒值时将会应用的操作</string>Settings when battery level is below alarm level
<string name="battery_auto_saving_category_general">该页面所有修改将在下一次进入低电量时生效</string>All changes made will be effected the next time power saving mode is activated
<string name="battery_auto_saving">进入低电量警戒值的时候自动省电</string>Automatic Power Saving Mode
<string name="battery_setting_quick_entry">电量设置快速入口</string>Low Power Notification
<string name="battery_setting_quick_entry_summary">当低电量时,在状态栏下拉框中显示提示,并可点击进入当前设置页面</string>Notification will be shown when battery life is low. Click notification to enter Power Settings.
<string name="battery_auto_saving_category_rule">省电规则</string>Power Saving Options
<string name="battery_auto_saving_rule_brightness">降低屏幕亮度</string>Reduce Brightness
<string name="battery_auto_saving_rule_brightness_summary">亮度减少到最低,可以大量减少电池消耗</string>Screen Brightness is set to minimum. Can drastically decrease power draw
<string name="battery_auto_saving_rule_background_data">禁用后台数据</string>Disable Background Data Transfer
<string name="battery_auto_saving_rule_background_data_summary">节省电量的同时并可以节省网络流量费用</string>Reduce power draw and data charges
<string name="battery_auto_saving_rule_auto_sync">禁用自动同步</string>Disable Sync
<string name="battery_auto_saving_rule_auto_sync_summary">关闭联系人、邮件等帐户同步</string>Disable Syncing of Contacts, Mail, etc
<string name="battery_auto_saving_rule_apn">禁用移动网络</string>Disable Mobile Data
<string name="battery_auto_saving_rule_apn_summary">关闭GPRS、3G等数据连接</string>Disable mobile networks such as GPRS and 3G
<string name="battery_auto_saving_rule_wifi">禁用WiFi无线网络</string>Disable Wifi
<string name="battery_auto_saving_rule_wifi_summary">可以大量减少电池消耗</string>Can drastically reduce power draw
<string name="battery_auto_saving_rule_bluetooth">禁用蓝牙</string>Disable Bluetooth
<string name="battery_auto_saving_rule_bluetooth_summary">可以大量减少电池消耗</string>Can drastically reduce power draw
<string name="battery_auto_saving_rule_gps">禁用GPS卫星定位</string>Disable GPS
<string name="battery_auto_saving_rule_gps_summary">可以避免后台程序使用GPS的电量消耗</string>Disable background usage of GPS
<string name="battery_auto_saving_rule_vibrate">禁用震动</string>Disable Vibrations
<string name="battery_auto_saving_rule_vibrate_summary">震动在一般情况下消耗电量不多,但是在电量低的时候能省一点是一点</string>Vibrations do not consume much power under normal usage. (I took the liberty of leaving out the last part which basically says that "But when your battery is low it helps, however minimally."
<string name="battery_auto_saving_rule_haptic">禁用触感反馈</string>Disable Haptic Feedback
<string name="battery_auto_saving_rule_haptic_summary">原理同上</string>Refer to Vibrations
<string name="battery_auto_saving_rule_wallpaper">禁用动态壁纸</string>Disable Live Wallpapers
<string name="battery_auto_saving_rule_wallpaper_summary">动态壁纸会大量消耗电量还会拖慢系统速度</string>Live Wallpapers are significant sources of power draw and may cause system lag
<string name="battery_auto_saving_rule_screen_time_out">缩短屏幕超时设置</string>Reduce Screen Timeout
<string name="battery_auto_saving_rule_screen_time_out_summary">超时设置减少到最低,可以一定程度减少电池消耗</string>Reduce screen timeout interval to minimum. May help with battery life.
<string name="battery_auto_saving_rule_cpu">降低CPU频率</string>Reduce CPU Speed (Frequency?)
<string name="battery_auto_saving_rule_cpu_summary">可以减少“山寨”程序在锁屏时产生的CPU耗电</string>May reduce power draw from rogue applications when locking the screen
<string name="battery_auto_saving_category_practise">想更省电?</string>Want to save more power? (Direct translation. May be better as "Extending your battery life"
<string name="battery_auto_saving_practise">省电小技巧</string>Tips on Maximizing Battery Life
<string name="battery_auto_saving_practise_summary">1 平时尽量减少后台运行的程序\n2 除非强光下,平时没必要使用最高亮度\n3 睡觉时可以考虑设置飞行模式</string>1.Limit number of applications that run in the background. 2.Unless under bright light, there is no need for maximum brightness. 3.Consider activating Flight Mode at night.
<string name="battery_auto_saving_practise_more">到论坛查看更多省电技巧></string>Check out more power saving tips at the forums
<string name="sd_ext_memory">A2SD+</string>A2SD+
<string name="usage_type_power">耗电量</string>Battery Use (I have no idea what this actually does, but I'm guessing a battery usage breakdown by app)
<string name="current_ime">当前输入法</string>Current Keyboard
<string name="experimental_settings">开发人员专用设置,普通用户使用后果自负</string>Developer settings only. Use at own risk.
<string name="experimental_category_control_title">系统控件</string>System Controls
<string name="overscroll_mode_title">列表弹性缺省风格</string>Lists Overshoot
<string name="menu_style_title">菜单风格</string>Menu Styles
<string name="experimental_category_launcher_title">桌面</string>Homescreen (Launcher may work better here, I'd need to actually see what it does first)
<string name="app_icon_background_title">启用图标背景</string>Icon Backgrounds on Homescreen

I take it that you wanted these translated!

I have no experience with actually working with Android ROMs, however, so this is as far as I can go. But I'd be happy to translate others if someone posts them.

Edit: Ninja'd by Google Translate while I was working on this. I have to say I'm pretty darn impressed by the accuracy of Google Translate now, as opposed to like a year ago when it just spews out random crap.
 
Last edited:

britoso

Senior Member
Jan 13, 2010
2,791
301
Orlando
Another great kang :D. Should be called 'miui-kang'

Has anyone verified darktremor a2sd works ?
Also are the trackball led alerts configurable?
(yes I dare!!)


hooray for the "enable the icon background" option :)
 
Last edited:
Status
Not open for further replies.

Top Liked Posts

  • There are no posts matching your filters.
  • 5
    Hello. Anyone can help me?

    When i try to connect to WPA2_ENTERPRISE wifi always display DISCONNECT.
    But with THE same configuration file in Cyanogenmod ROM works perfect!

    I try to configure wpa_suplicant.conf manually, mutiple roms but don't work. Only CYANOGENMOD.

    Anyone knows why?
    3

    MIUI ROM from the Far East
    Official Links
    MIUI English Site: http://en.miui.com/
    MIUI Download Site: http://www.miui.com/download.html

    Other Sites
    Russian Support: http://4pda.ru/forum/index.php?showtopic=197606
    Spanish Support: http://miui.es/
    Italian Support: http://www.nexus-lab.com/miui-rom-italian-packs/
    Additional English Support: http://forums.miui-dev.com/
    Some North American love: http://miui.us/


    Translation Instructions in Third Post

    PM me if this post needs updating!​
    3
    [HOW TO] Create a MIUI Language Pack

    Okay guys, there's a lot of demand for this rom and for language packs but not yet a lot of people who know how to make the packs. Whilst I set up the crowdin translation project I can not create or maintain language packs.

    So, here's a summary of the instructions required to create a language pack for MIUI (indeed for any app/rom). You need a collection of tools and a little patience but the process isn't too difficult so do give it a go.

    Also note that this summary includes generalisations for brevity. These instructions assume you have a deodexed rom.

    Introduction
    For the purposes of this post language information is stored in XML strings in files on the Android system. In the case of MIUI and these instructions we will be dealing with .apk files (applications).

    Within the apk files is a resources directory (/res) and within this are various values directories, there is a default values directory (/res/values) and alternative language values directories (e.g. /res/values-DE and /res/values-IT).

    If the rom is set to use it's default language it will read values from /res/values although these may NOT be in English. In MIUI, all of the common Android ASOP values in /res/values are English but the (additional) custom MIUI strings are in Simplified Chinese.

    If you select a different language in the ROM than the default then the appropriate values directory will be searched. If a suitable string that matches your language selection is found in the alternative /res/values-xx directory then that string will be used instead. If an alternative does not exist then the default will be used.

    Example:

    Code:
    /res/[COLOR="red"]values[/COLOR]/strings.xml
    <stop_button_text>[COLOR="Red"]Stop[/COLOR]</stop_button_text>
    
    /res/[COLOR="red"]values-DE[/COLOR]/strings.xml
    <stop_button_text>[COLOR="red"]Halt[/COLOR]</stop_button_text>
    
    /res/[COLOR="red"]values-IT[/COLOR]/strings.xml
    <stop_button_text>[COLOR="red"]Basta[/COLOR]</stop_button_text>

    In this example, if the language is set to the default the word "Stop" will be used, if it is set to German the word "Halt" will be substituted in, likewise "Basta" for Italian.

    So, to add languages to a rom (or app) or to make an app multi-lingual you need to either change the default strings in /res/values/strings.xml to the ones you want to use or, and this is the preferable approach, add a /res/values-xx/strings.xml with the translations you want. The first approach will work (changing the default strings) but is not recommended because the Android Open Source Project and Android development in general, defaults to English. It's best to use the built in language substitution capabilities of Android rather than to work around them. Indeed, if the MIUI devs actually added their strings in English to /res/values/strings.xml and the Chinese equivalents in the appropriate directory this rom would already be in English!

    Adding Languages
    To add a translation file (strings.xml) to an apk you need to:

    1. decode the apk
    2. create a language directory
    3. add the translation files
    4. recompile the strings
    5. add the new strings to the apk

    Which all sounds a little daunting but it's really quite straight-forward, rewarding when you see the result and a good way to understand how parts of Android work. Here's how you can do it.

    1. decode the apk
    You will need the excellent apktool from brut.all which you can get from the link below. apktool is relatively easy to use but includes some little tricks so you will need to read the wiki and thread about it.

    Do NOT just post problems about apktool if you can't get it to work. The tool DOES work so if it's not decoding (or encoding) your apps correctly then you're probably doing something wrong. If you start with this understand BEFORE you ask for support you'll get a lot more help... :)

    apktool: http://code.google.com/p/android-apktool/
    wiki: http://code.google.com/p/android-apktool/w/list
    thread: http://forum.xda-developers.com/showthread.php?t=640592

    Please make sure you run the following command to include the MIUI framework in apktool. You only need to do this once for each framework. If apktool works with one rom and not the next then (re)install the framework for that rom.

    Code:
    apktool if framework-res.apk

    Where framework-res.apk is the one from the rom you are working with. Make sure apktool can find (the correct) framework-res.apk before you run this command.

    This thread is not for apktool support.

    Now, before you proceed, decode a simple app from MIUI (such as updater.apk) using apktool, do not make ANY changes, then re-encode it using apktool. For example:

    Code:
    apktool d Updater.apk ./decoded/
    apktool b ./decoded/ new_updater.apk

    Use the -v (verbose) flag in apktool if you have problems and need to diagnose further.

    Remember, Android uses a case-sensitive file system, make sure your capitalisation is correct.

    Typically you will not be able to install this apk because it is not signed so if you want to test the process further you can now just try step 5 below using the two apks you have.​

    2. create a language directory
    Assuming you can decode/encode now, this is the easy bit. For your decoded app, navigate to the directory it was decoded in, then to the /res/ directory and simply create an empty directory for your language (e.g. /values-FR/) - use international naming conventions.

    3. add the translation files
    Again, not too difficult this. Download the appropriate language file for your apk from the crowdin project linked below and, using the same structure as exists in /res/values/strings.xml create a new file called strings.xml in your alternative language directory (e.g. /res/values-ES/strings.xml).

    The news strings.xml may contain as many or as few translations as you like. Remember, if a translation does not exist the default value from /res/values/strings.xml will be used.

    Crowdin: http://crowdin.net/project/miui-rom-translation/invite

    The xml formatting and tag names need to match exactly with the default strings.xml in /res/values although the translated file does NOT need to be complete.

    It is worth remembering here that unless your source apk is already translated to English then some of the default values in /res/values/strings.xml will still be in Chinese, it would pay to check these.​

    4. recompile the strings
    Now, if you've done everything carefully and correctly this step is really easy, all you need to do is recompile the apk with apktool using the b (for Build) switch.

    Code:
    apktool b ./<decoded_apk_dir>/ <output_apk_name>.apk

    If this throws errors or does not work then use the -v switch to turn on verbose mode and diagnose your problem. If you did the test in step #1 and it worked then any problem at this step is likely related to your news strings.xml. Back out the changes one by one until you have found the problem and try again.

    If you simply can't get it to compile with your changes then try just making a single change to the default strings.xml file in /res/values and see if that works for you.

    Do NOT sign the apk!​

    5. add the new strings to the apk
    Easy. Open your new apk with a zip program (like 7Zip for Windows) and copy out the resources.arsc file in the root directory of the apk. Now take that file and copy it into the source apk from the rom overwriting the existing one. This process replaces the strings but keeps the integrity of the signatures on the files.

    You can now push the modified file to your phone, replacing the stock one, reboot and you're translated. Push the file using "adb push" or copy it into place using a root file manager, do not "install" the new apk. Make sure you put it in the correct place (replace the original) and reboot.​

    Conclusion
    This process will help you add languages to any app including those in the MIUI rom. Because it's a rom the strings are contained in many different apps as well as framework-res.apk. To completely translate the rom you will need to edit every apk that has strings in it.

    You will need to do this every time an apk in the rom changes. If a new version is released and say launcher2.apk is changed but updater.apk is not, then you can retain your updater.apk but you'll need to re-edit your launcher2.apk.

    When an app changes the default strings.xml may also change. In this case you will need to make corresponding changes to your translations.

    Good luck and if you get really stuck there's lots of people in this that have achieved success and may be willing to help!
    HOW TO SPEED-UP THE TRANSLATION-PROCESS:

    I've created a simple application (java-based) which tries to merge orginal-froyo-translation (taken from the official repository) into the miui-value-files. (only strings.xml are currently supported).

    This program is available here:
    http://www.multiupload.com/HVZXDBHIVU


    How it work / what you have to do:

    1) Extract the Translator.tar.gz file (windows-users use winrar or whatever) - a directory named "Tanslator" will be created.

    2) Extract the strings.xml file from the miui-package you want to translate.
    This can be done with the apk-tool: apktool -d Contact.apk Contact_decoded
    Copy the "res/values/strings.xml" to the created "Translator"-direcory. Open that folder and rename (the previous copied) strings.xml to "untranslated.xml".

    3) Copy the strings.xml from the official froyo-sources for the package and the language you want to "merge" to the "Translator"-directory and rename the string.xml-file to "translation-file-from-froyo-repo.xml".

    4) Run the program. Open a command-prompt/console. Change directory into the "Translator"-Directory and run:
    java Translator untranslated.xml translation-file-from-froyo-repo.xml
    This will generatre a file named "translated.xml"

    For some safety reasons not all string which match "by key" are merged. (Stuff wich contains characters like '<' or '%'). You probably see some warnings printed in console (with the key) that needs to be translated manually.
    If you want to override this "safety-featiure". Run the app with:
    java Translator untranslated.xml translation-file-from-froyo-repo.xml psycho
    (psycho at the end)

    Hope this helps somehow.
    2
    Ok, if you are on the stock MIUI it hasn't nothing to do with language packs.

    I've seen that the file /Contacts/res/values/ids,xml is not equal than the 0.10.15 file. Can be a thing to watch?

    Could you please post to pastebin.com the ids from .15 and .22 please so we can check and compare?

    Also, pellix what is your location etc, same question I asked of Andrew


    Thanks,

    M
    1
    Hey Guys!

    Coming from G2 forums, I thought I'd post this guide I put together for all MIUI community;

    http://forum.xda-developers.com/showthread.php?t=1217527
Our Apps
Get our official app!
The best way to access XDA on your phone
Nav Gestures
Add swipe gestures to any Android
One Handed Mode
Eases uses one hand with your phone