mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-18 22:44:29 +01:00
Auto-detect language on payment page (#2552)
* Auto-detect language on payment page based on the requst Accept-Language header, which is the language you configured in your browser/OS and this 99.99% accurate * Update BTCPayServer/Services/LanguageService.cs Co-authored-by: britttttk <39231115+britttttk@users.noreply.github.com> * Update BTCPayServer/Services/LanguageService.cs Co-authored-by: Andrew Camilleri <evilkukka@gmail.com> * Update BTCPayServer/Services/LanguageService.cs Co-authored-by: Andrew Camilleri <evilkukka@gmail.com> * Update BTCPayServer/Services/LanguageService.cs Co-authored-by: Andrew Camilleri <evilkukka@gmail.com> * Added loop for all locales in Accept-Language sorted by weight + check if know this language * New public method so a unit test can be created for it * Unit test for language detection * Fix language service when not in browser context * fall back to default lang * Auto-detect setting + ?lang=auto support * Added invoice param "?lang=auto" info to docs * Using null-coalescing assignment operator * Reduce complexity and http dependency in language service Co-authored-by: britttttk <39231115+britttttk@users.noreply.github.com> Co-authored-by: Andrew Camilleri <evilkukka@gmail.com>
This commit is contained in:
@@ -55,8 +55,10 @@ namespace BTCPayServer.Models.StoreViewModels
|
||||
[Display(Name = "Recommended fee confirmation target blocks")]
|
||||
[Range(1, double.PositiveInfinity)]
|
||||
public int RecommendedFeeBlockTarget { get; set; }
|
||||
|
||||
|
||||
|
||||
[Display(Name = "Auto-detect language on checkout")]
|
||||
public bool AutoDetectLanguage { get; set; }
|
||||
|
||||
[Display(Name = "Default language on checkout")]
|
||||
public string DefaultLang { get; set; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user