Skip to content

Commit

Permalink
raidboss: pass locale through as data.lang
Browse files Browse the repository at this point in the history
This should help with issue #57.
  • Loading branch information
quisquous committed Apr 7, 2018
1 parent 3343605 commit fcc101c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
3 changes: 2 additions & 1 deletion ui/raidboss/data/triggers/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
// me: The player's character name.
// job: The player's job.
// role: The role of the player's job (tank/healer/dps-melee/dps-ranged/dps-caster/crafting/gathering).
// lang: The current language, e.g. 'en', 'fr', 'ko', 'de', 'ja'.
// function ParseLocaleFloat(float): A function that can parse \y{Float} matches from the regex.
// function ShortName(name): A function that simplifies a player's name into something shorter, usually first name.
// function StopCombat(): Manually stop timelines and triggers, usually paired with resetWhenOutOfCombat = false.
Expand Down Expand Up @@ -107,4 +108,4 @@ The full order of evaluation of functions in a trigger is:
7. alertText
8. alarmText
9. tts
10. run
10. run
14 changes: 14 additions & 0 deletions ui/raidboss/data/triggers/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,5 +110,19 @@
fr: 'Bravo, vive la France',
},
},
{
id: 'Test Lang',
regex: /00:0038:cactbot lang/,
infoText: function(data) {
return {
en: 'Language: ' + data.lang,
};
},
tts: function(data) {
return {
en: 'Language: ' + data.lang,
};
},
},
],
}]
2 changes: 2 additions & 0 deletions ui/raidboss/popup-text.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,10 +184,12 @@ class PopupText {
}

Reset() {
var locale = this.options.Language || 'en';
this.data = {
me: this.me,
job: this.job,
role: this.role,
lang: locale,
ShortName: this.ShortNamify,
StopCombat: (function() { this.SetInCombat(false); }).bind(this),
ParseLocaleFloat: function(s) { return Regexes.ParseLocaleFloat(s); },
Expand Down

0 comments on commit fcc101c

Please sign in to comment.