-
Notifications
You must be signed in to change notification settings - Fork 190
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #1753 +/- ##
===========================================
- Coverage 59.90% 59.89% -0.02%
===========================================
Files 365 366 +1
Lines 9136 9145 +9
Branches 1847 1848 +1
===========================================
+ Hits 5473 5477 +4
- Misses 3483 3486 +3
- Partials 180 182 +2
Continue to review full report at Codecov.
|
if (userLanguage === 'en-us') { | ||
userLanguage = 'en' | ||
} | ||
|
||
try { | ||
require(`dayjs/locale/${userLanguage}`) | ||
} catch { | ||
userLanguage = 'en' | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More generic:
if (userLanguage === 'en-us') { | |
userLanguage = 'en' | |
} | |
try { | |
require(`dayjs/locale/${userLanguage}`) | |
} catch { | |
userLanguage = 'en' | |
} | |
const [language, region] = userLanguage.split('-') | |
if ( | |
(language === 'en' && region === 'us') || | |
language === region | |
) { | |
userLanguage = language | |
} | |
try { | |
require(`dayjs/locale/${userLanguage}`) | |
} catch { | |
userLanguage = 'en' | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will also handle locales like de-DE
, it-IT
...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also more expensive due to how require works inside of electron.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gimme a minute, I'll boil it down to one require
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated above
|
Replaces all occurrences of
moment
withdayjs
.