diff --git a/src/lang/en.json b/src/lang/en.json index 95f06d1..64ea578 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -36,6 +36,10 @@ "CustomLanguages.title": "Custom Languages", "DefaultLanguage.hint": "Name of the default language to select. Keep empty to use system default.", "DefaultLanguage.title": "Default Language", + "DisplayCheckbox": { + "hint": "Removes the checkbox from the chat section.", + "title": "Display Checkbox" + }, "DisplayTranslated.hint": "For languages that are translated in the chat window, display the original text and a translation below.", "DisplayTranslated.title": "Display Translations", "enableAllFonts": { @@ -44,7 +48,7 @@ }, "ExportFonts.hint": "Add Polyglot's fonts to Foundry's features, such as Drawings.", "ExportFonts.title": "Add Polyglot's fonts to Foundry", - "HideTranslation.hint": "Hides the Globe and the \"Translated from\" text from chat messages to players. Useful for when you don't want to show players which language you are speaking. Requires reload.", + "HideTranslation.hint": "Hides the Globe and the \"Translated from\" text from chat messages to players. Useful for when you don't want to show players which language you are speaking.", "HideTranslation.title": "Hide Indicators from Players", "IgnoreJournalFontSize": { "hint": "Ignores the size of Polyglot's fonts on journals, making them have the same size as normal text would have. Useful for when the formatting of the journal matters.", @@ -69,11 +73,11 @@ }, "languageDataPath": { "title": "Language Data Path", - "hint": "If your system has languages set in actors' data and aren't being loaded properly, it might be using another data path. Input the data path to the correct attribute (e.g. actor.system.languages or actor.system.speak). This settings takes precedence over the {setting} setting. Requires reload." + "hint": "If your system has languages set in actors' data and aren't being loaded properly, it might be using another data path. Input the data path to the correct attribute (e.g. actor.system.languages or actor.system.speak). This settings takes precedence over the {setting} setting." }, "literacyDataPath": { "title": "Literacy Data Path", - "hint": "Same as the {setting} setting, but for reading journals. This settings requires the {setting} setting. Requires reload." + "hint": "Same as the {setting} setting, but for reading journals. This settings requires the {setting} setting." }, "LanguageRegex": { "hint": "You can use this to change the term searched on items from \"Language\" to something else, like \"Tongue\". This setting is more useful for non-English speakers.", @@ -94,7 +98,7 @@ "hint": "Makes the randomization ignore non-alphanumerical characters (e.g. !,.;:?#$\"'). This might have the undesired effect of showing some of those characters as a square (□) on some fonts.", "title": "Randomize Only Alphanumericals" }, - "ScrambleGM.hint": "Don't translate the text for the GM (refer to the globe's color for the token's understanding). Requires reload.", + "ScrambleGM.hint": "Don't translate the text for the GM (refer to the globe's color for the token's understanding).", "ScrambleGM.title": "Scramble Messages for GM", "Truespeech.hint": "Set a language whose speaker understands all spoken languages (can't read Journals) and which is understood by all creatures. An actor will be able to read all chat messages and to write messages in a language that is understood by all.", "Truespeech.title": "Omnispeech Language", diff --git a/src/module/forms/GeneralSettings.js b/src/module/forms/GeneralSettings.js index 5da3740..93601fb 100644 --- a/src/module/forms/GeneralSettings.js +++ b/src/module/forms/GeneralSettings.js @@ -108,6 +108,7 @@ export class PolyglotGeneralSettings extends FormApplication { }, chat: { // Chat + displayCheckbox: this._prepSetting("displayCheckbox"), "display-translated": this._prepSetting("display-translated"), hideTranslation: this._prepSetting("hideTranslation"), allowOOC: this._prepSetting("allowOOC"), diff --git a/src/module/hooks.js b/src/module/hooks.js index 0449a12..f5a120b 100644 --- a/src/module/hooks.js +++ b/src/module/hooks.js @@ -5,21 +5,21 @@ export default class PolyglotHooks { */ static renderChatLog(chatlog, html, data) { game.polyglot.renderChatLog = true; + const input = game.settings.get("polyglot", "displayCheckbox") + ? `` + : ""; html.find("#chat-controls").after( `
- + ${input}
`, ); - const select = html.find(".polyglot-lang-select select"); - - select.change((ev) => { + html.find(".polyglot-lang-select select").change((ev) => { const lang = ev.target.value; game.polyglot.lastSelection = lang; }); - const input = html.find("input[name='polyglot-checkbox']"); - input.change((ev) => { + html.find("input[name='polyglot-checkbox']").change((ev) => { game.settings.set("polyglot", "checkbox", ev.target.checked); }); game.polyglot.updateUserLanguages(html); @@ -62,7 +62,8 @@ export default class PolyglotHooks { * @returns {Boolean} */ static preCreateChatMessage(message, data, options, userId) { - const isCheckboxEnabled = game.polyglot.chatElement.find("input[name=polyglot-checkbox]").prop("checked"); + const isCheckboxEnabled = !game.settings.get("polyglot", "displayCheckbox") + || game.polyglot.chatElement.find("input[name=polyglot-checkbox]").prop("checked"); const isMessageLink = game.polyglot._isMessageLink(data.content); const isMessageInlineRoll = /\[\[(.*?)\]\]/g.test(data.content); // Message preprended by /desc from either Cautious GM Tools or Narrator Tools modules diff --git a/src/module/settings.js b/src/module/settings.js index 01b39ff..07fab96 100644 --- a/src/module/settings.js +++ b/src/module/settings.js @@ -174,6 +174,13 @@ export function registerSettings() { }); // Chat Settings + addMenuSetting("displayCheckbox", { + name: "POLYGLOT.DisplayCheckbox.title", + hint: "POLYGLOT.DisplayCheckbox.hint", + default: true, + type: Boolean, + requiresReload: true, + }); addMenuSetting("display-translated", { name: "POLYGLOT.DisplayTranslated.title", hint: "POLYGLOT.DisplayTranslated.hint",