From 9b058857a7abe25c555031d5e6406e6cfa6ec393 Mon Sep 17 00:00:00 2001 From: "adamlui@protonmail.com" Date: Mon, 30 Sep 2024 10:19:00 +0000 Subject: [PATCH] =?UTF-8?q?Localized=20state=20words=20in=20notifs=20?= =?UTF-8?q?=E2=86=9E=20[auto-sync=20from=20`adamlui/chatgpt-apps/chatgpt-w?= =?UTF-8?q?idescreen/greasemonkey`]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- chrome/extension/content.js | 7 +++++-- chrome/extension/popup/popup.js | 3 ++- edge/extension/content.js | 7 +++++-- edge/extension/popup/popup.js | 3 ++- firefox/extension/content.js | 7 +++++-- firefox/extension/popup/popup.js | 3 ++- greasemonkey/chatgpt-widescreen-mode.user.js | 14 ++++++++------ opera/extension/content.js | 7 +++++-- opera/extension/popup/popup.js | 3 ++- 9 files changed, 36 insertions(+), 18 deletions(-) diff --git a/chrome/extension/content.js b/chrome/extension/content.js index c7e0e923..6575c96f 100644 --- a/chrome/extension/content.js +++ b/chrome/extension/content.js @@ -34,7 +34,9 @@ if (config.notifDisabled && !msg.includes(chrome.i18n.getMessage('menuLabel_modeNotifs'))) return // Strip state word to append colored one later - const foundState = ['ON', 'OFF'].find(word => msg.includes(word)) + const foundState = [ chrome.i18n.getMessage('state_on').toUpperCase(), + chrome.i18n.getMessage('state_off').toUpperCase() + ].find(word => msg.includes(word)) if (foundState) msg = msg.replace(foundState, '') // Show notification @@ -419,7 +421,8 @@ if (site == 'chatgpt') setTimeout(() => chatbar.tweak(), // update inner width mode == 'fullWindow' && ( config.wideScreen || config.fullerWindows ) && config.widerChatbox ? 111 : 0) // delay if toggled to/from active WCB to avoid inaccurate width - notify(`${chrome.i18n.getMessage('mode_' + mode)} ${ state ? 'ON' : 'OFF' }`) + notify(`${chrome.i18n.getMessage('mode_' + mode)} ${ + chrome.i18n.getMessage(`state_${ state ? 'on' : 'off' }`).toUpperCase()}`) } config.modeSynced = true ; setTimeout(() => config.modeSynced = false, 100) // prevent repetition } diff --git a/chrome/extension/popup/popup.js b/chrome/extension/popup/popup.js index 40e6f845..5a7f8d11 100644 --- a/chrome/extension/popup/popup.js +++ b/chrome/extension/popup/popup.js @@ -116,7 +116,8 @@ event.stopImmediatePropagation() menuInput.onchange = () => { settings.save(key, !config[key]) ; sync.storageToUI() - notify(`${app.settings[key].label} ${/disabled/i.test(key) != config[key] ? 'ON' : 'OFF' }`) + notify(`${app.settings[key].label} ${chrome.i18n.getMessage(`state_${ + /disabled/i.test(key) != config[key] ? 'on' : 'off' }`).toUpperCase()}`) } } }) diff --git a/edge/extension/content.js b/edge/extension/content.js index c7e0e923..6575c96f 100644 --- a/edge/extension/content.js +++ b/edge/extension/content.js @@ -34,7 +34,9 @@ if (config.notifDisabled && !msg.includes(chrome.i18n.getMessage('menuLabel_modeNotifs'))) return // Strip state word to append colored one later - const foundState = ['ON', 'OFF'].find(word => msg.includes(word)) + const foundState = [ chrome.i18n.getMessage('state_on').toUpperCase(), + chrome.i18n.getMessage('state_off').toUpperCase() + ].find(word => msg.includes(word)) if (foundState) msg = msg.replace(foundState, '') // Show notification @@ -419,7 +421,8 @@ if (site == 'chatgpt') setTimeout(() => chatbar.tweak(), // update inner width mode == 'fullWindow' && ( config.wideScreen || config.fullerWindows ) && config.widerChatbox ? 111 : 0) // delay if toggled to/from active WCB to avoid inaccurate width - notify(`${chrome.i18n.getMessage('mode_' + mode)} ${ state ? 'ON' : 'OFF' }`) + notify(`${chrome.i18n.getMessage('mode_' + mode)} ${ + chrome.i18n.getMessage(`state_${ state ? 'on' : 'off' }`).toUpperCase()}`) } config.modeSynced = true ; setTimeout(() => config.modeSynced = false, 100) // prevent repetition } diff --git a/edge/extension/popup/popup.js b/edge/extension/popup/popup.js index 40e6f845..5a7f8d11 100644 --- a/edge/extension/popup/popup.js +++ b/edge/extension/popup/popup.js @@ -116,7 +116,8 @@ event.stopImmediatePropagation() menuInput.onchange = () => { settings.save(key, !config[key]) ; sync.storageToUI() - notify(`${app.settings[key].label} ${/disabled/i.test(key) != config[key] ? 'ON' : 'OFF' }`) + notify(`${app.settings[key].label} ${chrome.i18n.getMessage(`state_${ + /disabled/i.test(key) != config[key] ? 'on' : 'off' }`).toUpperCase()}`) } } }) diff --git a/firefox/extension/content.js b/firefox/extension/content.js index 446cbfab..5316e613 100644 --- a/firefox/extension/content.js +++ b/firefox/extension/content.js @@ -34,7 +34,9 @@ if (config.notifDisabled && !msg.includes(chrome.i18n.getMessage('menuLabel_modeNotifs'))) return // Strip state word to append colored one later - const foundState = ['ON', 'OFF'].find(word => msg.includes(word)) + const foundState = [ chrome.i18n.getMessage('state_on').toUpperCase(), + chrome.i18n.getMessage('state_off').toUpperCase() + ].find(word => msg.includes(word)) if (foundState) msg = msg.replace(foundState, '') // Show notification @@ -419,7 +421,8 @@ if (site == 'chatgpt') setTimeout(() => chatbar.tweak(), // update inner width mode == 'fullWindow' && ( config.wideScreen || config.fullerWindows ) && config.widerChatbox ? 111 : 0) // delay if toggled to/from active WCB to avoid inaccurate width - notify(`${chrome.i18n.getMessage('mode_' + mode)} ${ state ? 'ON' : 'OFF' }`) + notify(`${chrome.i18n.getMessage('mode_' + mode)} ${ + chrome.i18n.getMessage(`state_${ state ? 'on' : 'off' }`).toUpperCase()}`) } config.modeSynced = true ; setTimeout(() => config.modeSynced = false, 100) // prevent repetition } diff --git a/firefox/extension/popup/popup.js b/firefox/extension/popup/popup.js index 912b6abe..d893f00d 100644 --- a/firefox/extension/popup/popup.js +++ b/firefox/extension/popup/popup.js @@ -116,7 +116,8 @@ event.stopImmediatePropagation() menuInput.onchange = () => { settings.save(key, !config[key]) ; sync.storageToUI() - notify(`${app.settings[key].label} ${/disabled/i.test(key) != config[key] ? 'ON' : 'OFF' }`) + notify(`${app.settings[key].label} ${chrome.i18n.getMessage(`state_${ + /disabled/i.test(key) != config[key] ? 'on' : 'off' }`).toUpperCase()}`) } } }) diff --git a/greasemonkey/chatgpt-widescreen-mode.user.js b/greasemonkey/chatgpt-widescreen-mode.user.js index f45a91fd..03935007 100644 --- a/greasemonkey/chatgpt-widescreen-mode.user.js +++ b/greasemonkey/chatgpt-widescreen-mode.user.js @@ -222,7 +222,7 @@ // @description:zu Engeza izinhlobo zezimodi ze-Widescreen + Fullscreen ku-ChatGPT ukuze kube nokubonakala + ukuncitsha ukusukela // @author Adam Lui // @namespace https://github.com/adamlui -// @version 2024.9.30 +// @version 2024.9.30.1 // @license MIT // @compatible chrome // @compatible firefox @@ -281,7 +281,7 @@ relatedApps: 'https://github.com/adamlui/chatgpt-apps', support: 'https://support.chatgptwidescreen.com' }, - latestAssetCommitHash: 'e6adb47' // for cached sites.json + messages.json + latestAssetCommitHash: '7ba5ac6' // for cached sites.json + messages.json } app.urls.assetHost = app.urls.gitHub.replace('github.com', 'cdn.jsdelivr.net/gh') + `@${app.latestAssetCommitHash}` app.urls.update = app.urls.greasyFork.replace('https://', 'https://update.') @@ -371,7 +371,9 @@ btnLabel_updateCheck: 'Check for Updates', btnLabel_update: 'Update', btnLabel_dismiss: 'Dismiss', - link_viewChanges: 'View changes' + link_viewChanges: 'View changes', + state_on: 'on', + state_off: 'off' } if (!config.userLanguage.startsWith('en')) { // localize msgs for non-English users const localizedMsgs = await new Promise(resolve => { @@ -414,8 +416,8 @@ const menu = { ids: [], state: { - symbols: ['❌', '✔️'], words: ['OFF', 'ON'], - separator: env.scriptManager == 'Tampermonkey' ? ' — ' : ': ' + symbols: ['❌', '✔️'], separator: env.scriptManager == 'Tampermonkey' ? ' — ' : ': ', + words: [app.msgs.state_off.toUpperCase(), app.msgs.state_on.toUpperCase()] }, register() { @@ -945,7 +947,7 @@ if (/chatgpt|openai/.test(site)) setTimeout(() => chatbar.tweak(), // update inner width mode == 'fullWindow' && ( config.wideScreen || config.fullerWindows ) && config.widerChatbox ? 111 : 0) // delay if toggled to/from active WCB to avoid inaccurate width - notify(`${app.msgs['mode_' + mode]} ${ state ? 'ON' : 'OFF' }`) + notify(`${app.msgs[`mode_${mode}`]} ${app.msgs[`state_${ state ? 'on' : 'off' }`].toUpperCase()}`) config.modeSynced = true ; setTimeout(() => config.modeSynced = false, 100) // prevent repetition } } diff --git a/opera/extension/content.js b/opera/extension/content.js index c7e0e923..6575c96f 100644 --- a/opera/extension/content.js +++ b/opera/extension/content.js @@ -34,7 +34,9 @@ if (config.notifDisabled && !msg.includes(chrome.i18n.getMessage('menuLabel_modeNotifs'))) return // Strip state word to append colored one later - const foundState = ['ON', 'OFF'].find(word => msg.includes(word)) + const foundState = [ chrome.i18n.getMessage('state_on').toUpperCase(), + chrome.i18n.getMessage('state_off').toUpperCase() + ].find(word => msg.includes(word)) if (foundState) msg = msg.replace(foundState, '') // Show notification @@ -419,7 +421,8 @@ if (site == 'chatgpt') setTimeout(() => chatbar.tweak(), // update inner width mode == 'fullWindow' && ( config.wideScreen || config.fullerWindows ) && config.widerChatbox ? 111 : 0) // delay if toggled to/from active WCB to avoid inaccurate width - notify(`${chrome.i18n.getMessage('mode_' + mode)} ${ state ? 'ON' : 'OFF' }`) + notify(`${chrome.i18n.getMessage('mode_' + mode)} ${ + chrome.i18n.getMessage(`state_${ state ? 'on' : 'off' }`).toUpperCase()}`) } config.modeSynced = true ; setTimeout(() => config.modeSynced = false, 100) // prevent repetition } diff --git a/opera/extension/popup/popup.js b/opera/extension/popup/popup.js index 40e6f845..5a7f8d11 100644 --- a/opera/extension/popup/popup.js +++ b/opera/extension/popup/popup.js @@ -116,7 +116,8 @@ event.stopImmediatePropagation() menuInput.onchange = () => { settings.save(key, !config[key]) ; sync.storageToUI() - notify(`${app.settings[key].label} ${/disabled/i.test(key) != config[key] ? 'ON' : 'OFF' }`) + notify(`${app.settings[key].label} ${chrome.i18n.getMessage(`state_${ + /disabled/i.test(key) != config[key] ? 'on' : 'off' }`).toUpperCase()}`) } } })