From daf4e5ce6c200f3c2d5995e023c42d862d834a61 Mon Sep 17 00:00:00 2001 From: Andrew Camilleri Date: Fri, 9 Nov 2018 13:13:00 +0100 Subject: [PATCH] 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 --- BTCPayServer/Views/Invoice/Checkout.cshtml | 43 +++++++++---------- .../wwwroot/checkout/css/normalizer.css | 10 ++++- .../wwwroot/locales/{cs.json => cs-CZ.json} | 0 .../wwwroot/locales/{de.json => de-DE.json} | 0 .../wwwroot/locales/{es.json => es-ES.json} | 0 .../wwwroot/locales/{fr.json => fr-FR.json} | 0 .../wwwroot/locales/{hr.json => hr-HR.json} | 0 .../wwwroot/locales/{is.json => is-IS.json} | 0 .../wwwroot/locales/{it.json => it-IT.json} | 0 .../wwwroot/locales/{ja.json => ja-JP.json} | 0 .../wwwroot/locales/{kk.json => kk-KZ.json} | 0 .../wwwroot/locales/{nl.json => nl-NL.json} | 0 .../wwwroot/locales/{np.json => np-NP.json} | 0 .../locales/{pt_BR.json => pt-BR.json} | 0 .../wwwroot/locales/{pt.json => pt-PT.json} | 0 .../wwwroot/locales/{ru.json => ru-RU.json} | 0 .../wwwroot/locales/{uk.json => uk-UA.json} | 0 .../wwwroot/locales/{vi.json => vi-VN.json} | 0 .../locales/{zh_SP.json => zh-SP.json} | 0 19 files changed, 30 insertions(+), 23 deletions(-) rename BTCPayServer/wwwroot/locales/{cs.json => cs-CZ.json} (100%) rename BTCPayServer/wwwroot/locales/{de.json => de-DE.json} (100%) rename BTCPayServer/wwwroot/locales/{es.json => es-ES.json} (100%) rename BTCPayServer/wwwroot/locales/{fr.json => fr-FR.json} (100%) rename BTCPayServer/wwwroot/locales/{hr.json => hr-HR.json} (100%) rename BTCPayServer/wwwroot/locales/{is.json => is-IS.json} (100%) rename BTCPayServer/wwwroot/locales/{it.json => it-IT.json} (100%) rename BTCPayServer/wwwroot/locales/{ja.json => ja-JP.json} (100%) rename BTCPayServer/wwwroot/locales/{kk.json => kk-KZ.json} (100%) rename BTCPayServer/wwwroot/locales/{nl.json => nl-NL.json} (100%) rename BTCPayServer/wwwroot/locales/{np.json => np-NP.json} (100%) rename BTCPayServer/wwwroot/locales/{pt_BR.json => pt-BR.json} (100%) rename BTCPayServer/wwwroot/locales/{pt.json => pt-PT.json} (100%) rename BTCPayServer/wwwroot/locales/{ru.json => ru-RU.json} (100%) rename BTCPayServer/wwwroot/locales/{uk.json => uk-UA.json} (100%) rename BTCPayServer/wwwroot/locales/{vi.json => vi-VN.json} (100%) rename BTCPayServer/wwwroot/locales/{zh_SP.json => zh-SP.json} (100%) diff --git a/BTCPayServer/Views/Invoice/Checkout.cshtml b/BTCPayServer/Views/Invoice/Checkout.cshtml index b7cc7cd01..7817ed16f 100644 --- a/BTCPayServer/Views/Invoice/Checkout.cshtml +++ b/BTCPayServer/Views/Invoice/Checkout.cshtml @@ -87,21 +87,23 @@ onchange="changeLanguage($(this).val())" asp-items="@langService.GetLanguages().Select((language) => new SelectListItem(language.DisplayName,language.Code, false))"> - + + function initDropdown(selector) { + return $(selector).prettyDropdown({ + classic: false, + height: 32, + reverse: true, + hoverIntent: 5000 + }); + } +
Powered by BTCPay Server @@ -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) { diff --git a/BTCPayServer/wwwroot/checkout/css/normalizer.css b/BTCPayServer/wwwroot/checkout/css/normalizer.css index 7e9e9fb2f..386a156f9 100644 --- a/BTCPayServer/wwwroot/checkout/css/normalizer.css +++ b/BTCPayServer/wwwroot/checkout/css/normalizer.css @@ -11495,4 +11495,12 @@ low-fee-timeline { } - +#prettydropdown-DefaultLang{ + min-width:200px; +} +#prettydropdown-DefaultLang ul{ + width:100%; +} +#prettydropdown-DefaultLang ul li{ + width:100% !important; +} diff --git a/BTCPayServer/wwwroot/locales/cs.json b/BTCPayServer/wwwroot/locales/cs-CZ.json similarity index 100% rename from BTCPayServer/wwwroot/locales/cs.json rename to BTCPayServer/wwwroot/locales/cs-CZ.json diff --git a/BTCPayServer/wwwroot/locales/de.json b/BTCPayServer/wwwroot/locales/de-DE.json similarity index 100% rename from BTCPayServer/wwwroot/locales/de.json rename to BTCPayServer/wwwroot/locales/de-DE.json diff --git a/BTCPayServer/wwwroot/locales/es.json b/BTCPayServer/wwwroot/locales/es-ES.json similarity index 100% rename from BTCPayServer/wwwroot/locales/es.json rename to BTCPayServer/wwwroot/locales/es-ES.json diff --git a/BTCPayServer/wwwroot/locales/fr.json b/BTCPayServer/wwwroot/locales/fr-FR.json similarity index 100% rename from BTCPayServer/wwwroot/locales/fr.json rename to BTCPayServer/wwwroot/locales/fr-FR.json diff --git a/BTCPayServer/wwwroot/locales/hr.json b/BTCPayServer/wwwroot/locales/hr-HR.json similarity index 100% rename from BTCPayServer/wwwroot/locales/hr.json rename to BTCPayServer/wwwroot/locales/hr-HR.json diff --git a/BTCPayServer/wwwroot/locales/is.json b/BTCPayServer/wwwroot/locales/is-IS.json similarity index 100% rename from BTCPayServer/wwwroot/locales/is.json rename to BTCPayServer/wwwroot/locales/is-IS.json diff --git a/BTCPayServer/wwwroot/locales/it.json b/BTCPayServer/wwwroot/locales/it-IT.json similarity index 100% rename from BTCPayServer/wwwroot/locales/it.json rename to BTCPayServer/wwwroot/locales/it-IT.json diff --git a/BTCPayServer/wwwroot/locales/ja.json b/BTCPayServer/wwwroot/locales/ja-JP.json similarity index 100% rename from BTCPayServer/wwwroot/locales/ja.json rename to BTCPayServer/wwwroot/locales/ja-JP.json diff --git a/BTCPayServer/wwwroot/locales/kk.json b/BTCPayServer/wwwroot/locales/kk-KZ.json similarity index 100% rename from BTCPayServer/wwwroot/locales/kk.json rename to BTCPayServer/wwwroot/locales/kk-KZ.json diff --git a/BTCPayServer/wwwroot/locales/nl.json b/BTCPayServer/wwwroot/locales/nl-NL.json similarity index 100% rename from BTCPayServer/wwwroot/locales/nl.json rename to BTCPayServer/wwwroot/locales/nl-NL.json diff --git a/BTCPayServer/wwwroot/locales/np.json b/BTCPayServer/wwwroot/locales/np-NP.json similarity index 100% rename from BTCPayServer/wwwroot/locales/np.json rename to BTCPayServer/wwwroot/locales/np-NP.json diff --git a/BTCPayServer/wwwroot/locales/pt_BR.json b/BTCPayServer/wwwroot/locales/pt-BR.json similarity index 100% rename from BTCPayServer/wwwroot/locales/pt_BR.json rename to BTCPayServer/wwwroot/locales/pt-BR.json diff --git a/BTCPayServer/wwwroot/locales/pt.json b/BTCPayServer/wwwroot/locales/pt-PT.json similarity index 100% rename from BTCPayServer/wwwroot/locales/pt.json rename to BTCPayServer/wwwroot/locales/pt-PT.json diff --git a/BTCPayServer/wwwroot/locales/ru.json b/BTCPayServer/wwwroot/locales/ru-RU.json similarity index 100% rename from BTCPayServer/wwwroot/locales/ru.json rename to BTCPayServer/wwwroot/locales/ru-RU.json diff --git a/BTCPayServer/wwwroot/locales/uk.json b/BTCPayServer/wwwroot/locales/uk-UA.json similarity index 100% rename from BTCPayServer/wwwroot/locales/uk.json rename to BTCPayServer/wwwroot/locales/uk-UA.json diff --git a/BTCPayServer/wwwroot/locales/vi.json b/BTCPayServer/wwwroot/locales/vi-VN.json similarity index 100% rename from BTCPayServer/wwwroot/locales/vi.json rename to BTCPayServer/wwwroot/locales/vi-VN.json diff --git a/BTCPayServer/wwwroot/locales/zh_SP.json b/BTCPayServer/wwwroot/locales/zh-SP.json similarity index 100% rename from BTCPayServer/wwwroot/locales/zh_SP.json rename to BTCPayServer/wwwroot/locales/zh-SP.json