Skip to content
This repository has been archived by the owner on Mar 23, 2023. It is now read-only.

Commit

Permalink
refactor: more generic userLanguage handling (#1769)
Browse files Browse the repository at this point in the history
  • Loading branch information
dated authored Mar 4, 2020
1 parent 7479bf3 commit a695816
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/renderer/mixins/formatter.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,15 @@ export default {
*/
formatter_date (value, format = null) {
let userLanguage =
(window.navigator.userLanguage || window.navigator.language).toLowerCase()
(window.navigator.userLanguage || window.navigator.language).toLowerCase() || 'en'

if (userLanguage === 'en-us') {
userLanguage = 'en'
const [language, region] = userLanguage.split('-')

if (
(language === 'en' && region === 'us') ||
language === region
) {
userLanguage = language
}

try {
Expand Down

0 comments on commit a695816

Please sign in to comment.