Skip to content

Commit

Permalink
perf: fix session i18n default
Browse files Browse the repository at this point in the history
  • Loading branch information
BaiJiangJie committed Jul 23, 2024
1 parent 65ed721 commit 1bf839a
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions src/utils/time.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
const moment = require('moment')

function getUserLang() {
const userLangEN = document.cookie.indexOf('django_language=en')
if (userLangEN === -1) {
return 'zh-CN'
} else {
return 'en-US'
}
}
import { getLangCode } from '@/i18n/utils'

function getTimeUnits(u) {
const units = {
Expand All @@ -16,10 +8,11 @@ function getTimeUnits(u) {
'm': '分',
's': '秒'
}
if (getUserLang() === 'zh-CN') {
if (getLangCode() === 'zh') {
return units[u]
} else {
return u
}
return u
}

export function timeOffset(a, b) {
Expand Down

0 comments on commit 1bf839a

Please sign in to comment.