Refactor Translations

This commit is contained in:
redphx
2024-04-27 10:10:33 +07:00
parent 4b1428ffd7
commit fc64f0dfa7
5 changed files with 58 additions and 77 deletions

View File

@@ -1,5 +1,3 @@
import { getLocale } from "../modules/translation";
export const AppInterface = window.AppInterface;
export const NATIVE_FETCH = window.fetch;
export const STATES: BxStates = {
@@ -14,9 +12,3 @@ export const STATES: BxStates = {
export const SCRIPT_VERSION = '3.5.3';
export const SCRIPT_HOME = 'https://github.com/redphx/better-xcloud';
export var LOCALE = getLocale();
export const refreshLocale = () => {
LOCALE = getLocale();
}

View File

@@ -19,13 +19,12 @@ export class UserAgent {
return (window.navigator as any).orgUserAgent || window.navigator.userAgent;
}
static get(profile: string): string {
static get(profile: UserAgentProfile): string {
const defaultUserAgent = UserAgent.getDefault();
if (profile === UserAgentProfile.CUSTOM) {
return getPref(PrefKey.USER_AGENT_CUSTOM);
}
// TODO: check type
return (UserAgent.#USER_AGENTS as any)[profile] || defaultUserAgent;
}