Quantcast Question about language support - ESOUI
Thread Tools Display Modes
04/06/18, 02:07 PM   #1
Crabby654
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 14
Question Question about language support

Hey there everyone! So I am not a "real" mod author or creator. Basically I have a handful of mods that I took over and kept them "alive" by updating the API number and the libs associated with them.

My question is about a specific addon I am looking at. Combat Indicator (Updated) - http://www.esoui.com/downloads/info1...orUpdated.html

In the comments section, someone has said that they created a french translation but I have NO CLUE what to do with it. Do I create a separate file and have it linked to the main lua file?

Originally Posted by lexo1000
Love this one thanks !
I made the french translation. Please include it in the next update

Lua Code:
  1. L.fr.settingsTitle = "Combat Indicator"
  2. L.fr.settingCheckboxEnabled = "Activer l'indicateur de combat"
  3. L.fr.settingTooltipCheckboxEnabled = "Active les fonctionnalités de l'extension."
  4. L.fr.settingCheckboxDisguiseEnabled = "Activer l'alerte de danger lorsque déguisé"
  5. L.fr.settingTooltipCheckboxDisguiseEnabled = "Active un troisème état doté de sa propre couleur lorsque le personnage est déguisé et risque d'être démasqué."
  6. L.fr.settingColorNormal = "Couleur standard"
  7. L.fr.settingTooltipColorNormal = "Détermine la couleur appliquée par défaut à la boussole."
  8. L.fr.settingColorCombat = "Couleur en combat"
  9. L.fr.settingTooltipColorCombat = "Détermine la couleur appliquée à la boussole lorsque le personnage est en combat."
  10. L.fr.settingColorDisguiseDanger = "Couleur en danger"
  11. L.fr.settingTooltipColorDisguiseDanger = "Détermine la couleur appliquée à la boussole lorsque le personnage est déguisé et risque d'être démasqué."
  12. L.fr.settingCheckboxOptimiseForSmallUI = "Optimiser pour les interfaces à échelle réduite"
  13. L.fr.settingTooltipCheckboxOptimiseForSmallUI = "Active des optimisations pour rendre l'indicateur plus clair lorsque les ennemis entre en état aggressif. Ce réglage est surtout indiqué pour les tailles d'interface inférieures à 0.75."
Also as a side note, the next comment is about add a Russian language string which will fix his error message, seems easy enough but does that even add the Russian language to the addon?

Originally Posted by Govorov
Addon works, but there are errors when loading add-ons
Warning: Spoiler


-----
Update:

При использовании русификатора RUESO аддон показывает ошибки и не появляется его меню в настройках дополнений (но при это сам аддон работает). Фикс простой, откройте PL_CombatIndicator_Static.lua и замените 15 строку

PL_CombatIndicator.Strings = {en={}, de={}, fr={}}

на

PL_CombatIndicator.Strings = {en={}, de={}, fr={}, ru={}}

Меню появится и перестанут появляться ошибки аддона.
Thanks all for any help, much appreciated. I just want to keep these mods alive and hopefully one day modify them heavily.
  Reply With Quote
04/06/18, 02:33 PM   #2
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 1,101
You just add it in the PL_CombatIndicator_Static.lua file after the English texts.

As for the error for Russian players, that is actually a problem for all custom localizations. There is a small bug in how the addon decides it should use English as a fallback for unsupported languages. A potential fix would look like this:
Lua Code:
  1. local lang = GetCVar("language.2")
  2.     local str = t[lang] ~= nil and t[lang][k]
  3.     if str == nil then
It first needs to check if t[lang] even exists, otherwise it would try to access nil[k] which produces the error you see in the screenshots.

I attached the file with the necessary modifications and also added a German translation, but didn't test it. Feel free to use that.

EDIT: actually you should replace "if str == nil then" with "if not str then", since "local str = t[lang] ~= nil and t[lang][k]" will result in str being "false" if the table doesn't exist and that way you check for both "nil" and "false".
Attached Files
File Type: lua PL_CombatIndicator_Static.lua (4.8 KB, 31 views)
__________________
>siri.exe MyAddon
Does your addon work? [y/n] n
There is a typo in there.

Last edited by sirinsidiator : 04/06/18 at 02:37 PM.
  Reply With Quote
04/06/18, 02:40 PM   #3
Crabby654
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 14
Originally Posted by sirinsidiator View Post
You just add it in the PL_CombatIndicator_Static.lua file after the English texts.

As for the error for Russian players, that is actually a problem for all custom localizations. There is a small bug in how the addon decides it should use English as a fallback for unsupported languages. A potential fix would look like this:
Lua Code:
  1. local lang = GetCVar("language.2")
  2.     local str = t[lang] ~= nil and t[lang][k]
  3.     if str == nil then
It first needs to check if t[lang] even exists, otherwise it would try to access nil[k] which produces the error you see in the screenshots.

I attached the file with the necessary modifications and also added a German translation, but didn't test it. Feel free to use that.

EDIT: actually you should replace "if str == nil then" with "if not str then", since "local str = t[lang] ~= nil and t[lang][k]" will result in str being "false" if the table doesn't exist and that way you check for both "nil" and "false".
Holy mackeral thank you! This is exactly what I wanted to know! Hmm maybe I can mess around with language settings for the other addons now!
  Reply With Quote
04/07/18, 04:43 AM   #4
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 1,101
I just checked the version you updated and saw that you didn't do what I wrote when I edited my first post right after I posted it. You might want to do that, otherwise the fix for the unofficial translations won't work.
__________________
>siri.exe MyAddon
Does your addon work? [y/n] n
There is a typo in there.
  Reply With Quote
04/09/18, 01:31 PM   #5
Crabby654
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 14
Originally Posted by sirinsidiator View Post
I just checked the version you updated and saw that you didn't do what I wrote when I edited my first post right after I posted it. You might want to do that, otherwise the fix for the unofficial translations won't work.
Thank you again! About to reupload with the fix
  Reply With Quote

ESOUI » Developer Discussions » General Authoring Discussion » Question about language support

Thread Tools
Display Modes

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