Localization for iOS devices

rob1221

  • *
  • Posts: 9195
Try PMing Justin about that OpenFL update as I guess he isn't following this thread.

Max Finch

  • *
  • Posts: 2180
Did, seems to be ignoring it.

Oh well, I'll figure something else out.

Ogiul

  • Posts: 229
Please Max, if you find a solution share it  here, I have  the same problem. Thanks!

Justin

  • *
  • Posts: 4009
Sorry, I'm not very good at letting people know that I haven't done what I said I would. I'm away from my primary computer for an extended period of time right now, so I'm not in a good position to update lime/openfl. I probably won't be able to for the next three weeks.

For Live Support: Join our discord channel and ping me @justin.

Max Finch

  • *
  • Posts: 2180
Do I just need to update that one file? Or will the whole thing need to be updated?

Ogiul

  • Posts: 229
There is something new.
Today I have updated to the 8343 customer only build and my game does not crash anymore either on iOS Stencyl simulator and on an actual iOS device (on my ipad3 retina iOS 7.1).
The problem is the "nme.system.Capabilities.language" code dos not work anymore: it looks like it does not return "it" for italian and "eng" for english...


I've cancelled here above, because my game was not crashing anymore only because Stencyl was not reading my language setting behavior.
Probably a block was not actually snapped and so I had the impression something new was happening, but in the reality the bug was and is still there.

« Last Edit: April 26, 2015, 08:17:57 am by Ogiul »

mat0pad

  • Posts: 364
There's another simple way not as precise but it's what I use.
Create a text attribute called "language".
Create another text attribute called "response"
In a vistURL block write this URL: http://ip-api.com/json
Now below visitURL set the text attribute "response" (the one you just created) to the vistURL response.

Now below in a code block write this:
Code: [Select]
var owresponse : Dynamic = haxe.Json.parse(_response);
 _language = owresponse.countryCode;
         
Now you can print the text attribute you created "language"
When you do this you will see the language in a country code format.

So DK meaning Denmark ~ Danish, US ~ English and so on...

« Last Edit: April 28, 2015, 09:18:33 am by mat0pad »
   


                              

Ogiul

  • Posts: 229
Thank you so much mat0pad!!!

I have tried your way and it doesn't  crash my game either on the iOS simulator and on my actual ipad.
It also returns correctly IT for Italy, when the device is connected to internet.

It could potentially fix my problem for now...

Unfortunately I can not actually use this behavior because I can not have this "IT" actually stored in a game attribute.
I have written: if Language=IT set GameAttributeLanguage to it , but it seems the game does not actually sett the game attribute to the value "it" and it keeps the default value "eng".

The behavior using "nme.system.Capabilities.language" crashes on iOS simulator in 95% of tests, but not always, which is also quite strange, while on my real ipad it works ever and fine. Deactivating the part of behavior where the code is avoids the crash in 100% of the tests.

I am starting to think my game has problems related to game attributes and these problems do not depend on my behavior. I have other strange crashes probably depending by behaviors not actually executed in my game.

mat0pad

  • Posts: 364
Please post a screenshot of your code/behavior and I'll take a look
   


                              

Ogiul

  • Posts: 229
Thank you mat0pad!!! Apparently attributes haven't been working from Sunday at last (http://community.stencyl.com/index.php/topic,40762.msg228909.html#msg228909). :o

I will retry to use your behavior when I am sure attributes work fine. For now it is not worth somebody spend time on it.  ;D

Again, thank you so much for your offer  :D and I will post the behavior only when it does not work when Stencyl works.

captaincomic

  • *
  • Posts: 6109
Is
Code: [Select]
openfl.system.Capabilities.languagestill crashing on iOS for y'all?

Ogiul

  • Posts: 229
Hi captaincomic, sorry yesterday I had the impression everything was solved so I posted an entusiastic answer and cancelled my previous post here and then, when I noticed I was wrong, I had to cancell everything and repost the message above. This is why the message above is from yesterday.

The "openfl.system.Capabilities.language" code is still crashing for me on the iOS simulator also in a sample game and on my actual ipad it is working just fine. ::)

I would like also to try again the mat0pad code, but attributes disappared from Stencyl 8357.
I will update to the new 8359 and I will let you know.

« Last Edit: April 30, 2015, 04:32:58 am by Ogiul »

Ogiul

  • Posts: 229
On build 8360:
If I put in a sample  game a scene with this behavior the game crashes on the IOS simulator and does not crash on my device.

Behavior description:
Block When created with a print block inside
In the print block there is a code block
In the code block is written: openfl.system.Capabilities.language

Here attached you can find the sample game.

captaincomic

  • *
  • Posts: 6109
Added "openfl.system.Capabilities.language" as a "language" block to the palette (b8916).

Accoring to the lime changelog the crashing has been fixed on their end.