Thread: Localization
View Single Post
  #2  
Unread 09-25-2023, 03:01 PM
homeopatix's Avatar
homeopatix homeopatix is offline
The Indomitable
Interface Author - Click to view interfaces
 
Join Date: Dec 2020
Location: Switzerland
Posts: 14
Hello,

I do not know if i am doing the right way, but for me.

i initialize the language at the start of the addon,depending on the language
that the user have chosen, like this, in my library file (that load all the libraries needed for my addon)

i import the needed file depending of the language
------------------------------------------------------------------------------------------
-- Import Globals --
------------------------------------------------------------------------------------------
if Turbine.Engine.GetLanguage() == Turbine.Language.German then
import "Homeopatix.AltHolic.Localization.GlobalsDE";
GLocale = "de";
elseif Turbine.Engine.GetLanguage() == Turbine.Language.French then
import "Homeopatix.AltHolic.Localization.GlobalsFR";
GLocale = "fr";
elseif Turbine.Engine.GetLanguage() == Turbine.Language.English then
import "Homeopatix.AltHolic.Localization.GlobalsEN";
GLocale = "en";
end

and then in the three different language file

in french :
_G.T = {};
------------------------------------------------------------------------------------------
-- Francais --
------------------------------------------------------------------------------------------
T[ "Lang" ] = "Français";

in english :
_G.T = {};
------------------------------------------------------------------------------------------
-- English --
------------------------------------------------------------------------------------------
T[ "Lang" ] = "English";

in german :
_G.T = {};
------------------------------------------------------------------------------------------
-- Deutsch´ --
------------------------------------------------------------------------------------------
T[ "Lang" ] = "German";


and in the your code, you juste have to call the T[ "Lang" ] array the get the valor in the
defined language

hope that will help you

Homeo

Last edited by homeopatix : 09-26-2023 at 07:34 AM.
Reply With Quote