mirror of
https://github.com/redphx/better-xcloud.git
synced 2025-06-07 08:07:18 +02:00
refactor: update locale function's name (#277)
This commit is contained in:
parent
d2ddc2fd23
commit
5703f24418
@ -2814,7 +2814,7 @@ const Translations = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const LOCALE = Translations.getLocale();
|
const LOCALE = Translations.getLocale();
|
||||||
const __ = Translations.get;
|
const t = Translations.get;
|
||||||
|
|
||||||
|
|
||||||
const ENABLE_SAFARI_WORKAROUND = true;
|
const ENABLE_SAFARI_WORKAROUND = true;
|
||||||
@ -2840,7 +2840,7 @@ if (ENABLE_SAFARI_WORKAROUND && document.readyState !== 'loading') {
|
|||||||
`;
|
`;
|
||||||
const $fragment = document.createDocumentFragment();
|
const $fragment = document.createDocumentFragment();
|
||||||
$fragment.appendChild(CE('style', {}, css));
|
$fragment.appendChild(CE('style', {}, css));
|
||||||
$fragment.appendChild(CE('div', {'class': 'bx-reload-overlay'}, __('safari-failed-message')));
|
$fragment.appendChild(CE('div', {'class': 'bx-reload-overlay'}, t('safari-failed-message')));
|
||||||
|
|
||||||
document.documentElement.appendChild($fragment);
|
document.documentElement.appendChild($fragment);
|
||||||
|
|
||||||
@ -2934,12 +2934,12 @@ class Dialog {
|
|||||||
helpUrl && createButton({
|
helpUrl && createButton({
|
||||||
icon: Icon.QUESTION,
|
icon: Icon.QUESTION,
|
||||||
style: ButtonStyle.GHOST,
|
style: ButtonStyle.GHOST,
|
||||||
title: __('help'),
|
title: t('help'),
|
||||||
url: helpUrl,
|
url: helpUrl,
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
this.$content = CE('div', {'class': 'bx-dialog-content'}, content),
|
this.$content = CE('div', {'class': 'bx-dialog-content'}, content),
|
||||||
!hideCloseButton && ($close = CE('button', {}, __('close'))),
|
!hideCloseButton && ($close = CE('button', {}, t('close'))),
|
||||||
);
|
);
|
||||||
|
|
||||||
$close && $close.addEventListener('click', e => {
|
$close && $close.addEventListener('click', e => {
|
||||||
@ -2992,10 +2992,10 @@ class RemotePlay {
|
|||||||
static #CONSOLES;
|
static #CONSOLES;
|
||||||
|
|
||||||
static #STATE_LABELS = {
|
static #STATE_LABELS = {
|
||||||
'On': __('powered-on'),
|
'On': t('powered-on'),
|
||||||
'Off': __('powered-off'),
|
'Off': t('powered-off'),
|
||||||
'ConnectedStandby': __('standby'),
|
'ConnectedStandby': t('standby'),
|
||||||
'Unknown': __('unknown'),
|
'Unknown': t('unknown'),
|
||||||
};
|
};
|
||||||
|
|
||||||
static get BASE_DEVICE_INFO() {
|
static get BASE_DEVICE_INFO() {
|
||||||
@ -3048,9 +3048,9 @@ class RemotePlay {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
RemotePlay.#$content = CE('div', {}, __('getting-consoles-list'));
|
RemotePlay.#$content = CE('div', {}, t('getting-consoles-list'));
|
||||||
RemotePlay.#dialog = new Dialog({
|
RemotePlay.#dialog = new Dialog({
|
||||||
title: __('remote-play'),
|
title: t('remote-play'),
|
||||||
content: RemotePlay.#$content,
|
content: RemotePlay.#$content,
|
||||||
helpUrl: 'https://better-xcloud.github.io/remote-play/',
|
helpUrl: 'https://better-xcloud.github.io/remote-play/',
|
||||||
});
|
});
|
||||||
@ -3067,7 +3067,7 @@ class RemotePlay {
|
|||||||
const $fragment = document.createDocumentFragment();
|
const $fragment = document.createDocumentFragment();
|
||||||
|
|
||||||
if (!RemotePlay.#CONSOLES || RemotePlay.#CONSOLES.length === 0) {
|
if (!RemotePlay.#CONSOLES || RemotePlay.#CONSOLES.length === 0) {
|
||||||
$fragment.appendChild(CE('span', {}, __('no-consoles-found')));
|
$fragment.appendChild(CE('span', {}, t('no-consoles-found')));
|
||||||
} else {
|
} else {
|
||||||
const $settingNote = CE('p', {});
|
const $settingNote = CE('p', {});
|
||||||
|
|
||||||
@ -3087,14 +3087,14 @@ class RemotePlay {
|
|||||||
$resolutionSelect.addEventListener('change', e => {
|
$resolutionSelect.addEventListener('change', e => {
|
||||||
const value = $resolutionSelect.value;
|
const value = $resolutionSelect.value;
|
||||||
|
|
||||||
$settingNote.textContent = value === '1080p' ? '✅ ' + __('can-stream-xbox-360-games') : '❌ ' + __('cant-stream-xbox-360-games');
|
$settingNote.textContent = value === '1080p' ? '✅ ' + t('can-stream-xbox-360-games') : '❌ ' + t('cant-stream-xbox-360-games');
|
||||||
setPref(Preferences.REMOTE_PLAY_RESOLUTION, value);
|
setPref(Preferences.REMOTE_PLAY_RESOLUTION, value);
|
||||||
});
|
});
|
||||||
$resolutionSelect.dispatchEvent(new Event('change'));
|
$resolutionSelect.dispatchEvent(new Event('change'));
|
||||||
|
|
||||||
const $qualitySettings = CE('div', {'class': 'bx-remote-play-settings'},
|
const $qualitySettings = CE('div', {'class': 'bx-remote-play-settings'},
|
||||||
CE('div', {},
|
CE('div', {},
|
||||||
CE('label', {}, __('target-resolution'), $settingNote),
|
CE('label', {}, t('target-resolution'), $settingNote),
|
||||||
$resolutionSelect,
|
$resolutionSelect,
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@ -3116,7 +3116,7 @@ class RemotePlay {
|
|||||||
// Connect button
|
// Connect button
|
||||||
createButton({
|
createButton({
|
||||||
classes: ['bx-remote-play-connect-button'],
|
classes: ['bx-remote-play-connect-button'],
|
||||||
label: __('console-connect'),
|
label: t('console-connect'),
|
||||||
style: ButtonStyle.PRIMARY,
|
style: ButtonStyle.PRIMARY,
|
||||||
onClick: e => {
|
onClick: e => {
|
||||||
REMOTE_PLAY_CONFIG = {
|
REMOTE_PLAY_CONFIG = {
|
||||||
@ -3429,11 +3429,11 @@ class LoadingScreen {
|
|||||||
let $waitTimeBox = LoadingScreen.#$waitTimeBox;
|
let $waitTimeBox = LoadingScreen.#$waitTimeBox;
|
||||||
if (!$waitTimeBox) {
|
if (!$waitTimeBox) {
|
||||||
$waitTimeBox = CE('div', {'class': 'bx-wait-time-box'},
|
$waitTimeBox = CE('div', {'class': 'bx-wait-time-box'},
|
||||||
CE('label', {}, __('server')),
|
CE('label', {}, t('server')),
|
||||||
CE('span', {}, getPreferredServerRegion()),
|
CE('span', {}, getPreferredServerRegion()),
|
||||||
CE('label', {}, __('wait-time-estimated')),
|
CE('label', {}, t('wait-time-estimated')),
|
||||||
$estimated = CE('span', {}),
|
$estimated = CE('span', {}),
|
||||||
CE('label', {}, __('wait-time-countdown')),
|
CE('label', {}, t('wait-time-countdown')),
|
||||||
$countDown = CE('span', {}),
|
$countDown = CE('span', {}),
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -3655,7 +3655,7 @@ class TouchController {
|
|||||||
const layout = (layoutData.layouts[layoutId] || layoutData.layouts[layoutData.default_layout]);
|
const layout = (layoutData.layouts[layoutId] || layoutData.layouts[layoutData.default_layout]);
|
||||||
if (layout) {
|
if (layout) {
|
||||||
// Show a toast with layout's name
|
// Show a toast with layout's name
|
||||||
layoutChanged && Toast.show(__('touch-control-layout'), layout.name);
|
layoutChanged && Toast.show(t('touch-control-layout'), layout.name);
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
window.BX_EXPOSED.touch_layout_manager.changeLayoutForScope({
|
window.BX_EXPOSED.touch_layout_manager.changeLayoutForScope({
|
||||||
@ -4250,18 +4250,18 @@ class MkbPreset {
|
|||||||
|
|
||||||
static MOUSE_SETTINGS = {
|
static MOUSE_SETTINGS = {
|
||||||
[MkbPreset.KEY_MOUSE_MAP_TO]: {
|
[MkbPreset.KEY_MOUSE_MAP_TO]: {
|
||||||
label: __('map-mouse-to'),
|
label: t('map-mouse-to'),
|
||||||
type: SettingElement.TYPE_OPTIONS,
|
type: SettingElement.TYPE_OPTIONS,
|
||||||
default: MouseMapTo[MouseMapTo.RS],
|
default: MouseMapTo[MouseMapTo.RS],
|
||||||
options: {
|
options: {
|
||||||
[MouseMapTo[MouseMapTo.RS]]: __('right-stick'),
|
[MouseMapTo[MouseMapTo.RS]]: t('right-stick'),
|
||||||
[MouseMapTo[MouseMapTo.LS]]: __('left-stick'),
|
[MouseMapTo[MouseMapTo.LS]]: t('left-stick'),
|
||||||
[MouseMapTo[MouseMapTo.OFF]]: __('off'),
|
[MouseMapTo[MouseMapTo.OFF]]: t('off'),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
[MkbPreset.KEY_MOUSE_SENSITIVITY_Y]: {
|
[MkbPreset.KEY_MOUSE_SENSITIVITY_Y]: {
|
||||||
label: __('horizontal-sensitivity'),
|
label: t('horizontal-sensitivity'),
|
||||||
type: SettingElement.TYPE_NUMBER_STEPPER,
|
type: SettingElement.TYPE_NUMBER_STEPPER,
|
||||||
default: 50,
|
default: 50,
|
||||||
min: 1,
|
min: 1,
|
||||||
@ -4274,7 +4274,7 @@ class MkbPreset {
|
|||||||
},
|
},
|
||||||
|
|
||||||
[MkbPreset.KEY_MOUSE_SENSITIVITY_X]: {
|
[MkbPreset.KEY_MOUSE_SENSITIVITY_X]: {
|
||||||
label: __('vertical-sensitivity'),
|
label: t('vertical-sensitivity'),
|
||||||
type: SettingElement.TYPE_NUMBER_STEPPER,
|
type: SettingElement.TYPE_NUMBER_STEPPER,
|
||||||
default: 50,
|
default: 50,
|
||||||
min: 1,
|
min: 1,
|
||||||
@ -4287,7 +4287,7 @@ class MkbPreset {
|
|||||||
},
|
},
|
||||||
|
|
||||||
[MkbPreset.KEY_MOUSE_DEADZONE_COUNTERWEIGHT]: {
|
[MkbPreset.KEY_MOUSE_DEADZONE_COUNTERWEIGHT]: {
|
||||||
label: __('deadzone-counterweight'),
|
label: t('deadzone-counterweight'),
|
||||||
type: SettingElement.TYPE_NUMBER_STEPPER,
|
type: SettingElement.TYPE_NUMBER_STEPPER,
|
||||||
default: 20,
|
default: 20,
|
||||||
min: 1,
|
min: 1,
|
||||||
@ -4300,7 +4300,7 @@ class MkbPreset {
|
|||||||
},
|
},
|
||||||
|
|
||||||
[MkbPreset.KEY_MOUSE_STICK_DECAY_STRENGTH]: {
|
[MkbPreset.KEY_MOUSE_STICK_DECAY_STRENGTH]: {
|
||||||
label: __('stick-decay-strength'),
|
label: t('stick-decay-strength'),
|
||||||
type: SettingElement.TYPE_NUMBER_STEPPER,
|
type: SettingElement.TYPE_NUMBER_STEPPER,
|
||||||
default: 18,
|
default: 18,
|
||||||
min: 10,
|
min: 10,
|
||||||
@ -4313,7 +4313,7 @@ class MkbPreset {
|
|||||||
},
|
},
|
||||||
|
|
||||||
[MkbPreset.KEY_MOUSE_STICK_DECAY_MIN]: {
|
[MkbPreset.KEY_MOUSE_STICK_DECAY_MIN]: {
|
||||||
label: __('stick-decay-minimum'),
|
label: t('stick-decay-minimum'),
|
||||||
type: SettingElement.TYPE_NUMBER_STEPPER,
|
type: SettingElement.TYPE_NUMBER_STEPPER,
|
||||||
default: 6,
|
default: 6,
|
||||||
min: 1,
|
min: 1,
|
||||||
@ -4543,7 +4543,7 @@ class LocalDb {
|
|||||||
|
|
||||||
// Create "Default" preset when the table is empty
|
// Create "Default" preset when the table is empty
|
||||||
const preset = {
|
const preset = {
|
||||||
name: __('default'),
|
name: t('default'),
|
||||||
data: MkbPreset.DEFAULT_PRESET,
|
data: MkbPreset.DEFAULT_PRESET,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4845,7 +4845,7 @@ class MkbHandler {
|
|||||||
this.#enabled = !this.#enabled;
|
this.#enabled = !this.#enabled;
|
||||||
this.#enabled ? document.pointerLockElement && this.start() : this.stop();
|
this.#enabled ? document.pointerLockElement && this.start() : this.stop();
|
||||||
|
|
||||||
Toast.show(__('mouse-and-keyboard'), __(this.#enabled ? 'enabled' : 'disabled'));
|
Toast.show(t('mouse-and-keyboard'), t(this.#enabled ? 'enabled' : 'disabled'));
|
||||||
|
|
||||||
if (this.#enabled) {
|
if (this.#enabled) {
|
||||||
!document.pointerLockElement && this.#waitForPointerLock(true);
|
!document.pointerLockElement && this.#waitForPointerLock(true);
|
||||||
@ -4924,8 +4924,8 @@ class MkbHandler {
|
|||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
CE('div', {},
|
CE('div', {},
|
||||||
CE('p', {}, __('mkb-click-to-activate')),
|
CE('p', {}, t('mkb-click-to-activate')),
|
||||||
CE('p', {}, __('press-key-to-toggle-mkb')({key: 'F9'})),
|
CE('p', {}, t('press-key-to-toggle-mkb')({key: 'F9'})),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -5084,8 +5084,8 @@ class MkbRemapper {
|
|||||||
this.bindingDialog = new Dialog({
|
this.bindingDialog = new Dialog({
|
||||||
className: 'bx-binding-dialog',
|
className: 'bx-binding-dialog',
|
||||||
content: CE('div', {},
|
content: CE('div', {},
|
||||||
CE('p', {}, __('press-to-bind')),
|
CE('p', {}, t('press-to-bind')),
|
||||||
CE('i', {}, __('press-esc-to-cancel')),
|
CE('i', {}, t('press-esc-to-cancel')),
|
||||||
),
|
),
|
||||||
hideCloseButton: true,
|
hideCloseButton: true,
|
||||||
});
|
});
|
||||||
@ -5222,7 +5222,7 @@ class MkbRemapper {
|
|||||||
// Update state of Activate button
|
// Update state of Activate button
|
||||||
const activated = getPref(Preferences.MKB_DEFAULT_PRESET_ID) === this.#STATE.currentPresetId;
|
const activated = getPref(Preferences.MKB_DEFAULT_PRESET_ID) === this.#STATE.currentPresetId;
|
||||||
this.#$.activateButton.disabled = activated;
|
this.#$.activateButton.disabled = activated;
|
||||||
this.#$.activateButton.querySelector('span').textContent = activated ? __('activated') : __('activate');
|
this.#$.activateButton.querySelector('span').textContent = activated ? t('activated') : t('activate');
|
||||||
}
|
}
|
||||||
|
|
||||||
#refresh() {
|
#refresh() {
|
||||||
@ -5267,7 +5267,7 @@ class MkbRemapper {
|
|||||||
// Update state of Activate button
|
// Update state of Activate button
|
||||||
const activated = defaultPresetId === this.#STATE.currentPresetId;
|
const activated = defaultPresetId === this.#STATE.currentPresetId;
|
||||||
this.#$.activateButton.disabled = activated;
|
this.#$.activateButton.disabled = activated;
|
||||||
this.#$.activateButton.querySelector('span').textContent = activated ? __('activated') : __('activate');
|
this.#$.activateButton.querySelector('span').textContent = activated ? t('activated') : t('activate');
|
||||||
|
|
||||||
!this.#STATE.isEditing && this.#switchPreset(this.#STATE.currentPresetId);
|
!this.#STATE.isEditing && this.#switchPreset(this.#STATE.currentPresetId);
|
||||||
});
|
});
|
||||||
@ -5311,7 +5311,7 @@ class MkbRemapper {
|
|||||||
const promptNewName = (value) => {
|
const promptNewName = (value) => {
|
||||||
let newName = '';
|
let newName = '';
|
||||||
while (!newName) {
|
while (!newName) {
|
||||||
newName = prompt(__('prompt-preset-name'), value);
|
newName = prompt(t('prompt-preset-name'), value);
|
||||||
if (newName === null) {
|
if (newName === null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -5325,7 +5325,7 @@ class MkbRemapper {
|
|||||||
this.#$.presetsSelect,
|
this.#$.presetsSelect,
|
||||||
// Rename button
|
// Rename button
|
||||||
createButton({
|
createButton({
|
||||||
title: __('rename'),
|
title: t('rename'),
|
||||||
icon: Icon.CURSOR_TEXT,
|
icon: Icon.CURSOR_TEXT,
|
||||||
onClick: e => {
|
onClick: e => {
|
||||||
const preset = this.#getCurrentPreset();
|
const preset = this.#getCurrentPreset();
|
||||||
@ -5344,7 +5344,7 @@ class MkbRemapper {
|
|||||||
// New button
|
// New button
|
||||||
createButton({
|
createButton({
|
||||||
icon: Icon.NEW,
|
icon: Icon.NEW,
|
||||||
title: __('new'),
|
title: t('new'),
|
||||||
onClick: e => {
|
onClick: e => {
|
||||||
let newName = promptNewName('');
|
let newName = promptNewName('');
|
||||||
if (!newName) {
|
if (!newName) {
|
||||||
@ -5362,7 +5362,7 @@ class MkbRemapper {
|
|||||||
// Copy button
|
// Copy button
|
||||||
createButton({
|
createButton({
|
||||||
icon: Icon.COPY,
|
icon: Icon.COPY,
|
||||||
title: __('copy'),
|
title: t('copy'),
|
||||||
onClick: e => {
|
onClick: e => {
|
||||||
const preset = this.#getCurrentPreset();
|
const preset = this.#getCurrentPreset();
|
||||||
|
|
||||||
@ -5383,9 +5383,9 @@ class MkbRemapper {
|
|||||||
createButton({
|
createButton({
|
||||||
icon: Icon.TRASH,
|
icon: Icon.TRASH,
|
||||||
style: ButtonStyle.DANGER,
|
style: ButtonStyle.DANGER,
|
||||||
title: __('delete'),
|
title: t('delete'),
|
||||||
onClick: e => {
|
onClick: e => {
|
||||||
if (!confirm(__('confirm-delete-preset'))) {
|
if (!confirm(t('confirm-delete-preset'))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5400,7 +5400,7 @@ class MkbRemapper {
|
|||||||
this.#$.wrapper.appendChild($header);
|
this.#$.wrapper.appendChild($header);
|
||||||
|
|
||||||
const $rows = CE('div', {'class': 'bx-mkb-settings-rows'},
|
const $rows = CE('div', {'class': 'bx-mkb-settings-rows'},
|
||||||
CE('i', {'class': 'bx-mkb-note'}, __('right-click-to-unbind')),
|
CE('i', {'class': 'bx-mkb-note'}, t('right-click-to-unbind')),
|
||||||
);
|
);
|
||||||
|
|
||||||
// Render keys
|
// Render keys
|
||||||
@ -5432,7 +5432,7 @@ class MkbRemapper {
|
|||||||
$rows.appendChild($keyRow);
|
$rows.appendChild($keyRow);
|
||||||
}
|
}
|
||||||
|
|
||||||
$rows.appendChild(CE('i', {'class': 'bx-mkb-note'}, __('mkb-adjust-ingame-settings')),);
|
$rows.appendChild(CE('i', {'class': 'bx-mkb-note'}, t('mkb-adjust-ingame-settings')),);
|
||||||
|
|
||||||
// Render mouse settings
|
// Render mouse settings
|
||||||
const $mouseSettings = document.createDocumentFragment();
|
const $mouseSettings = document.createDocumentFragment();
|
||||||
@ -5461,13 +5461,13 @@ class MkbRemapper {
|
|||||||
CE('div', {},
|
CE('div', {},
|
||||||
// Edit button
|
// Edit button
|
||||||
createButton({
|
createButton({
|
||||||
label: __('edit'),
|
label: t('edit'),
|
||||||
onClick: e => this.#toggleEditing(true),
|
onClick: e => this.#toggleEditing(true),
|
||||||
}),
|
}),
|
||||||
|
|
||||||
// Activate button
|
// Activate button
|
||||||
this.#$.activateButton = createButton({
|
this.#$.activateButton = createButton({
|
||||||
label: __('activate'),
|
label: t('activate'),
|
||||||
style: ButtonStyle.PRIMARY,
|
style: ButtonStyle.PRIMARY,
|
||||||
onClick: e => {
|
onClick: e => {
|
||||||
setPref(Preferences.MKB_DEFAULT_PRESET_ID, this.#STATE.currentPresetId);
|
setPref(Preferences.MKB_DEFAULT_PRESET_ID, this.#STATE.currentPresetId);
|
||||||
@ -5481,7 +5481,7 @@ class MkbRemapper {
|
|||||||
CE('div', {},
|
CE('div', {},
|
||||||
// Cancel button
|
// Cancel button
|
||||||
createButton({
|
createButton({
|
||||||
label: __('cancel'),
|
label: t('cancel'),
|
||||||
style: ButtonStyle.GHOST,
|
style: ButtonStyle.GHOST,
|
||||||
onClick: e => {
|
onClick: e => {
|
||||||
// Restore preset
|
// Restore preset
|
||||||
@ -5492,7 +5492,7 @@ class MkbRemapper {
|
|||||||
|
|
||||||
// Save button
|
// Save button
|
||||||
createButton({
|
createButton({
|
||||||
label: __('save'),
|
label: t('save'),
|
||||||
style: ButtonStyle.PRIMARY,
|
style: ButtonStyle.PRIMARY,
|
||||||
onClick: e => {
|
onClick: e => {
|
||||||
const updatedPreset = structuredClone(this.#getCurrentPreset());
|
const updatedPreset = structuredClone(this.#getCurrentPreset());
|
||||||
@ -5878,7 +5878,7 @@ class StreamBadges {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$badge = CE('div', {'class': 'bx-badge'},
|
$badge = CE('div', {'class': 'bx-badge'},
|
||||||
CE('span', {'class': 'bx-badge-name'}, __(`badge-${name}`)),
|
CE('span', {'class': 'bx-badge-name'}, t(`badge-${name}`)),
|
||||||
CE('span', {'class': 'bx-badge-value', 'style': `background-color: ${color}`}, value));
|
CE('span', {'class': 'bx-badge-value', 'style': `background-color: ${color}`}, value));
|
||||||
|
|
||||||
if (name === StreamBadges.BADGE_BATTERY) {
|
if (name === StreamBadges.BADGE_BATTERY) {
|
||||||
@ -5993,11 +5993,11 @@ class StreamBadges {
|
|||||||
|
|
||||||
let quality = profile;
|
let quality = profile;
|
||||||
if (profile.startsWith('4d')) {
|
if (profile.startsWith('4d')) {
|
||||||
quality = __('visual-quality-high');
|
quality = t('visual-quality-high');
|
||||||
} else if (profile.startsWith('42e')) {
|
} else if (profile.startsWith('42e')) {
|
||||||
quality = __('visual-quality-normal');
|
quality = t('visual-quality-normal');
|
||||||
} else if (profile.startsWith('420')) {
|
} else if (profile.startsWith('420')) {
|
||||||
quality = __('visual-quality-low');
|
quality = t('visual-quality-low');
|
||||||
}
|
}
|
||||||
|
|
||||||
video += ` (${quality})`;
|
video += ` (${quality})`;
|
||||||
@ -6245,12 +6245,12 @@ class StreamStats {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const STATS = {
|
const STATS = {
|
||||||
[StreamStats.PING]: [__('stat-ping'), StreamStats.#$ping = CE('span', {}, '0')],
|
[StreamStats.PING]: [t('stat-ping'), StreamStats.#$ping = CE('span', {}, '0')],
|
||||||
[StreamStats.FPS]: [__('stat-fps'), StreamStats.#$fps = CE('span', {}, '0')],
|
[StreamStats.FPS]: [t('stat-fps'), StreamStats.#$fps = CE('span', {}, '0')],
|
||||||
[StreamStats.BITRATE]: [__('stat-bitrate'), StreamStats.#$br = CE('span', {}, '0 Mbps')],
|
[StreamStats.BITRATE]: [t('stat-bitrate'), StreamStats.#$br = CE('span', {}, '0 Mbps')],
|
||||||
[StreamStats.DECODE_TIME]: [__('stat-decode-time'), StreamStats.#$dt = CE('span', {}, '0ms')],
|
[StreamStats.DECODE_TIME]: [t('stat-decode-time'), StreamStats.#$dt = CE('span', {}, '0ms')],
|
||||||
[StreamStats.PACKETS_LOST]: [__('stat-packets-lost'), StreamStats.#$pl = CE('span', {}, '0')],
|
[StreamStats.PACKETS_LOST]: [t('stat-packets-lost'), StreamStats.#$pl = CE('span', {}, '0')],
|
||||||
[StreamStats.FRAMES_LOST]: [__('stat-frames-lost'), StreamStats.#$fl = CE('span', {}, '0')],
|
[StreamStats.FRAMES_LOST]: [t('stat-frames-lost'), StreamStats.#$fl = CE('span', {}, '0')],
|
||||||
};
|
};
|
||||||
|
|
||||||
const $barFragment = document.createDocumentFragment();
|
const $barFragment = document.createDocumentFragment();
|
||||||
@ -6555,7 +6555,7 @@ class Preferences {
|
|||||||
[Preferences.STREAM_PREFERRED_LOCALE]: {
|
[Preferences.STREAM_PREFERRED_LOCALE]: {
|
||||||
'default': 'default',
|
'default': 'default',
|
||||||
'options': {
|
'options': {
|
||||||
'default': __('default'),
|
'default': t('default'),
|
||||||
'ar-SA': '\u0627\u0644\u0639\u0631\u0628\u064a\u0629',
|
'ar-SA': '\u0627\u0644\u0639\u0631\u0628\u064a\u0629',
|
||||||
'cs-CZ': '\u010de\u0161tina',
|
'cs-CZ': '\u010de\u0161tina',
|
||||||
'da-DK': 'dansk',
|
'da-DK': 'dansk',
|
||||||
@ -6588,7 +6588,7 @@ class Preferences {
|
|||||||
[Preferences.STREAM_TARGET_RESOLUTION]: {
|
[Preferences.STREAM_TARGET_RESOLUTION]: {
|
||||||
'default': '1080p',
|
'default': '1080p',
|
||||||
'options': {
|
'options': {
|
||||||
'auto': __('default'),
|
'auto': t('default'),
|
||||||
'1080p': '1080p',
|
'1080p': '1080p',
|
||||||
'720p': '720p',
|
'720p': '720p',
|
||||||
},
|
},
|
||||||
@ -6597,7 +6597,7 @@ class Preferences {
|
|||||||
'default': 'default',
|
'default': 'default',
|
||||||
'options': (() => {
|
'options': (() => {
|
||||||
const options = {
|
const options = {
|
||||||
'default': __('default'),
|
'default': t('default'),
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!('getCapabilities' in RTCRtpReceiver) || typeof RTCRtpTransceiver === 'undefined' || !('setCodecPreferences' in RTCRtpTransceiver.prototype)) {
|
if (!('getCapabilities' in RTCRtpReceiver) || typeof RTCRtpTransceiver === 'undefined' || !('setCodecPreferences' in RTCRtpTransceiver.prototype)) {
|
||||||
@ -6626,23 +6626,23 @@ class Preferences {
|
|||||||
|
|
||||||
if (hasLowCodec) {
|
if (hasLowCodec) {
|
||||||
if (!hasNormalCodec && !hasHighCodec) {
|
if (!hasNormalCodec && !hasHighCodec) {
|
||||||
options.default = `${__('visual-quality-low')} (${__('default')})`;
|
options.default = `${t('visual-quality-low')} (${t('default')})`;
|
||||||
} else {
|
} else {
|
||||||
options.low = __('visual-quality-low');
|
options.low = t('visual-quality-low');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (hasNormalCodec) {
|
if (hasNormalCodec) {
|
||||||
if (!hasLowCodec && !hasHighCodec) {
|
if (!hasLowCodec && !hasHighCodec) {
|
||||||
options.default = `${__('visual-quality-normal')} (${__('default')})`;
|
options.default = `${t('visual-quality-normal')} (${t('default')})`;
|
||||||
} else {
|
} else {
|
||||||
options.normal = __('visual-quality-normal');
|
options.normal = t('visual-quality-normal');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (hasHighCodec) {
|
if (hasHighCodec) {
|
||||||
if (!hasLowCodec && !hasNormalCodec) {
|
if (!hasLowCodec && !hasNormalCodec) {
|
||||||
options.default = `${__('visual-quality-high')} (${__('default')})`;
|
options.default = `${t('visual-quality-high')} (${t('default')})`;
|
||||||
} else {
|
} else {
|
||||||
options.high = __('visual-quality-high');
|
options.high = t('visual-quality-high');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6655,7 +6655,7 @@ class Preferences {
|
|||||||
|
|
||||||
if (keys.length <= 1) { // Unsupported
|
if (keys.length <= 1) { // Unsupported
|
||||||
setting.unsupported = true;
|
setting.unsupported = true;
|
||||||
setting.note = '⚠️ ' + __('browser-unsupported-feature');
|
setting.note = '⚠️ ' + t('browser-unsupported-feature');
|
||||||
} else {
|
} else {
|
||||||
// Set default value to the best codec profile
|
// Set default value to the best codec profile
|
||||||
// setting.default = keys[keys.length - 1];
|
// setting.default = keys[keys.length - 1];
|
||||||
@ -6668,9 +6668,9 @@ class Preferences {
|
|||||||
[Preferences.SCREENSHOT_BUTTON_POSITION]: {
|
[Preferences.SCREENSHOT_BUTTON_POSITION]: {
|
||||||
'default': 'bottom-left',
|
'default': 'bottom-left',
|
||||||
'options': {
|
'options': {
|
||||||
'bottom-left': __('bottom-left'),
|
'bottom-left': t('bottom-left'),
|
||||||
'bottom-right': __('bottom-right'),
|
'bottom-right': t('bottom-right'),
|
||||||
'none': __('disable'),
|
'none': t('disable'),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
[Preferences.SKIP_SPLASH_VIDEO]: {
|
[Preferences.SKIP_SPLASH_VIDEO]: {
|
||||||
@ -6682,9 +6682,9 @@ class Preferences {
|
|||||||
[Preferences.STREAM_TOUCH_CONTROLLER]: {
|
[Preferences.STREAM_TOUCH_CONTROLLER]: {
|
||||||
'default': 'all',
|
'default': 'all',
|
||||||
'options': {
|
'options': {
|
||||||
'default': __('default'),
|
'default': t('default'),
|
||||||
'all': __('tc-all-games'),
|
'all': t('tc-all-games'),
|
||||||
'off': __('off'),
|
'off': t('off'),
|
||||||
},
|
},
|
||||||
'unsupported': !HAS_TOUCH_SUPPORT,
|
'unsupported': !HAS_TOUCH_SUPPORT,
|
||||||
'ready': () => {
|
'ready': () => {
|
||||||
@ -6697,17 +6697,17 @@ class Preferences {
|
|||||||
[Preferences.STREAM_TOUCH_CONTROLLER_STYLE_STANDARD]: {
|
[Preferences.STREAM_TOUCH_CONTROLLER_STYLE_STANDARD]: {
|
||||||
'default': 'default',
|
'default': 'default',
|
||||||
'options': {
|
'options': {
|
||||||
'default': __('default'),
|
'default': t('default'),
|
||||||
'white': __('tc-all-white'),
|
'white': t('tc-all-white'),
|
||||||
'muted': __('tc-muted-colors'),
|
'muted': t('tc-muted-colors'),
|
||||||
},
|
},
|
||||||
'unsupported': !HAS_TOUCH_SUPPORT,
|
'unsupported': !HAS_TOUCH_SUPPORT,
|
||||||
},
|
},
|
||||||
[Preferences.STREAM_TOUCH_CONTROLLER_STYLE_CUSTOM]: {
|
[Preferences.STREAM_TOUCH_CONTROLLER_STYLE_CUSTOM]: {
|
||||||
'default': 'default',
|
'default': 'default',
|
||||||
'options': {
|
'options': {
|
||||||
'default': __('default'),
|
'default': t('default'),
|
||||||
'muted': __('tc-muted-colors'),
|
'muted': t('tc-muted-colors'),
|
||||||
},
|
},
|
||||||
'unsupported': !HAS_TOUCH_SUPPORT,
|
'unsupported': !HAS_TOUCH_SUPPORT,
|
||||||
},
|
},
|
||||||
@ -6726,7 +6726,7 @@ class Preferences {
|
|||||||
'note':CE('a', {
|
'note':CE('a', {
|
||||||
href: 'https://github.com/redphx/better-xcloud/discussions/275',
|
href: 'https://github.com/redphx/better-xcloud/discussions/275',
|
||||||
target: '_blank',
|
target: '_blank',
|
||||||
}, __('enable-local-co-op-support-note')),
|
}, t('enable-local-co-op-support-note')),
|
||||||
},
|
},
|
||||||
|
|
||||||
[Preferences.CONTROLLER_ENABLE_SHORTCUTS]: {
|
[Preferences.CONTROLLER_ENABLE_SHORTCUTS]: {
|
||||||
@ -6740,9 +6740,9 @@ class Preferences {
|
|||||||
[Preferences.CONTROLLER_DEVICE_VIBRATION]: {
|
[Preferences.CONTROLLER_DEVICE_VIBRATION]: {
|
||||||
'default': 'off',
|
'default': 'off',
|
||||||
'options': {
|
'options': {
|
||||||
'on': __('on'),
|
'on': t('on'),
|
||||||
'auto': __('device-vibration-not-using-gamepad'),
|
'auto': t('device-vibration-not-using-gamepad'),
|
||||||
'off': __('off'),
|
'off': t('off'),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -6762,7 +6762,7 @@ class Preferences {
|
|||||||
'default': false,
|
'default': false,
|
||||||
'unsupported': (() => {
|
'unsupported': (() => {
|
||||||
const userAgent = (window.navigator.orgUserAgent || window.navigator.userAgent || '').toLowerCase();
|
const userAgent = (window.navigator.orgUserAgent || window.navigator.userAgent || '').toLowerCase();
|
||||||
return userAgent.match(/(android|iphone|ipad)/) ? __('browser-unsupported-feature') : false;
|
return userAgent.match(/(android|iphone|ipad)/) ? t('browser-unsupported-feature') : false;
|
||||||
})(),
|
})(),
|
||||||
'ready': () => {
|
'ready': () => {
|
||||||
const pref = Preferences.SETTINGS[Preferences.MKB_ENABLED];
|
const pref = Preferences.SETTINGS[Preferences.MKB_ENABLED];
|
||||||
@ -6770,10 +6770,10 @@ class Preferences {
|
|||||||
let note;
|
let note;
|
||||||
let url;
|
let url;
|
||||||
if (pref.unsupported) {
|
if (pref.unsupported) {
|
||||||
note = __('browser-unsupported-feature');
|
note = t('browser-unsupported-feature');
|
||||||
url = 'https://github.com/redphx/better-xcloud/issues/206#issuecomment-1920475657';
|
url = 'https://github.com/redphx/better-xcloud/issues/206#issuecomment-1920475657';
|
||||||
} else {
|
} else {
|
||||||
note = __('mkb-disclaimer');
|
note = t('mkb-disclaimer');
|
||||||
url = 'https://better-xcloud.github.io/mouse-and-keyboard/#disclaimer';
|
url = 'https://better-xcloud.github.io/mouse-and-keyboard/#disclaimer';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6805,16 +6805,16 @@ class Preferences {
|
|||||||
[Preferences.UI_LOADING_SCREEN_ROCKET]: {
|
[Preferences.UI_LOADING_SCREEN_ROCKET]: {
|
||||||
'default': 'show',
|
'default': 'show',
|
||||||
'options': {
|
'options': {
|
||||||
'show': __('rocket-always-show'),
|
'show': t('rocket-always-show'),
|
||||||
'hide-queue': __('rocket-hide-queue'),
|
'hide-queue': t('rocket-hide-queue'),
|
||||||
'hide': __('rocket-always-hide'),
|
'hide': t('rocket-always-hide'),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
[Preferences.UI_LAYOUT]: {
|
[Preferences.UI_LAYOUT]: {
|
||||||
'default': 'default',
|
'default': 'default',
|
||||||
'options': {
|
'options': {
|
||||||
'default': __('default'),
|
'default': t('default'),
|
||||||
'tv': __('smart-tv'),
|
'tv': t('smart-tv'),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -6827,11 +6827,11 @@ class Preferences {
|
|||||||
[Preferences.USER_AGENT_PROFILE]: {
|
[Preferences.USER_AGENT_PROFILE]: {
|
||||||
'default': 'default',
|
'default': 'default',
|
||||||
'options': {
|
'options': {
|
||||||
[UserAgent.PROFILE_DEFAULT]: __('default'),
|
[UserAgent.PROFILE_DEFAULT]: t('default'),
|
||||||
[UserAgent.PROFILE_EDGE_WINDOWS]: 'Edge + Windows',
|
[UserAgent.PROFILE_EDGE_WINDOWS]: 'Edge + Windows',
|
||||||
[UserAgent.PROFILE_SAFARI_MACOS]: 'Safari + macOS',
|
[UserAgent.PROFILE_SAFARI_MACOS]: 'Safari + macOS',
|
||||||
[UserAgent.PROFILE_SMARTTV_TIZEN]: 'Samsung Smart TV',
|
[UserAgent.PROFILE_SMARTTV_TIZEN]: 'Samsung Smart TV',
|
||||||
[UserAgent.PROFILE_CUSTOM]: __('custom'),
|
[UserAgent.PROFILE_CUSTOM]: t('custom'),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
[Preferences.USER_AGENT_CUSTOM]: {
|
[Preferences.USER_AGENT_CUSTOM]: {
|
||||||
@ -6854,7 +6854,7 @@ class Preferences {
|
|||||||
'16:10': '16:10',
|
'16:10': '16:10',
|
||||||
'4:3': '4:3',
|
'4:3': '4:3',
|
||||||
|
|
||||||
'fill': __('stretch'),
|
'fill': t('stretch'),
|
||||||
//'cover': 'Cover',
|
//'cover': 'Cover',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -6910,12 +6910,12 @@ class Preferences {
|
|||||||
[Preferences.STATS_ITEMS]: {
|
[Preferences.STATS_ITEMS]: {
|
||||||
'default': [StreamStats.PING, StreamStats.FPS, StreamStats.BITRATE, StreamStats.DECODE_TIME, StreamStats.PACKETS_LOST, StreamStats.FRAMES_LOST],
|
'default': [StreamStats.PING, StreamStats.FPS, StreamStats.BITRATE, StreamStats.DECODE_TIME, StreamStats.PACKETS_LOST, StreamStats.FRAMES_LOST],
|
||||||
'multiple_options': {
|
'multiple_options': {
|
||||||
[StreamStats.PING]: `${StreamStats.PING.toUpperCase()}: ${__('stat-ping')}`,
|
[StreamStats.PING]: `${StreamStats.PING.toUpperCase()}: ${t('stat-ping')}`,
|
||||||
[StreamStats.FPS]: `${StreamStats.FPS.toUpperCase()}: ${__('stat-fps')}`,
|
[StreamStats.FPS]: `${StreamStats.FPS.toUpperCase()}: ${t('stat-fps')}`,
|
||||||
[StreamStats.BITRATE]: `${StreamStats.BITRATE.toUpperCase()}: ${__('stat-bitrate')}`,
|
[StreamStats.BITRATE]: `${StreamStats.BITRATE.toUpperCase()}: ${t('stat-bitrate')}`,
|
||||||
[StreamStats.DECODE_TIME]: `${StreamStats.DECODE_TIME.toUpperCase()}: ${__('stat-decode-time')}`,
|
[StreamStats.DECODE_TIME]: `${StreamStats.DECODE_TIME.toUpperCase()}: ${t('stat-decode-time')}`,
|
||||||
[StreamStats.PACKETS_LOST]: `${StreamStats.PACKETS_LOST.toUpperCase()}: ${__('stat-packets-lost')}`,
|
[StreamStats.PACKETS_LOST]: `${StreamStats.PACKETS_LOST.toUpperCase()}: ${t('stat-packets-lost')}`,
|
||||||
[StreamStats.FRAMES_LOST]: `${StreamStats.FRAMES_LOST.toUpperCase()}: ${__('stat-frames-lost')}`,
|
[StreamStats.FRAMES_LOST]: `${StreamStats.FRAMES_LOST.toUpperCase()}: ${t('stat-frames-lost')}`,
|
||||||
},
|
},
|
||||||
'params': {
|
'params': {
|
||||||
size: 6,
|
size: 6,
|
||||||
@ -6930,17 +6930,17 @@ class Preferences {
|
|||||||
[Preferences.STATS_POSITION]: {
|
[Preferences.STATS_POSITION]: {
|
||||||
'default': 'top-right',
|
'default': 'top-right',
|
||||||
'options': {
|
'options': {
|
||||||
'top-left': __('top-left'),
|
'top-left': t('top-left'),
|
||||||
'top-center': __('top-center'),
|
'top-center': t('top-center'),
|
||||||
'top-right': __('top-right'),
|
'top-right': t('top-right'),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
[Preferences.STATS_TEXT_SIZE]: {
|
[Preferences.STATS_TEXT_SIZE]: {
|
||||||
'default': '0.9rem',
|
'default': '0.9rem',
|
||||||
'options': {
|
'options': {
|
||||||
'0.9rem': __('small'),
|
'0.9rem': t('small'),
|
||||||
'1.0rem': __('normal'),
|
'1.0rem': t('normal'),
|
||||||
'1.1rem': __('large'),
|
'1.1rem': t('large'),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
[Preferences.STATS_TRANSPARENT]: {
|
[Preferences.STATS_TRANSPARENT]: {
|
||||||
@ -6974,7 +6974,7 @@ class Preferences {
|
|||||||
|
|
||||||
[Preferences.GAME_FORTNITE_FORCE_CONSOLE]: {
|
[Preferences.GAME_FORTNITE_FORCE_CONSOLE]: {
|
||||||
'default': false,
|
'default': false,
|
||||||
'note': __('fortnite-allow-stw-mode'),
|
'note': t('fortnite-allow-stw-mode'),
|
||||||
},
|
},
|
||||||
|
|
||||||
// Deprecated
|
// Deprecated
|
||||||
@ -9552,7 +9552,7 @@ function injectSettingsButton($parent) {
|
|||||||
const $remotePlayBtn = createButton({
|
const $remotePlayBtn = createButton({
|
||||||
classes: ['bx-remote-play-button'],
|
classes: ['bx-remote-play-button'],
|
||||||
icon: Icon.REMOTE_PLAY,
|
icon: Icon.REMOTE_PLAY,
|
||||||
title: __('remote-play'),
|
title: t('remote-play'),
|
||||||
style: ButtonStyle.GHOST | ButtonStyle.FOCUSABLE,
|
style: ButtonStyle.GHOST | ButtonStyle.FOCUSABLE,
|
||||||
onClick: e => {
|
onClick: e => {
|
||||||
RemotePlay.showDialog();
|
RemotePlay.showDialog();
|
||||||
@ -9599,7 +9599,7 @@ function injectSettingsButton($parent) {
|
|||||||
'href': SCRIPT_HOME,
|
'href': SCRIPT_HOME,
|
||||||
'target': '_blank',
|
'target': '_blank',
|
||||||
}, 'Better xCloud ' + SCRIPT_VERSION),
|
}, 'Better xCloud ' + SCRIPT_VERSION),
|
||||||
createButton({icon: Icon.QUESTION, label: __('help'), url: 'https://better-xcloud.github.io/features/'}),
|
createButton({icon: Icon.QUESTION, label: t('help'), url: 'https://better-xcloud.github.io/features/'}),
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
$updateAvailable = CE('a', {
|
$updateAvailable = CE('a', {
|
||||||
@ -9619,62 +9619,62 @@ function injectSettingsButton($parent) {
|
|||||||
// Render settings
|
// Render settings
|
||||||
const SETTINGS_UI = {
|
const SETTINGS_UI = {
|
||||||
'Better xCloud': {
|
'Better xCloud': {
|
||||||
[Preferences.BETTER_XCLOUD_LOCALE]: __('language'),
|
[Preferences.BETTER_XCLOUD_LOCALE]: t('language'),
|
||||||
[Preferences.REMOTE_PLAY_ENABLED]: __('enable-remote-play-feature'),
|
[Preferences.REMOTE_PLAY_ENABLED]: t('enable-remote-play-feature'),
|
||||||
},
|
},
|
||||||
[__('server')]: {
|
[t('server')]: {
|
||||||
[Preferences.SERVER_REGION]: __('region'),
|
[Preferences.SERVER_REGION]: t('region'),
|
||||||
[Preferences.STREAM_PREFERRED_LOCALE]: __('preferred-game-language'),
|
[Preferences.STREAM_PREFERRED_LOCALE]: t('preferred-game-language'),
|
||||||
[Preferences.PREFER_IPV6_SERVER]: __('prefer-ipv6-server'),
|
[Preferences.PREFER_IPV6_SERVER]: t('prefer-ipv6-server'),
|
||||||
},
|
},
|
||||||
[__('stream')]: {
|
[t('stream')]: {
|
||||||
[Preferences.STREAM_TARGET_RESOLUTION]: __('target-resolution'),
|
[Preferences.STREAM_TARGET_RESOLUTION]: t('target-resolution'),
|
||||||
[Preferences.STREAM_CODEC_PROFILE]: __('visual-quality'),
|
[Preferences.STREAM_CODEC_PROFILE]: t('visual-quality'),
|
||||||
[Preferences.CONTROLLER_SUPPORT_LOCAL_CO_OP]: '🛋️ ' + __('enable-local-co-op-support'),
|
[Preferences.CONTROLLER_SUPPORT_LOCAL_CO_OP]: '🛋️ ' + t('enable-local-co-op-support'),
|
||||||
[Preferences.GAME_FORTNITE_FORCE_CONSOLE]: '🎮 ' + __('fortnite-force-console-version'),
|
[Preferences.GAME_FORTNITE_FORCE_CONSOLE]: '🎮 ' + t('fortnite-force-console-version'),
|
||||||
[Preferences.AUDIO_ENABLE_VOLUME_CONTROL]: __('enable-volume-control'),
|
[Preferences.AUDIO_ENABLE_VOLUME_CONTROL]: t('enable-volume-control'),
|
||||||
[Preferences.AUDIO_MIC_ON_PLAYING]: __('enable-mic-on-startup'),
|
[Preferences.AUDIO_MIC_ON_PLAYING]: t('enable-mic-on-startup'),
|
||||||
[Preferences.STREAM_DISABLE_FEEDBACK_DIALOG]: __('disable-post-stream-feedback-dialog'),
|
[Preferences.STREAM_DISABLE_FEEDBACK_DIALOG]: t('disable-post-stream-feedback-dialog'),
|
||||||
},
|
},
|
||||||
|
|
||||||
[__('mouse-and-keyboard')]: {
|
[t('mouse-and-keyboard')]: {
|
||||||
// '_note': '⚠️ ' + __('may-not-work-properly'),
|
// '_note': '⚠️ ' + t('may-not-work-properly'),
|
||||||
// [Preferences.MKB_ENABLED]: [__('enable-mkb'), __('only-supports-some-games')],
|
// [Preferences.MKB_ENABLED]: [t('enable-mkb'), t('only-supports-some-games')],
|
||||||
[Preferences.MKB_ENABLED]: __('enable-mkb'),
|
[Preferences.MKB_ENABLED]: t('enable-mkb'),
|
||||||
[Preferences.MKB_HIDE_IDLE_CURSOR]: __('hide-idle-cursor'),
|
[Preferences.MKB_HIDE_IDLE_CURSOR]: t('hide-idle-cursor'),
|
||||||
},
|
},
|
||||||
|
|
||||||
/*
|
/*
|
||||||
[__('controller')]: {
|
[t('controller')]: {
|
||||||
[Preferences.CONTROLLER_ENABLE_SHORTCUTS]: __('enable-controller-shortcuts'),
|
[Preferences.CONTROLLER_ENABLE_SHORTCUTS]: t('enable-controller-shortcuts'),
|
||||||
},
|
},
|
||||||
*/
|
*/
|
||||||
[__('touch-controller')]: {
|
[t('touch-controller')]: {
|
||||||
_note: !HAS_TOUCH_SUPPORT ? '⚠️ ' + __('device-unsupported-touch') : null,
|
_note: !HAS_TOUCH_SUPPORT ? '⚠️ ' + t('device-unsupported-touch') : null,
|
||||||
[Preferences.STREAM_TOUCH_CONTROLLER]: __('tc-availability'),
|
[Preferences.STREAM_TOUCH_CONTROLLER]: t('tc-availability'),
|
||||||
[Preferences.STREAM_TOUCH_CONTROLLER_STYLE_STANDARD]: __('tc-standard-layout-style'),
|
[Preferences.STREAM_TOUCH_CONTROLLER_STYLE_STANDARD]: t('tc-standard-layout-style'),
|
||||||
[Preferences.STREAM_TOUCH_CONTROLLER_STYLE_CUSTOM]: __('tc-custom-layout-style'),
|
[Preferences.STREAM_TOUCH_CONTROLLER_STYLE_CUSTOM]: t('tc-custom-layout-style'),
|
||||||
},
|
},
|
||||||
|
|
||||||
[__('loading-screen')]: {
|
[t('loading-screen')]: {
|
||||||
[Preferences.UI_LOADING_SCREEN_GAME_ART]: __('show-game-art'),
|
[Preferences.UI_LOADING_SCREEN_GAME_ART]: t('show-game-art'),
|
||||||
[Preferences.UI_LOADING_SCREEN_WAIT_TIME]: __('show-wait-time'),
|
[Preferences.UI_LOADING_SCREEN_WAIT_TIME]: t('show-wait-time'),
|
||||||
[Preferences.UI_LOADING_SCREEN_ROCKET]: __('rocket-animation'),
|
[Preferences.UI_LOADING_SCREEN_ROCKET]: t('rocket-animation'),
|
||||||
},
|
},
|
||||||
[__('ui')]: {
|
[t('ui')]: {
|
||||||
[Preferences.UI_LAYOUT]: __('layout'),
|
[Preferences.UI_LAYOUT]: t('layout'),
|
||||||
[Preferences.STREAM_SIMPLIFY_MENU]: __('simplify-stream-menu'),
|
[Preferences.STREAM_SIMPLIFY_MENU]: t('simplify-stream-menu'),
|
||||||
[Preferences.SKIP_SPLASH_VIDEO]: __('skip-splash-video'),
|
[Preferences.SKIP_SPLASH_VIDEO]: t('skip-splash-video'),
|
||||||
[Preferences.HIDE_DOTS_ICON]: __('hide-system-menu-icon'),
|
[Preferences.HIDE_DOTS_ICON]: t('hide-system-menu-icon'),
|
||||||
[Preferences.REDUCE_ANIMATIONS]: __('reduce-animations'),
|
[Preferences.REDUCE_ANIMATIONS]: t('reduce-animations'),
|
||||||
[Preferences.SCREENSHOT_BUTTON_POSITION]: __('screenshot-button-position'),
|
[Preferences.SCREENSHOT_BUTTON_POSITION]: t('screenshot-button-position'),
|
||||||
},
|
},
|
||||||
[__('other')]: {
|
[t('other')]: {
|
||||||
[Preferences.BLOCK_SOCIAL_FEATURES]: __('disable-social-features'),
|
[Preferences.BLOCK_SOCIAL_FEATURES]: t('disable-social-features'),
|
||||||
[Preferences.BLOCK_TRACKING]: __('disable-xcloud-analytics'),
|
[Preferences.BLOCK_TRACKING]: t('disable-xcloud-analytics'),
|
||||||
},
|
},
|
||||||
[__('advanced')]: {
|
[t('advanced')]: {
|
||||||
[Preferences.USER_AGENT_PROFILE]: __('user-agent-profile'),
|
[Preferences.USER_AGENT_PROFILE]: t('user-agent-profile'),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -9738,7 +9738,7 @@ function injectSettingsButton($parent) {
|
|||||||
|
|
||||||
let label = regionName;
|
let label = regionName;
|
||||||
if (region.isDefault) {
|
if (region.isDefault) {
|
||||||
label += ` (${__('default')})`;
|
label += ` (${t('default')})`;
|
||||||
value = 'default';
|
value = 'default';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -9793,19 +9793,19 @@ function injectSettingsButton($parent) {
|
|||||||
// Setup Reload button
|
// Setup Reload button
|
||||||
const $reloadBtn = createButton({
|
const $reloadBtn = createButton({
|
||||||
classes: ['bx-settings-reload-button'],
|
classes: ['bx-settings-reload-button'],
|
||||||
label: __('settings-reload'),
|
label: t('settings-reload'),
|
||||||
style: ButtonStyle.PRIMARY | ButtonStyle.FOCUSABLE | ButtonStyle.FULL_WIDTH,
|
style: ButtonStyle.PRIMARY | ButtonStyle.FOCUSABLE | ButtonStyle.FULL_WIDTH,
|
||||||
onClick: e => {
|
onClick: e => {
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
$reloadBtn.disabled = true;
|
$reloadBtn.disabled = true;
|
||||||
$reloadBtn.textContent = __('settings-reloading');
|
$reloadBtn.textContent = t('settings-reloading');
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
$reloadBtn.setAttribute('tabindex', 0);
|
$reloadBtn.setAttribute('tabindex', 0);
|
||||||
$wrapper.appendChild($reloadBtn);
|
$wrapper.appendChild($reloadBtn);
|
||||||
|
|
||||||
// Donation link
|
// Donation link
|
||||||
const $donationLink = CE('a', {'class': 'bx-donation-link', href: 'https://ko-fi.com/redphx', target: '_blank'}, `❤️ ${__('support-better-xcloud')}`);
|
const $donationLink = CE('a', {'class': 'bx-donation-link', href: 'https://ko-fi.com/redphx', target: '_blank'}, `❤️ ${t('support-better-xcloud')}`);
|
||||||
$wrapper.appendChild($donationLink);
|
$wrapper.appendChild($donationLink);
|
||||||
|
|
||||||
// Show Game Pass app version
|
// Show Game Pass app version
|
||||||
@ -10091,7 +10091,7 @@ function injectStreamMenuButtons() {
|
|||||||
const $btnQuit = $node.querySelector('div[class^=StreamMenu] > div > button:last-child');
|
const $btnQuit = $node.querySelector('div[class^=StreamMenu] > div > button:last-child');
|
||||||
// Hold "Quit game" button to refresh the stream
|
// Hold "Quit game" button to refresh the stream
|
||||||
new MouseHoldEvent($btnQuit, () => {
|
new MouseHoldEvent($btnQuit, () => {
|
||||||
confirm(__('confirm-reload-stream')) && window.location.reload();
|
confirm(t('confirm-reload-stream')) && window.location.reload();
|
||||||
}, 1000);
|
}, 1000);
|
||||||
|
|
||||||
// Render stream badges
|
// Render stream badges
|
||||||
@ -10128,7 +10128,7 @@ function injectStreamMenuButtons() {
|
|||||||
|
|
||||||
// Create Stream Settings button
|
// Create Stream Settings button
|
||||||
if (!$btnStreamSettings) {
|
if (!$btnStreamSettings) {
|
||||||
$btnStreamSettings = cloneStreamHudButton($orgButton, __('menu-stream-settings'), Icon.STREAM_SETTINGS);
|
$btnStreamSettings = cloneStreamHudButton($orgButton, t('menu-stream-settings'), Icon.STREAM_SETTINGS);
|
||||||
$btnStreamSettings.addEventListener('click', e => {
|
$btnStreamSettings.addEventListener('click', e => {
|
||||||
hideGripHandle();
|
hideGripHandle();
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
@ -10149,7 +10149,7 @@ function injectStreamMenuButtons() {
|
|||||||
|
|
||||||
// Create Stream Stats button
|
// Create Stream Stats button
|
||||||
if (!$btnStreamStats) {
|
if (!$btnStreamStats) {
|
||||||
$btnStreamStats = cloneStreamHudButton($orgButton, __('menu-stream-stats'), Icon.STREAM_STATS);
|
$btnStreamStats = cloneStreamHudButton($orgButton, t('menu-stream-stats'), Icon.STREAM_STATS);
|
||||||
$btnStreamStats.addEventListener('click', e => {
|
$btnStreamStats.addEventListener('click', e => {
|
||||||
hideGripHandle();
|
hideGripHandle();
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
@ -10299,7 +10299,7 @@ function setupQuickSettingsBar() {
|
|||||||
items: [
|
items: [
|
||||||
{
|
{
|
||||||
group: 'mkb',
|
group: 'mkb',
|
||||||
label: __('mouse-and-keyboard'),
|
label: t('mouse-and-keyboard'),
|
||||||
help_url: 'https://better-xcloud.github.io/mouse-and-keyboard/',
|
help_url: 'https://better-xcloud.github.io/mouse-and-keyboard/',
|
||||||
content: MkbRemapper.INSTANCE.render(),
|
content: MkbRemapper.INSTANCE.render(),
|
||||||
},
|
},
|
||||||
@ -10312,12 +10312,12 @@ function setupQuickSettingsBar() {
|
|||||||
items: [
|
items: [
|
||||||
{
|
{
|
||||||
group: 'audio',
|
group: 'audio',
|
||||||
label: __('audio'),
|
label: t('audio'),
|
||||||
help_url: 'https://better-xcloud.github.io/ingame-features/#audio',
|
help_url: 'https://better-xcloud.github.io/ingame-features/#audio',
|
||||||
items: [
|
items: [
|
||||||
{
|
{
|
||||||
pref: Preferences.AUDIO_VOLUME,
|
pref: Preferences.AUDIO_VOLUME,
|
||||||
label: __('volume'),
|
label: t('volume'),
|
||||||
onChange: (e, value) => {
|
onChange: (e, value) => {
|
||||||
STREAM_AUDIO_GAIN_NODE && (STREAM_AUDIO_GAIN_NODE.gain.value = (value / 100).toFixed(2));
|
STREAM_AUDIO_GAIN_NODE && (STREAM_AUDIO_GAIN_NODE.gain.value = (value / 100).toFixed(2));
|
||||||
},
|
},
|
||||||
@ -10330,38 +10330,38 @@ function setupQuickSettingsBar() {
|
|||||||
|
|
||||||
{
|
{
|
||||||
group: 'video',
|
group: 'video',
|
||||||
label: __('video'),
|
label: t('video'),
|
||||||
help_url: 'https://better-xcloud.github.io/ingame-features/#video',
|
help_url: 'https://better-xcloud.github.io/ingame-features/#video',
|
||||||
note: CE('div', {'class': 'bx-quick-settings-bar-note bx-clarity-boost-warning'}, `⚠️ ${__('clarity-boost-warning')}`),
|
note: CE('div', {'class': 'bx-quick-settings-bar-note bx-clarity-boost-warning'}, `⚠️ ${t('clarity-boost-warning')}`),
|
||||||
items: [
|
items: [
|
||||||
{
|
{
|
||||||
pref: Preferences.VIDEO_RATIO,
|
pref: Preferences.VIDEO_RATIO,
|
||||||
label: __('ratio'),
|
label: t('ratio'),
|
||||||
onChange: updateVideoPlayerCss,
|
onChange: updateVideoPlayerCss,
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
pref: Preferences.VIDEO_CLARITY,
|
pref: Preferences.VIDEO_CLARITY,
|
||||||
label: __('clarity'),
|
label: t('clarity'),
|
||||||
onChange: updateVideoPlayerCss,
|
onChange: updateVideoPlayerCss,
|
||||||
unsupported: isSafari,
|
unsupported: isSafari,
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
pref: Preferences.VIDEO_SATURATION,
|
pref: Preferences.VIDEO_SATURATION,
|
||||||
label: __('saturation'),
|
label: t('saturation'),
|
||||||
onChange: updateVideoPlayerCss,
|
onChange: updateVideoPlayerCss,
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
pref: Preferences.VIDEO_CONTRAST,
|
pref: Preferences.VIDEO_CONTRAST,
|
||||||
label: __('contrast'),
|
label: t('contrast'),
|
||||||
onChange: updateVideoPlayerCss,
|
onChange: updateVideoPlayerCss,
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
pref: Preferences.VIDEO_BRIGHTNESS,
|
pref: Preferences.VIDEO_BRIGHTNESS,
|
||||||
label: __('brightness'),
|
label: t('brightness'),
|
||||||
onChange: updateVideoPlayerCss,
|
onChange: updateVideoPlayerCss,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@ -10375,26 +10375,26 @@ function setupQuickSettingsBar() {
|
|||||||
items: [
|
items: [
|
||||||
{
|
{
|
||||||
group: 'controller',
|
group: 'controller',
|
||||||
label: __('controller'),
|
label: t('controller'),
|
||||||
help_url: 'https://better-xcloud.github.io/ingame-features/#controller',
|
help_url: 'https://better-xcloud.github.io/ingame-features/#controller',
|
||||||
items: [
|
items: [
|
||||||
{
|
{
|
||||||
pref: Preferences.CONTROLLER_ENABLE_VIBRATION,
|
pref: Preferences.CONTROLLER_ENABLE_VIBRATION,
|
||||||
label: __('controller-vibration'),
|
label: t('controller-vibration'),
|
||||||
unsupported: !VibrationManager.supportControllerVibration(),
|
unsupported: !VibrationManager.supportControllerVibration(),
|
||||||
onChange: VibrationManager.updateGlobalVars,
|
onChange: VibrationManager.updateGlobalVars,
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
pref: Preferences.CONTROLLER_DEVICE_VIBRATION,
|
pref: Preferences.CONTROLLER_DEVICE_VIBRATION,
|
||||||
label: __('device-vibration'),
|
label: t('device-vibration'),
|
||||||
unsupported: !VibrationManager.supportDeviceVibration(),
|
unsupported: !VibrationManager.supportDeviceVibration(),
|
||||||
onChange: VibrationManager.updateGlobalVars,
|
onChange: VibrationManager.updateGlobalVars,
|
||||||
},
|
},
|
||||||
|
|
||||||
(VibrationManager.supportControllerVibration() || VibrationManager.supportDeviceVibration()) && {
|
(VibrationManager.supportControllerVibration() || VibrationManager.supportDeviceVibration()) && {
|
||||||
pref: Preferences.CONTROLLER_VIBRATION_INTENSITY,
|
pref: Preferences.CONTROLLER_VIBRATION_INTENSITY,
|
||||||
label: __('vibration-intensity'),
|
label: t('vibration-intensity'),
|
||||||
unsupported: !VibrationManager.supportDeviceVibration(),
|
unsupported: !VibrationManager.supportDeviceVibration(),
|
||||||
onChange: VibrationManager.updateGlobalVars,
|
onChange: VibrationManager.updateGlobalVars,
|
||||||
},
|
},
|
||||||
@ -10409,11 +10409,11 @@ function setupQuickSettingsBar() {
|
|||||||
items: [
|
items: [
|
||||||
{
|
{
|
||||||
group: 'touch-controller',
|
group: 'touch-controller',
|
||||||
label: __('touch-controller'),
|
label: t('touch-controller'),
|
||||||
items: [
|
items: [
|
||||||
{
|
{
|
||||||
label: __('layout'),
|
label: t('layout'),
|
||||||
content: CE('select', {disabled: true}, CE('option', {}, __('default'))),
|
content: CE('select', {disabled: true}, CE('option', {}, t('default'))),
|
||||||
onMounted: $elm => {
|
onMounted: $elm => {
|
||||||
$elm.addEventListener('change', e => {
|
$elm.addEventListener('change', e => {
|
||||||
TouchController.loadCustomLayout(GAME_XBOX_TITLE_ID, $elm.value, 1000);
|
TouchController.loadCustomLayout(GAME_XBOX_TITLE_ID, $elm.value, 1000);
|
||||||
@ -10436,7 +10436,7 @@ function setupQuickSettingsBar() {
|
|||||||
|
|
||||||
$elm.disabled = !data;
|
$elm.disabled = !data;
|
||||||
if (!data) {
|
if (!data) {
|
||||||
$elm.appendChild(CE('option', {value: ''}, __('default')));
|
$elm.appendChild(CE('option', {value: ''}, t('default')));
|
||||||
$elm.value = '';
|
$elm.value = '';
|
||||||
$elm.dispatchEvent(new Event('change'));
|
$elm.dispatchEvent(new Event('change'));
|
||||||
return;
|
return;
|
||||||
@ -10468,48 +10468,48 @@ function setupQuickSettingsBar() {
|
|||||||
items: [
|
items: [
|
||||||
{
|
{
|
||||||
group: 'stats',
|
group: 'stats',
|
||||||
label: __('menu-stream-stats'),
|
label: t('menu-stream-stats'),
|
||||||
help_url: 'https://better-xcloud.github.io/stream-stats/',
|
help_url: 'https://better-xcloud.github.io/stream-stats/',
|
||||||
items: [
|
items: [
|
||||||
{
|
{
|
||||||
pref: Preferences.STATS_SHOW_WHEN_PLAYING,
|
pref: Preferences.STATS_SHOW_WHEN_PLAYING,
|
||||||
label: __('show-stats-on-startup'),
|
label: t('show-stats-on-startup'),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
pref: Preferences.STATS_QUICK_GLANCE,
|
pref: Preferences.STATS_QUICK_GLANCE,
|
||||||
label: '👀 ' + __('enable-quick-glance-mode'),
|
label: '👀 ' + t('enable-quick-glance-mode'),
|
||||||
onChange: e => {
|
onChange: e => {
|
||||||
e.target.checked ? StreamStats.quickGlanceSetup() : StreamStats.quickGlanceStop();
|
e.target.checked ? StreamStats.quickGlanceSetup() : StreamStats.quickGlanceStop();
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
pref: Preferences.STATS_ITEMS,
|
pref: Preferences.STATS_ITEMS,
|
||||||
label: __('stats'),
|
label: t('stats'),
|
||||||
onChange: StreamStats.refreshStyles,
|
onChange: StreamStats.refreshStyles,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
pref: Preferences.STATS_POSITION,
|
pref: Preferences.STATS_POSITION,
|
||||||
label: __('position'),
|
label: t('position'),
|
||||||
onChange: StreamStats.refreshStyles,
|
onChange: StreamStats.refreshStyles,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
pref: Preferences.STATS_TEXT_SIZE,
|
pref: Preferences.STATS_TEXT_SIZE,
|
||||||
label: __('text-size'),
|
label: t('text-size'),
|
||||||
onChange: StreamStats.refreshStyles,
|
onChange: StreamStats.refreshStyles,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
pref: Preferences.STATS_OPACITY,
|
pref: Preferences.STATS_OPACITY,
|
||||||
label: __('opacity'),
|
label: t('opacity'),
|
||||||
onChange: StreamStats.refreshStyles,
|
onChange: StreamStats.refreshStyles,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
pref: Preferences.STATS_TRANSPARENT,
|
pref: Preferences.STATS_TRANSPARENT,
|
||||||
label: __('transparent-background'),
|
label: t('transparent-background'),
|
||||||
onChange: StreamStats.refreshStyles,
|
onChange: StreamStats.refreshStyles,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
pref: Preferences.STATS_CONDITIONAL_FORMATTING,
|
pref: Preferences.STATS_CONDITIONAL_FORMATTING,
|
||||||
label: __('conditional-formatting'),
|
label: t('conditional-formatting'),
|
||||||
onChange: StreamStats.refreshStyles,
|
onChange: StreamStats.refreshStyles,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@ -10572,7 +10572,7 @@ function setupQuickSettingsBar() {
|
|||||||
icon: Icon.QUESTION,
|
icon: Icon.QUESTION,
|
||||||
style: ButtonStyle.GHOST,
|
style: ButtonStyle.GHOST,
|
||||||
url: settingGroup.help_url,
|
url: settingGroup.help_url,
|
||||||
title: __('help'),
|
title: t('help'),
|
||||||
}),
|
}),
|
||||||
));
|
));
|
||||||
if (settingGroup.note) {
|
if (settingGroup.note) {
|
||||||
@ -10608,7 +10608,7 @@ function setupQuickSettingsBar() {
|
|||||||
const $content = CE('div', {'class': 'bx-quick-settings-row', 'data-type': settingGroup.group},
|
const $content = CE('div', {'class': 'bx-quick-settings-row', 'data-type': settingGroup.group},
|
||||||
CE('label', {for: `bx_setting_${pref}`},
|
CE('label', {for: `bx_setting_${pref}`},
|
||||||
setting.label,
|
setting.label,
|
||||||
setting.unsupported && CE('div', {'class': 'bx-quick-settings-bar-note'}, __('browser-unsupported-feature')),
|
setting.unsupported && CE('div', {'class': 'bx-quick-settings-bar-note'}, t('browser-unsupported-feature')),
|
||||||
),
|
),
|
||||||
!setting.unsupported && $control,
|
!setting.unsupported && $control,
|
||||||
);
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user