mirror of
https://github.com/redphx/better-xcloud.git
synced 2025-06-25 08:53:04 +02:00
Move foreign translations to external files
This commit is contained in:
parent
a87b26b077
commit
c4ad50906e
@ -1,11 +1,10 @@
|
|||||||
import { STATES } from "@utils/global";
|
import { NATIVE_FETCH, STATES } from "@utils/global";
|
||||||
import { escapeHtml } from "@utils/html";
|
import { escapeHtml } from "@utils/html";
|
||||||
import { Toast } from "@utils/toast";
|
import { Toast } from "@utils/toast";
|
||||||
import { BxEvent } from "@utils/bx-event";
|
import { BxEvent } from "@utils/bx-event";
|
||||||
import { BX_FLAGS } from "@utils/bx-flags";
|
import { BX_FLAGS } from "@utils/bx-flags";
|
||||||
import { getPref, PrefKey } from "@utils/preferences";
|
import { getPref, PrefKey } from "@utils/preferences";
|
||||||
import { t } from "@utils/translation";
|
import { t } from "@utils/translation";
|
||||||
import { NATIVE_FETCH } from "@utils/network";
|
|
||||||
import { BxLogger } from "@utils/bx-logger";
|
import { BxLogger } from "@utils/bx-logger";
|
||||||
|
|
||||||
const LOG_TAG = 'TouchController';
|
const LOG_TAG = 'TouchController';
|
||||||
|
@ -4,7 +4,7 @@ import { BxIcon } from "@utils/bx-icon";
|
|||||||
import { getPreferredServerRegion } from "@utils/region";
|
import { getPreferredServerRegion } from "@utils/region";
|
||||||
import { UserAgent, UserAgentProfile } from "@utils/user-agent";
|
import { UserAgent, UserAgentProfile } from "@utils/user-agent";
|
||||||
import { getPref, Preferences, PrefKey, setPref, toPrefElement } from "@utils/preferences";
|
import { getPref, Preferences, PrefKey, setPref, toPrefElement } from "@utils/preferences";
|
||||||
import { t, refreshCurrentLocale } from "@utils/translation";
|
import { t, Translations } from "@utils/translation";
|
||||||
import { PatcherCache } from "../patcher";
|
import { PatcherCache } from "../patcher";
|
||||||
|
|
||||||
const SETTINGS_UI = {
|
const SETTINGS_UI = {
|
||||||
@ -181,7 +181,7 @@ export function setupSettingsUi() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const onChange = (e: Event) => {
|
const onChange = async (e: Event) => {
|
||||||
// Clear PatcherCache;
|
// Clear PatcherCache;
|
||||||
PatcherCache.clear();
|
PatcherCache.clear();
|
||||||
|
|
||||||
@ -193,7 +193,8 @@ export function setupSettingsUi() {
|
|||||||
|
|
||||||
if ((e.target as HTMLElement).id === 'bx_setting_' + PrefKey.BETTER_XCLOUD_LOCALE) {
|
if ((e.target as HTMLElement).id === 'bx_setting_' + PrefKey.BETTER_XCLOUD_LOCALE) {
|
||||||
// Update locale
|
// Update locale
|
||||||
refreshCurrentLocale();
|
Translations.refreshCurrentLocale();
|
||||||
|
await Translations.updateTranslations();
|
||||||
|
|
||||||
$btnReload.textContent = t('settings-reloading');
|
$btnReload.textContent = t('settings-reloading');
|
||||||
$btnReload.click();
|
$btnReload.click();
|
||||||
|
@ -5,6 +5,8 @@ export const SCRIPT_HOME = 'https://github.com/redphx/better-xcloud';
|
|||||||
|
|
||||||
export const AppInterface = window.AppInterface;
|
export const AppInterface = window.AppInterface;
|
||||||
|
|
||||||
|
export const NATIVE_FETCH = window.fetch;
|
||||||
|
|
||||||
UserAgent.init();
|
UserAgent.init();
|
||||||
const userAgent = window.navigator.userAgent.toLowerCase();
|
const userAgent = window.navigator.userAgent.toLowerCase();
|
||||||
|
|
||||||
|
@ -5,14 +5,12 @@ import { PrefKey, getPref } from "@utils/preferences";
|
|||||||
import { RemotePlay } from "@modules/remote-play";
|
import { RemotePlay } from "@modules/remote-play";
|
||||||
import { StreamBadges } from "@modules/stream/stream-badges";
|
import { StreamBadges } from "@modules/stream/stream-badges";
|
||||||
import { TouchController } from "@modules/touch-controller";
|
import { TouchController } from "@modules/touch-controller";
|
||||||
import { STATES } from "@utils/global";
|
import { NATIVE_FETCH, STATES } from "@utils/global";
|
||||||
import { getPreferredServerRegion } from "@utils/region";
|
import { getPreferredServerRegion } from "@utils/region";
|
||||||
import { GamePassCloudGallery } from "./gamepass-gallery";
|
import { GamePassCloudGallery } from "./gamepass-gallery";
|
||||||
import { InputType } from "./bx-exposed";
|
import { InputType } from "./bx-exposed";
|
||||||
import { UserAgent } from "./user-agent";
|
import { UserAgent } from "./user-agent";
|
||||||
|
|
||||||
export const NATIVE_FETCH = window.fetch;
|
|
||||||
|
|
||||||
enum RequestType {
|
enum RequestType {
|
||||||
XCLOUD = 'xcloud',
|
XCLOUD = 'xcloud',
|
||||||
XHOME = 'xhome',
|
XHOME = 'xhome',
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,7 @@
|
|||||||
import { PrefKey, getPref, setPref } from "@utils/preferences";
|
import { PrefKey, getPref, setPref } from "@utils/preferences";
|
||||||
import { AppInterface, SCRIPT_VERSION } from "@utils/global";
|
import { AppInterface, SCRIPT_VERSION } from "@utils/global";
|
||||||
import { UserAgent } from "@utils/user-agent";
|
import { UserAgent } from "@utils/user-agent";
|
||||||
|
import { Translations } from "./translation";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check for update
|
* Check for update
|
||||||
@ -25,6 +26,9 @@ export function checkForUpdate() {
|
|||||||
setPref(PrefKey.LATEST_VERSION, json.tag_name.substring(1));
|
setPref(PrefKey.LATEST_VERSION, json.tag_name.substring(1));
|
||||||
setPref(PrefKey.CURRENT_VERSION, SCRIPT_VERSION);
|
setPref(PrefKey.CURRENT_VERSION, SCRIPT_VERSION);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Update translations
|
||||||
|
Translations.updateTranslations(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user