[ROM] MIUI | Stock | Language & Discussion Thread

Status
Not open for further replies.
Search This thread

mobiousdigital

Senior Member
Feb 3, 2010
671
7
k?

I thought it was discovered to be in default.prop?

Sadly no, if you getprop for the sys.timezone it returns the desired locale info, Market also returns the correct en_GB content in terms of what we'd expect in the databases for com.google.vending.

Locales all appear for my country en_GB so there's no direct interception there that can be seen.

gsm.operator.numeric is also valid and 234 (UK) 10 (O2 UK) which is how the market is "Supposed" to deal with Market location.

On one occasion I got the Market showing US$0.00 now it just defaults straight to $0.00 or ~$0.00

As stated to save other theories, Market Enabler and scripts wont work as gsm.sim.operator is correctly set for my region. I am at a major loss as to how and why the Market will not give people their native country locales and application / pricing.

Very frustrated about this as MIUI developers only (quite rightly) care for their own language "Chinese". While I am sure they love that we're using the ROM and translating, without any github sources to help us fix problems we are out of luck and very much at the direct mercy of MIUI developers for answers.

Cyanogen i am sure is too busy with other things, Paul O'Brian did chime in with some suggestions however we hit a dead end yesterday on this as the suggestions merely related to Market Enabler style fixes.

As I say build.prop, market enabler, gsm.sim.operator fixes will NOT work, its pointless people reporting that build.prop solves problems, its hyped up and not factually correct.

I really wish there was a stronger "developer" drive behind this ROM so we could hopefully get more done.

Translating the system has been a blast, loved it but really I think its time to move on until more can be done with the source code of this system.
 

djmcnz

Retired Recognized Developer
Oct 13, 2009
5,747
1,689
Auckland, NZ
OnePlus 8
Google Pixel 8
Sadly no, if you getprop for the sys.timezone it returns the desired locale info, Market also returns the correct en_GB content in terms of what we'd expect in the databases for com.google.vending.

Locales all appear for my country en_GB so there's no direct interception there that can be seen.

gsm.operator.numeric is also valid and 234 (UK) 10 (O2 UK) which is how the market is "Supposed" to deal with Market location.

On one occasion I got the Market showing US$0.00 now it just defaults straight to $0.00 or ~$0.00

As stated to save other theories, Market Enabler and scripts wont work as gsm.sim.operator is correctly set for my region. I am at a major loss as to how and why the Market will not give people their native country locales and application / pricing.

Very frustrated about this as MIUI developers only (quite rightly) care for their own language "Chinese". While I am sure they love that we're using the ROM and translating, without any github sources to help us fix problems we are out of luck and very much at the direct mercy of MIUI developers for answers.

Cyanogen i am sure is too busy with other things, Paul O'Brian did chime in with some suggestions however we hit a dead end yesterday on this as the suggestions merely related to Market Enabler style fixes.

As I say build.prop, market enabler, gsm.sim.operator fixes will NOT work, its pointless people reporting that build.prop solves problems, its hyped up and not factually correct.

I really wish there was a stronger "developer" drive behind this ROM so we could hopefully get more done.

Translating the system has been a blast, loved it but really I think its time to move on until more can be done with the source code of this system.

I see, that's pretty comprehensive.

You could try pushing Vending.apk and -R /data/data/com.android.vending/* from a working 2.2 rom (any one) to a MIUI install to eliminate anything they've done with the app (clear market data and force stop market app on the MIUI - target - phone first). You'll probably need to run fix permissions before the app starts or it will probably fc.

Long shot really though.
 

mobiousdigital

Senior Member
Feb 3, 2010
671
7
I see, that's pretty comprehensive.

You could try pushing Vending.apk and -R /data/data/com.android.vending/* from a working 2.2 rom (any one) to a MIUI install to eliminate anything they've done with the app (clear market data and force stop market app on the MIUI - target - phone first). You'll probably need to run fix permissions before the app starts or it will probably fc.

Long shot really though.

Tried that as well, arcee on #cyanogenmod suggested this to me the other night, sadly got force closes all over the place and market still displayed in USD $.

My feeling therefore is that some sub-command in the framework is at fault here, why does NO DEVELOPER have a clue on this?

It amazes me no one has any ideas on why this is happening, we can root phones, do some other amazing things but we can't get Market to work for our country? WTF! I'm in despair mode!
 

djmcnz

Retired Recognized Developer
Oct 13, 2009
5,747
1,689
Auckland, NZ
OnePlus 8
Google Pixel 8
Tried that as well, arcee on #cyanogenmod suggested this to me the other night, sadly got force closes all over the place and market still displayed in USD $.

My feeling therefore is that some sub-command in the framework is at fault here, why does NO DEVELOPER have a clue on this?

It amazes me no one has any ideas on why this is happening, we can root phones, do some other amazing things but we can't get Market to work for our country? WTF! I'm in despair mode!

Did you run fix permissions? FC's are expected with the above procedure until you run fix permissions. Best to push in recovery and execute fix permissions from there.

Not much value in a dev looking at it until you can localise the problem... too much effort, little return (for the dev that is). If you can localise the issue we could possibly debug/trace it if it was in the ASOP bits of code.
 

mobiousdigital

Senior Member
Feb 3, 2010
671
7
Did you run fix permissions? FC's are expected with the above procedure until you run fix permissions. Best to push in recovery and execute fix permissions from there.

Not much value in a dev looking at it until you can localise the problem... too much effort, little return (for the dev that is). If you can localise the issue we could possibly debug/trace it if it was in the ASOP bits of code.

I didnt do that no, I didnt see the point as the market still did not display Apps UK nor did it show them in the correct price format e.g. £

How can we localise the problem when we don't know what the problem is. I've spent about 1.5 weeks on this problem to fix for everyone but feel I have failed. I can't see a way forward with this, MIUI developers clearly are not concerned enough in the grand scheme of things (as I say who can blame them they support China and thats it!).

So recapping my attempts for this fix:

1. Modified build.prop fingerprints, build id, product name etc [NO SUCCESS]
2. Modified Locales with More Locales2, confirmed en_GB is set [NO SUCCESS]
3. Confirmed gsm.operator.numeric is set to country specific code of 234 (UK) 10 (O2 UK) [NO SUCCESS]
4. Tried Market Enabler (This fakes the gsm.operator.numeric) (Scripts which claim to do the same thing also use same method from .sh / command line) [NO SUCCESS]
5. Checked Vending.apk databases android_metadata = en_GB [SEEMS CORRECT]
6. Checked Vending.apk databases in /data/data/com.android.vending/databases/billing.db (sim_identifier = Long string) [NOT RELEVANT IT SEEMS AS DIFFERENT PER-DEVICE EVEN IN SAME LOCALE]
7. Checked Vending.apk databases in /data/data/com.android.vending/databases/webviewCache.db (link = http://www.google.com/intl/en_GB/android/market-tos.html [SEEMS CORRECT]
8. Tried GAPPS default Vending.apk as used and working in CyanogenMod 6.0 N1 [NO SUCCESS]
9. Checked all locales / timezone details (All correctly returned by getprop en / GB) default.prop does not seem to be enforcing anything to do with Location based services.


During each test caches and data were purged, reboots made etc etc. Maybe people can now see how frustrating this problem is! :-(
 
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://xdaforums.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://xdaforums.com/showthread.php?t=1217527