Thread Tools Display Modes
08/17/14, 12:09 AM   #1
circonian
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 613
localization

I know you can create custom stingIds like this:
Lua Code:
  1. ZO_CreateStringId("STRING_JEWELRY", "Jewelry")

But if you get translations how do you (if you can) add the translations to the same StringId so that when you call
Lua Code:
  1. GetString(STRING_JEWELRY)
It comes out in the right language?
  Reply With Quote
08/17/14, 03:38 AM   #2
Garkin
 
Garkin's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 832
Originally Posted by circonian View Post
I know you can create custom stingIds like this:
Lua Code:
  1. ZO_CreateStringId("STRING_JEWELRY", "Jewelry")

But if you get translations how do you (if you can) add the translations to the same StringId so that when you call
Lua Code:
  1. GetString(STRING_JEWELRY)
It comes out in the right language?
You have to create different .lua for each language and the load the correct one using the $(language) variable in addon manifest.

addon.txt:
Code:
## Title: My Addon
## Version: 1.0
## Author: Garkin
## APIVersion: 100008

Lang/$(language).lua
addon.lua
Lang/en.lua:
Lua Code:
  1. ZO_CreateStringId("STRING_JEWELRY", "Jewelry")

Lang/de.lua:
Lua Code:
  1. ZO_CreateStringId("STRING_JEWELRY", "Schmuck")

Lang/fr.lua:
Lua Code:
  1. ZO_CreateStringId("STRING_JEWELRY", "Bijoux")

addon.lua:
Lua Code:
  1. EVENT_MANAGER:RegisterForEvent("MyAddon", EVENT_PLAYER_ACTIVATED, function(event)
  2.    d(GetString(STRING_JEWELRY))
  3.    EVENT_MANAGER:UnregisterForEvent("MyAddon", event)
  4. end)

Last edited by Garkin : 08/17/14 at 03:40 AM.
  Reply With Quote
08/17/14, 04:19 PM   #3
circonian
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 613
Originally Posted by Garkin View Post
You have to create different .lua for each language and the load the correct one using the $(language) variable in addon manifest.

addon.txt:
Code:
## Title: My Addon
## Version: 1.0
## Author: Garkin
## APIVersion: 100008

Lang/$(language).lua
addon.lua
Lang/en.lua:
Lua Code:
  1. ZO_CreateStringId("STRING_JEWELRY", "Jewelry")

Lang/de.lua:
Lua Code:
  1. ZO_CreateStringId("STRING_JEWELRY", "Schmuck")

Lang/fr.lua:
Lua Code:
  1. ZO_CreateStringId("STRING_JEWELRY", "Bijoux")

addon.lua:
Lua Code:
  1. EVENT_MANAGER:RegisterForEvent("MyAddon", EVENT_PLAYER_ACTIVATED, function(event)
  2.    d(GetString(STRING_JEWELRY))
  3.    EVENT_MANAGER:UnregisterForEvent("MyAddon", event)
  4. end)
Awesome, thanks !
  Reply With Quote

ESOUI » Developer Discussions » General Authoring Discussion » localization


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off