ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   General Authoring Discussion (https://www.esoui.com/forums/forumdisplay.php?f=174)
-   -   Question about language support (https://www.esoui.com/forums/showthread.php?t=7708)

Crabby654 04/06/18 02:07 PM

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?

Quote:

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?

Quote:

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.

sirinsidiator 04/06/18 02:33 PM

1 Attachment(s)
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".

Crabby654 04/06/18 02:40 PM

Quote:

Originally Posted by sirinsidiator (Post 34327)
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! :)

sirinsidiator 04/07/18 04:43 AM

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. ;)

Crabby654 04/09/18 01:31 PM

Quote:

Originally Posted by sirinsidiator (Post 34331)
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 :)


All times are GMT -6. The time now is 01:01 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI