Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat
Attempt on Localization - Page 2 - Gideros Forum

Attempt on Localization

245

Comments

  • @mysps I don't think that Gideros's Application:getLocale is tied up to settings in xcode, but more checking the settings on your device.
    As in if you change the locale of your device, it should also change the locale that Application class returns
  • I'm using @bowerandy BhLocale and it's working out nicely. My question is, what does one do for Arabic locales? First, what font should be used? And is there an acceptable "standard" Arabic? Do you make a locale file for each locale (ar_AE.lua, ar_EG.lua etc.) but make all their contents the same?
    BTW, I'm using this as a reference for locales : http://pic.dhe.ibm.com/infocenter/forms/v3r5m1/index.jsp?topic=/com.ibm.form.designer.locales.doc/i_xfdl_r_formats_tr_TR.html
  • @mysps,
    For itunes connect to recognize multiple locales, you need to set the pList (which your screenshot above shows has been done). This will show based on the locale set on the system. In your application, you have to check what locale is present on the system and then swap/switch to it accordingly.

    What do you mean by "doesn't work for me"

    @chipster123, I think as long as you get the unicode characters right and the fonts contain the arabic characters, you are good to go. I think that you can set all the same based on ar_XX. There are slight variations in the language based on regions, just like there are even in English, Thongs in Australia are what the Americans call the Flip-Flops, and thongs are used differently there than to wear on your feet.

    Likes: chipster123

    twitter: @ozapps | http://www.oz-apps.com | http://howto.oz-apps.com | http://reviewme.oz-apps.com
    Author of Learn Lua for iOS Game Development from Apress ( http://www.apress.com/9781430246626 )
    Cool Vizify Profile at https://www.vizify.com/oz-apps
    +1 -1 (+1 / -0 ) Share on Facebook
  • @Chipster123, while that resource from IBM is a good reference point, are you sure that it works for you on the iOS devices? For ZDay I had to get Chinese and English working, with Chinese, I can see zh_Hans_XX and zh_Hant_XX but I had to just use the zh_Hans or the zh_Hant (which is Hans for simplified and Hant for traditional, we went with simplified only)

    Likes: chipster123

    twitter: @ozapps | http://www.oz-apps.com | http://howto.oz-apps.com | http://reviewme.oz-apps.com
    Author of Learn Lua for iOS Game Development from Apress ( http://www.apress.com/9781430246626 )
    Cool Vizify Profile at https://www.vizify.com/oz-apps
    +1 -1 (+1 / -0 ) Share on Facebook
  • @ozapps.. Yes, I've worked with localized projects in the past using xcode and change the device language but it doesnt seem to work. if thats what you mean

    Is that all that I had to do? its the only thing holding me back from release although i could release it half @ss without localization but this specific app would be better to cater to other languages.
  • @mysps, there are two things
    1. iTunes recognizing that the app supports multiple localizations
    2. Your app working in multiple languages as per the locale of the device.

    for #1, that is all you need to do

    for #2, obviously, you need to translate all the strings, messages, etc does not happen automatically.

    if this is not what you meant, I am lost on what exactly are you stuck at and suggesting.
    twitter: @ozapps | http://www.oz-apps.com | http://howto.oz-apps.com | http://reviewme.oz-apps.com
    Author of Learn Lua for iOS Game Development from Apress ( http://www.apress.com/9781430246626 )
    Cool Vizify Profile at https://www.vizify.com/oz-apps
  • chipster123chipster123 Member
    edited November 2013
    8-}

    Do I have this correct:

    for #1, for iTunes to recognize the app supports multiple locales, it's handled entirely in the XCode project tree via InfoPlist.strings files. Is that right?

    And for #2, we handle switching strings that are displayed while the app is running entirely within Gideros. Is that right?

    Then my follow-up questions are:

    A. Can someone point me to the iOS information for setting up the InfoPlist.strings ?
    B. Is there something we need to do for Android (GooglePlay and/or Amazon) to make those app stores recognize localization supported?
  • @chipster123,
    #1 -> Yes
    #2 -> Yes

    A -> Localization (See image)
    B -> Keine ahnung, No idea...

    Likes: chipster123

    Screen Shot 2013-11-21 at 2.06.10 PM.png
    461 x 77 - 13K
    twitter: @ozapps | http://www.oz-apps.com | http://howto.oz-apps.com | http://reviewme.oz-apps.com
    Author of Learn Lua for iOS Game Development from Apress ( http://www.apress.com/9781430246626 )
    Cool Vizify Profile at https://www.vizify.com/oz-apps
    +1 -1 (+1 / -0 ) Share on Facebook
  • Hmm, on Android you can define localized strings in res/values, but I don't think there is a special need to define which locales will be used

    Likes: chipster123

    +1 -1 (+1 / -0 ) Share on Facebook
  • How to change language manually? Not inside init, but using in-game options?
  • Commited to github new version, added function
    Localize.changeLocale("ru_RU")

    Likes: unlying

    +1 -1 (+1 / -0 ) Share on Facebook
  • Great! Thanks!
    But when i'm trying to change from, for example "fr_FR", to "en_EN" nothing happens.
    I have a file for "fr_FR". I thought that after changing locale to smth that i don't have it will use default text. But it doesn't. How to return to default?
  • I see, commited a fix, that will reset already loaded data, meaning if provided locale won't be found, it should use default values

    BUT...

    already replaced string won't be replaced back, as in if you already displayed scene as fr_FR, then you should reload the scene after changing locale

    Likes: unlying

    +1 -1 (+1 / -0 ) Share on Facebook
  • It works! Thanks!
  • myspsmysps Member
    edited November 2013
    @mysps I don't think that Gideros's Application:getLocale is tied up to settings in xcode, but more checking the settings on your device.
    As in if you change the locale of your device, it should also change the locale that Application class returns
    How do I tie it up to the settings in xCode?
  • myspsmysps Member
    edited November 2013
    @mysps, there are two things
    1. iTunes recognizing that the app supports multiple localizations
    2. Your app working in multiple languages as per the locale of the device.

    for #1, that is all you need to do

    for #2, obviously, you need to translate all the strings, messages, etc does not happen automatically.

    if this is not what you meant, I am lost on what exactly are you stuck at and suggesting.
    @OZApps
    In my screenshot I've tried to set it up in plist and the strings are translated with an Image. I'm not translating text. I have the images set like: image_en.png image_es.png etc

    Im stuck as well, trying to understand because I did follow the github and it seemed pretty simple.
  • @mysps,
    Localization does not happen automatically like retina high resolution graphics. By naming an image it will not do anything automatically.

    When you say GitHub, I am lost but I think you are referring to some Gideros Code that helps you do localization (I am not aware of this)

    How I would manage this is

    somewhere in the start of my program, I would get the locale of the device, this would help me determine what language and localizations are running on my phone, save this two letter code to a variable.

    then on, I would either use multiple if..then statements or construct strings that would incorporate the locale code in it.

    Just so that you are clear and understand this, your app can be an English only app on the app store but have the functionality to swap languages, because these are two different things and totally unrelated.
    twitter: @ozapps | http://www.oz-apps.com | http://howto.oz-apps.com | http://reviewme.oz-apps.com
    Author of Learn Lua for iOS Game Development from Apress ( http://www.apress.com/9781430246626 )
    Cool Vizify Profile at https://www.vizify.com/oz-apps
  • Yes I mean this Github: https://github.com/ar2rsawseen/Localize

    My localization.lua
    --[[
    *************************************************************
     * This script is developed by Arturs Sosins aka ar2rsawseen, <a href="http://appcodingeasy.com" target="_blank" rel="nofollow">http://appcodingeasy.com</a>
     * Feel free to distribute and modify code, but keep reference to its creator
     *
     * Gideros Localize class provides localization support for gideros, 
     * by loading string constants from specific files based on user locale.
     * This class also has function, that allows string formating printf style, 
     * and dynamic loading of language specific images (images with texts).
     *
     * For more information, examples and online documentation visit: 
     * <a href="http://appcodingeasy.com/Gideros-Mobile/Localization-in-Gideros" target="_blank" rel="nofollow">http://appcodingeasy.com/Gideros-Mobile/Localization-in-Gideros</a>
    **************************************************************
    ]]--
     
    module("Localize", package.seeall)
     
    --public properties
    path = "locales"
    filetype = "lua"
     
    --local properties
    local locale = application:getLocale()
    local file
    local data = {}
     
    --initialziation
    if filetype == "lua" then
    	file = loadfile(path.."/"..locale.."."..filetype)
    	if file then
    		data = assert(file)()
    	end
    elseif filetype == "json" then
    	file = io.open(path.."/"..locale.."."..filetype, "r")
    	if file then
    		data = Json.Decode(file:read( "*a" ))
    	end
    end
     
    --public method for overriding methods
    function load(object, func, index)
    	if object ~= nil and object[func] ~= nil and object.__LCfunc == nil then
    		object.__LCfunc = object[func]
    		object[func] = function(...)
    			arg[index] = data[arg[index]] or arg[index]
    			return object.__LCfunc(unpack(arg))
    		end
    	end
    end
     
    --overriding native objects
    load(string, "format", 1)
    load(TextField, "new", 2)
    load(Texture, "new", 1)
    My page that calls the localization:
     
    Localize.path = "locales"
    Localize.filetype = "lua"
    Localize.changeLocale("es_ES")
     
    local up = Bitmap.new(TextureRegion.new(Texture.new("gfx/menulisten_en.png", true)))
     
    Localize.load(Sound, "new", 1)
    	--URLs
    	Localize.load(UrlLoader, "new", 1)
    My locale Spanish lua file
    local l = {}
     
     
    l ["gfx/menulisten_en.png"] = "gfx/menulisten_es.png"
     
    return l
    Based on the GITHUB I don't need any IF statements it seems
  • @mysps yes this is my implementation of localization and since it is pure Lua, it is completely platform independent and will work with any Gideros app

    Likes: chipster123

    +1 -1 (+1 / -0 ) Share on Facebook
  • Thanks @ar2rsawseen -- based on my code I havent' left anything out correct? I didnt localize any strings because I don't have any. Should I add anything else to xcode? I saw plist strings file was empty but am I suppose to be adding anything there?

    I've changed the local of the simulator to Spanish in this case above but it still shows the english file name.
  • so by default Localize loads the value which is returned by application:getLocale()
    but then later you can change the localization to any other language, by calling Localize.changeLocale(locale)

    So first thing to check if you don't force the locale by calling Localize.changeLocale(locale) and second thing to check, what does the application:getLocale() returns
  • Ok... I guess I'll just give up momentarily because based on what I've tried, I can't get anything to work even inside of Gideros player. Does the image portion work independently of Textwrap? I've gutted most of it and I cannot get the image to change even in the Gideros Player :(

    Does it matter that my page is using self and not local like the example?

    I'll pay anyone to help me. I would like to finally launch before Christmas. Please send a pm because I'm honestly desperate to get my first Gideros app in the stores.

    thank you
  • 1) explain more on what you want to achieve
    Do you want the app to automatically take the locale of phone?
    or
    do you want to implement buttons to switch between different languages?

    2) does the provided example with the Localize lib work on your PC?
  • The example works on my pc fine. When I try to add the simple translation for the alert it doesnt work. I've added the code for those and attached the plugin. Is there something else I'm missing?

    I only want to take the default start_en.png image and translate it to the phones local of the user, I've tried for Spanish to change to this image: start_es.png.

    The images work fine in the example code.
  • @mysps as always you can send me your project and I'll look at it ;)
  • @ar2rsawseen you've helped me enough. i really hate to bug anyone especially with something as simple as this (it seems). i'll send over the code now

    thanks
  • ar2rsawseenar2rsawseen Maintainer
    edited December 2013
    @chipster123 yes I think we resolved the issue, do you also have the same problem?
    If yes, here is an excerpt of our conversation:
    Because the lib is based on locale, on ios you should change the locale (Region (Settings > International > Region) ) and not the language (Settings -> International -> Language) and it should work as expected ;)
    If you want it to work with language you could also do that with language by calling
    Localize.changeLocale(application:getLanguage())
    but only in that case you need to rename your locale files, from lv_LV to simply lv because that is what is returned from application:getLanguage()
    Hope that helps ;)

  • Hi, yes that was the issue and all works perfect. I knew it was something silly. @ar2rsawseen . I did notice when calling the language via Localize.changeLocale(application:getLanguage()). Some languages did require using for example jp_JP and not ja. I believe three languages were like that. So I've added those with no problem!

    I'm submitting today :) :)

    Can't wait for auto scaling because I had trouble with my scaling. After the update I'll update too lol

    Thanks again @ar2rsawseen
  • ps. How would you localize the App title in the plist? Would I follow this? http://stackoverflow.com/questions/18052468/xcode-cannot-locate-localized-info-plist

    Or do I have to do something special with Gideros?
Sign In or Register to comment.