View Single Post
02-18-24, 01:38 AM   #22
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,893
Lots of way to go about localisation but probably for something small like this the easiest would be something like:

Lua Code:
  1. local Localizations = {
  2.     enUS = {
  3.         Waiting = "Next event is in: %s",
  4.         Running = "%s until event ends",
  5.     },
  6.     zhCN = {
  7.         Waiting = "下一个活动在: %s",
  8.         Running = "%s 直到事件结束",
  9.     },
  10.     deDE = {
  11.         Waiting = "Nächste Veranstaltung ist in: %s",
  12.         Running = "bis zum Ende der Veranstaltung: %s",
  13.     },
  14. }
  15.  
  16. local locale = GetLocale()
  17. local L = Localizations[locale] or Localizations.enUS -- Default to enUS if locale doesn't exist in the table

Then you can replace "Next event is in: %s" with L.Waiting and "%s until event ends" with L.Running

The usual scoping rules apply.

Your example didn't have a %s for the German "Until the event ends" so I just stuck one at the end (my German foo is also broken ).
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 02-18-24 at 01:43 AM.
  Reply With Quote