mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-05-07 06:56:04 +02:00
Language UI option, auto choose language when none selected
This commit is contained in:
@@ -5,26 +5,26 @@
|
|||||||
// For a copy, see <https://opensource.org/licenses/MIT>.
|
// For a copy, see <https://opensource.org/licenses/MIT>.
|
||||||
|
|
||||||
using CefSharp;
|
using CefSharp;
|
||||||
using Microsoft.Win32;
|
|
||||||
using System;
|
|
||||||
using System.Diagnostics;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Management;
|
|
||||||
using System.Text.RegularExpressions;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
using System.IO;
|
|
||||||
using System.Security.Cryptography;
|
|
||||||
using System.Net;
|
|
||||||
using Windows.UI.Notifications;
|
|
||||||
using Windows.Data.Xml.Dom;
|
|
||||||
using librsync.net;
|
using librsync.net;
|
||||||
using System.Net.Sockets;
|
using Microsoft.Win32;
|
||||||
using System.Text;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Threading;
|
|
||||||
using System.IO.Pipes;
|
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.IO;
|
||||||
|
using System.IO.Pipes;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Net;
|
||||||
|
using System.Net.Sockets;
|
||||||
|
using System.Security.Cryptography;
|
||||||
|
using System.Text;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using Windows.Data.Xml.Dom;
|
||||||
|
using Windows.UI.Notifications;
|
||||||
|
|
||||||
namespace VRCX
|
namespace VRCX
|
||||||
{
|
{
|
||||||
@@ -410,7 +410,12 @@ namespace VRCX
|
|||||||
|
|
||||||
public string CurrentCulture()
|
public string CurrentCulture()
|
||||||
{
|
{
|
||||||
return System.Globalization.CultureInfo.CurrentCulture.ToString();
|
return CultureInfo.CurrentCulture.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public string CurrentLanguage()
|
||||||
|
{
|
||||||
|
return CultureInfo.InstalledUICulture.Name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetVersion()
|
public string GetVersion()
|
||||||
|
|||||||
+34
-3
@@ -9,7 +9,7 @@ import '@fontsource/noto-sans-jp';
|
|||||||
import Noty from 'noty';
|
import Noty from 'noty';
|
||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
import VueLazyload from 'vue-lazyload';
|
import VueLazyload from 'vue-lazyload';
|
||||||
import VueI18n from 'vue-i18n'
|
import VueI18n from 'vue-i18n';
|
||||||
import {DataTables} from 'vue-data-tables';
|
import {DataTables} from 'vue-data-tables';
|
||||||
import ElementUI from 'element-ui';
|
import ElementUI from 'element-ui';
|
||||||
import locale from 'element-ui/lib/locale/lang/en';
|
import locale from 'element-ui/lib/locale/lang/en';
|
||||||
@@ -211,8 +211,9 @@ speechSynthesis.getVoices();
|
|||||||
|
|
||||||
var i18n = new VueI18n({
|
var i18n = new VueI18n({
|
||||||
locale: 'en',
|
locale: 'en',
|
||||||
messages: localizedStrings,
|
fallbackLocale: 'en',
|
||||||
})
|
messages: localizedStrings
|
||||||
|
});
|
||||||
|
|
||||||
var $appDarkStyle = document.createElement('link');
|
var $appDarkStyle = document.createElement('link');
|
||||||
$appDarkStyle.disabled = true;
|
$appDarkStyle.disabled = true;
|
||||||
@@ -24096,6 +24097,36 @@ speechSynthesis.getVoices();
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// App: Language
|
||||||
|
|
||||||
|
$app.data.appLanguage = 'en';
|
||||||
|
if (configRepository.getString('VRCX_appLanguage')) {
|
||||||
|
$app.data.appLanguage = configRepository.getString('VRCX_appLanguage');
|
||||||
|
i18n.locale = $app.data.appLanguage;
|
||||||
|
} else {
|
||||||
|
AppApi.CurrentLanguage().then((result) => {
|
||||||
|
if (!result) {
|
||||||
|
console.error('Failed to get current language');
|
||||||
|
$app.changeAppLanguage('en');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var lang = result.split('-')[0];
|
||||||
|
i18n.availableLocales.forEach((ref) => {
|
||||||
|
var refLang = ref.split('_')[0];
|
||||||
|
if (refLang === lang) {
|
||||||
|
$app.changeAppLanguage(ref);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
$app.methods.changeAppLanguage = function (language) {
|
||||||
|
console.log('Language changed:', language);
|
||||||
|
this.appLanguage = language;
|
||||||
|
i18n.locale = language;
|
||||||
|
configRepository.setString('VRCX_appLanguage', language);
|
||||||
|
};
|
||||||
|
|
||||||
$app = new Vue($app);
|
$app = new Vue($app);
|
||||||
window.$app = $app;
|
window.$app = $app;
|
||||||
})();
|
})();
|
||||||
|
|||||||
@@ -1121,6 +1121,13 @@ html
|
|||||||
el-tab-pane(:label="$t('view.settings.category.appearance')")
|
el-tab-pane(:label="$t('view.settings.category.appearance')")
|
||||||
div.options-container(style="margin-top:0")
|
div.options-container(style="margin-top:0")
|
||||||
span.header {{ $t("view.settings.appearance.appearance.header") }}
|
span.header {{ $t("view.settings.appearance.appearance.header") }}
|
||||||
|
div.options-container-item
|
||||||
|
span.name {{ $t('view.settings.appearance.appearance.language') }}
|
||||||
|
el-dropdown(@click.native.stop trigger="click" size="small")
|
||||||
|
el-button(size="mini")
|
||||||
|
span {{ $i18n.messages[appLanguage]?.language }} #[i.el-icon-arrow-down.el-icon--right]
|
||||||
|
el-dropdown-menu(#default="dropdown")
|
||||||
|
el-dropdown-item(v-for="(obj, language) in $i18n.messages" v-text="obj.language" @click.native="changeAppLanguage(language)")
|
||||||
div.options-container-item
|
div.options-container-item
|
||||||
span.name {{ $t('view.settings.appearance.appearance.theme_mode') }}
|
span.name {{ $t('view.settings.appearance.appearance.theme_mode') }}
|
||||||
el-radio-group(v-model="themeMode" size="mini")
|
el-radio-group(v-model="themeMode" size="mini")
|
||||||
|
|||||||
@@ -227,7 +227,8 @@
|
|||||||
"sort_instance_users_by_time": "time",
|
"sort_instance_users_by_time": "time",
|
||||||
"sort_instance_users_by_alphabet": "alphabetical",
|
"sort_instance_users_by_alphabet": "alphabetical",
|
||||||
"table_max_size": "Table Max Size",
|
"table_max_size": "Table Max Size",
|
||||||
"page_size": "Page Size:"
|
"page_size": "Page Size:",
|
||||||
|
"language": "Language"
|
||||||
},
|
},
|
||||||
"timedate": {
|
"timedate": {
|
||||||
"header": "Time/Date",
|
"header": "Time/Date",
|
||||||
|
|||||||
Reference in New Issue
Block a user