ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   Tutorials & Other Helpful Info (https://www.esoui.com/forums/forumdisplay.php?f=172)
-   -   [Video Tutorial] String Localization and Special Characters (https://www.esoui.com/forums/showthread.php?t=10767)

moshulu 12/30/23 11:11 PM

[Video Tutorial] String Localization and Special Characters
 
Link to the video

Hello everyone,
I'm excited to announce the next installment of my video series on ESO addon development for SimpleClock. This video goes over how to localize your strings using the lang/ folder and GetString() to call different localized translations of strings. We also handle unexpected output from os.date(), which we use to populate the clock that the user sees.

I'm looking forward to seeing what you produce with these building blocks! If the information in the video helped you, let me know! I'd love to see what you have created with the information that I've presented.

Link to the video

I hope to see you ingame!

- @moshulu

Baertram 12/31/23 08:31 AM

Thank you, I've made a sticky thread for video tutorials and added yours there:
https://www.esoui.com/forums/showthread.php?t=10768

moshulu 01/04/24 07:38 AM

@Baertram, thank you very much for your support! I have another few videos lined up - is it okay to update the sticky thread when they come out, or would you (or another mod) have to do that?

Baertram 01/04/24 08:01 AM

Put them as answer below the sticky thread and I'll add them to the main post then.
thanks

Baertram 01/04/24 08:13 AM

btw your video about the GetString constants is not correct! It works but is not the best way to do it!!!


Instead of copy&paste the strings into your fr.lua file and using ZO_CreateStringId again, which will recreate the same constant:
You just need to reuse the already created stringIds (from your en.lua via ZO_CreateStringId) and ONLY add a new version 2 with the new text via function:

Code:

SafeAddString(stringId, text, version+1)
Lua Code:
  1. --en.lua--
  2. for stringId, stringValue in pairs(strings) do
  3.    ZO_CreateStringId(stringId, stringValue)
  4.    SafeAddVersion(stringId, 1)
  5. end
  6.  
  7.  
  8.  
  9. --de.lua / fr.lua / es.lua / ru.lua / zh.lua / jp.lua / ...--
  10. for stringId, stringValue in pairs(strings) do
  11.    SafeAddString(_G[stringId], stringValue , 2)      
  12. end


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

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