League-of-Foundry-Developers / fvtt-module-theatre

GNU General Public License v3.0
32 stars 41 forks source link

[Suggestion] Polyglot Compatibility #43

Closed MrVauxs closed 3 years ago

MrVauxs commented 3 years ago

Suggestion: Support Polyglot's languages and fonts in Theatre Inserts

Why should this be added: Allows players and DMs to use Theatre Inserts without making Polyglot's ability to disguise the messages meaningless due to it showing the pure message.

mclemente commented 3 years ago

I'm the dev of Polyglot and just found this issue while I was working on compatibility lol Anyways, all you need is to add the following on line 559 of theatre_main.js

if (window.polyglot) {
      const lang = chatData.flags.polyglot.language;
      if (!polyglot.polyglot.known_languages.has(lang)) {
        if (lang != polyglot.polyglot.defaultLanguage) insertFontType = polyglot.polyglot._getFontStyle(lang).slice(5);
        textContent = polyglot.polyglot.scrambleString(textContent, chatData._id, lang);
      }
    }

I'll send a PR so it gets added to the module.

megahead11 commented 3 years ago

Added in latest release! Thanks mclemente!