GLBasic forum

Main forum => Bug Reports => Topic started by: BdR on 2012-Mar-04

Title: Android PLATFORMINFO$("LOCALE") returns "un".. bug?
Post by: BdR on 2012-Mar-04
While testing GLBasic with Android, I noticed that PLATFORMINFO$("LOCALE") gives different codes on Android compared to iPhone. For example Dutch/Netherlands = "ne" instead of "nl" and Deutsch/Schweiz = "sc" instead of "sw", Dansk = "da" instead of "dk", english (both UK and USA) = "un"(?) etc. I've tested it on the emulator on Android 2.2 and 4.0.3 but it probably works the same on real devices.

I suspect PLATFORMINFO$ on Android takes the first two letters of the country name, instead of the language code. That would explain why "united states" and "united kingdom" both return "un". It does work correctly for Deutsch,France,Espanol etc. but with those country names the first two letters are the same as the language codes.
Title: Re: Android PLATFORMINFO$("LOCALE") returns "un".. bug?
Post by: Wampus on 2012-Mar-05
Oh. Good guess. I'm guessing you're right. :)
Title: Re: Android PLATFORMINFO$("LOCALE") returns "un".. bug?
Post by: spacefractal on 2012-Mar-06
it's how different os handle the county codes. This due there is different country naming standards...

I gonna think its was mention about it in help file?

However a function convert da to dk and such is best idea...

Ps. Misread your thread: Yes the in might been a bug for us and uk, but should not affect the game at all?
Title: Re: Android PLATFORMINFO$("LOCALE") returns "un".. bug?
Post by: Kitty Hello on 2012-Mar-06
"...GLBasic\Compiler\platform\android\templateproj\src\com\glbasic\test\SDLActivity.java"

Line 90:
replace with:
Code (glbasic) Select

   java.util.Locale.getDefault().getLanguage(), // getDisplayCountry()


Delete the distribute/android directory and rebuild.
Does it work?
Title: Re: Android PLATFORMINFO$("LOCALE") returns "un".. bug?
Post by: BdR on 2012-Mar-06
Okay, I tried changing the line like you said and I deleted distribute/android folder, but then I get this new error message
Code (glbasic) Select
_______________________________________
*** Configuration: ANDROID ***
precompiling:
GPC - GLBasic Precompiler V.9.829 SN:28aaf7cf - 3D, NET
Wordcount:487 commands
compile+link:
running Android build-script...
BUILD STAGE 1: Compile and pack RELEASE

BUILD FAILED
Q:\Compiler\platform\android\android-sdk-windows\tools\ant\build.xml:580: The following error occurred while executing this line:
Q:\Compiler\platform\android\android-sdk-windows\tools\ant\build.xml:602: Compile failed; see the compiler error output for details.

Total time: 3 seconds
.
BUILD STAGE 2: Build DEBUG and install on device

BUILD FAILED
Q:\Compiler\platform\android\android-sdk-windows\tools\ant\build.xml:580: The following error occurred while executing this line:
Q:\Compiler\platform\android\android-sdk-windows\tools\ant\build.xml:602: Compile failed; see the compiler error output for details.

Total time: 2 seconds
finished Android build-script.
Android=D:\programming\GLBasic\iphonetest\distribute\Android
success
_______________________________________
*** Finished ***
Elapsed: 12.3 sec. Time: 22:34
Build: 1 succeeded.


When I then restore the old SDLActivity.java file (without the changed line) and press Project->Clean Up, and then try again it works again..  :blink:

EDIT:
I just realised something, maybe the backup file I made was causing this error? At the time of compile I had two files in that folder (..android\templateproj\src\com\glbasic\test\ )

SDLActivity.java <- file with the changed line
"Copy of SDLActivity.java" <- backup of original file

So both have the .java extension and maybe GLB tries to include both files? Could that perhaps be what is causing the error? I'm not at home right now so I'll try again tonight.
Title: Re: Android PLATFORMINFO$("LOCALE") returns "un".. bug?
Post by: Kitty Hello on 2012-Mar-07
it compiled here. I'm using the Android SDK from... uhm... no idea...
Title: Re: Android PLATFORMINFO$("LOCALE") returns "un".. bug?
Post by: spacefractal on 2012-Mar-07
Yes it's might have compiled both java twice, so you should move backup out of folder. It's did compile fine here.
Title: Re: Android PLATFORMINFO$("LOCALE") returns "un".. bug?
Post by: BdR on 2012-Mar-07
Okay that was it. When I have just the 1 .java file and no backup file in that folder, then it compiles like normal again.

Anyway, changing the getDisplayCountry() to getLanguage() fixes the problem. Then PLATFORMINFO$("LOCALE") gives "nl" for Netherlands/Dutch, "de" for German, "de" for German/Schweiz, "fr" for French/Belgique, "pl" for Polish etc. which is all correct. :good:

Btw it now gives "us" for English (both United States and United Kingdom) and "da" (not dk) for Danish but I guess that's due to a slightly different ISO codelist. :doubt:
Title: Re: Android PLATFORMINFO$("LOCALE") returns "un".. bug?
Post by: spacefractal on 2012-Mar-07
yep danish have both DA og DK as code set, so you should support both. hence its would been cool with a lest of countries with different codesets and convert them to a main isoset...
Title: Re: Android PLATFORMINFO$("LOCALE") returns "un".. bug?
Post by: Kitty Hello on 2012-Sep-05
ok, fixed in V11