mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2024-11-19 18:11:36 +01:00
I am sorry for so many prs <3 (#389)
* make language loading more solid * disable browser lang preferences * pr fix * pr fixes * pr fixes * make sure language files are named correctly * fix dropdown width issue when in modal form * fix issue from jquery hell
This commit is contained in:
parent
2ec2c7263f
commit
daf4e5ce6c
@ -87,21 +87,23 @@
|
||||
onchange="changeLanguage($(this).val())"
|
||||
asp-items="@langService.GetLanguages().Select((language) => new SelectListItem(language.DisplayName,language.Code, false))"></select>
|
||||
|
||||
<script>
|
||||
$(function() {
|
||||
// REVIEW: don't use initDropdown method but rather directly initialize select whenever you are using it
|
||||
initDropdown(".cmblang");
|
||||
});
|
||||
|
||||
function initDropdown(selector) {
|
||||
return $(selector).prettyDropdown({
|
||||
classic: false,
|
||||
height: 32,
|
||||
reverse: true,
|
||||
hoverIntent: 5000
|
||||
<script>
|
||||
var languageSelectorPrettyDropdown;
|
||||
$(function() {
|
||||
// REVIEW: don't use initDropdown method but rather directly initialize select whenever you are using it
|
||||
$("#DefaultLang").val(startingLanguage);
|
||||
languageSelectorPrettyDropdown = initDropdown("#DefaultLang");
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
function initDropdown(selector) {
|
||||
return $(selector).prettyDropdown({
|
||||
classic: false,
|
||||
height: 32,
|
||||
reverse: true,
|
||||
hoverIntent: 5000
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</div>
|
||||
<div style="margin-top: 10px; text-align: center;" class="form-text small text-muted">
|
||||
<span>Powered by <a target="_blank" href="https://github.com/btcpayserver/btcpayserver">BTCPay Server</a></span>
|
||||
@ -117,11 +119,8 @@
|
||||
.Select((language) => language.Code)));;
|
||||
var storeDefaultLang = "@Model.DefaultLang";
|
||||
var fallbackLanguage = "en";
|
||||
var languageDropdownElement = $("#DefaultLang");
|
||||
var startingLanguage = computeStartingLanguage();
|
||||
|
||||
|
||||
// initialization
|
||||
startingLanguage = computeStartingLanguage();
|
||||
// initialization
|
||||
i18next
|
||||
.use(window.i18nextXHRBackend)
|
||||
.init({
|
||||
@ -146,9 +145,9 @@
|
||||
}
|
||||
|
||||
function changeLanguage(lang) {
|
||||
if (isLanguageAvailable(lang)) {
|
||||
i18next.changeLanguage(lang);
|
||||
}
|
||||
if (isLanguageAvailable(lang)) {
|
||||
i18next.changeLanguage(lang);
|
||||
}
|
||||
}
|
||||
|
||||
function isLanguageAvailable(languageCode) {
|
||||
|
@ -11495,4 +11495,12 @@ low-fee-timeline {
|
||||
}
|
||||
|
||||
|
||||
|
||||
#prettydropdown-DefaultLang{
|
||||
min-width:200px;
|
||||
}
|
||||
#prettydropdown-DefaultLang ul{
|
||||
width:100%;
|
||||
}
|
||||
#prettydropdown-DefaultLang ul li{
|
||||
width:100% !important;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user