Skip to content

Commit

Permalink
Localized state words in notifs ↞ [auto-sync from `adamlui/chatgpt-ap…
Browse files Browse the repository at this point in the history
…ps/chatgpt-widescreen/greasemonkey`]
  • Loading branch information
adamlui authored and kudo-sync-bot committed Sep 30, 2024
1 parent 7ba5ac6 commit 9b05885
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 18 deletions.
7 changes: 5 additions & 2 deletions chrome/extension/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}
Expand Down
3 changes: 2 additions & 1 deletion chrome/extension/popup/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()}`)
}
}
})
Expand Down
7 changes: 5 additions & 2 deletions edge/extension/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}
Expand Down
3 changes: 2 additions & 1 deletion edge/extension/popup/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()}`)
}
}
})
Expand Down
7 changes: 5 additions & 2 deletions firefox/extension/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}
Expand Down
3 changes: 2 additions & 1 deletion firefox/extension/popup/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()}`)
}
}
})
Expand Down
14 changes: 8 additions & 6 deletions greasemonkey/chatgpt-widescreen-mode.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.')
Expand Down Expand Up @@ -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 => {
Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -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
}
}
Expand Down
7 changes: 5 additions & 2 deletions opera/extension/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}
Expand Down
3 changes: 2 additions & 1 deletion opera/extension/popup/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()}`)
}
}
})
Expand Down

0 comments on commit 9b05885

Please sign in to comment.