Gideros Localize module provides seamless localization support for Gideros, by loading string constants from specific files based on user locale.

This module provides global object Localize, which overrides native or non native objects, to check for localization before using strings, thus seamlessly (thanks to bowerandy) integrating localization support.

Package contains Localize.lua module and example Gideros application project.
 

Contents

Download

Example codes



--simple Gideros app, nothing's changed
local font = TTFont.new('tahoma.ttf', 15)

--We can use simple text
local text = TextField.new(font, 'This is a simple string')
text:setPosition(0,50)
stage:addChild(text)

--Or we can format string printf style
local text = TextField.new(font, string.format('Hello, %s', 'Arturs'))
text:setPosition(0,20)
stage:addChild(text)

Example video

Video of module example app:

Method list

Override optional object

Back to method list

Method name new(object, method, index)
Description It is possible to add optional objects for seamless localization
Input parameters

object object - object, that we will be workign with, for example, TextField, Bitmap, Sound, etc

string method - name of the method as string, that we want to override.

integer index - Index of the argument passed to method, that we need to check for localization

Example input
Localize.load(Sound, "new", 1)

Changing directory

Back to method list

Property name path
Description It is possible to change path where to look for localization files simply by changing path property (default: 'locales')
Example


Localize.path = 'locales'

Changing file type

Back to method list

Property name filetype
Description It is possible to change how language constants are stored.
Input parameters

string string_constant - string with format (default: 'lua'). Possible values:

  • lua - stored in lua table (keys as contstans and values as values)
  • json - stored in json structure (keys as contstans and values as values) Json class needs be included in the project to use this type
Example


Localize.filetype = 'lua'

Latest changes

None for now