+
{{ $t('repo.settings.general.cancel_prev.desc') }}
diff --git a/web/src/compositions/useDate.ts b/web/src/compositions/useDate.ts index 68e68be4d..4feb36944 100644 --- a/web/src/compositions/useDate.ts +++ b/web/src/compositions/useDate.ts @@ -1,4 +1,5 @@ import 'dayjs/locale/en'; +import 'dayjs/locale/lv'; import dayjs from 'dayjs'; import advancedFormat from 'dayjs/plugin/advancedFormat'; @@ -6,10 +7,12 @@ import timezone from 'dayjs/plugin/timezone'; import utc from 'dayjs/plugin/utc'; import { useI18n } from 'vue-i18n'; +import { getUserLanguage } from '~/utils/locale'; + dayjs.extend(timezone); dayjs.extend(utc); dayjs.extend(advancedFormat); -dayjs.locale(navigator.language.split('-')[0]); +dayjs.locale(getUserLanguage()); export function useDate() { function toLocaleString(date: Date) { diff --git a/web/src/compositions/useI18n.ts b/web/src/compositions/useI18n.ts index 7e98daf6f..8bdee4f53 100644 --- a/web/src/compositions/useI18n.ts +++ b/web/src/compositions/useI18n.ts @@ -3,8 +3,10 @@ import messages from '@intlify/vite-plugin-vue-i18n/messages'; import { createI18n } from 'vue-i18n'; +import { getUserLanguage } from '~/utils/locale'; + export const i18n = createI18n({ - locale: navigator.language.split('-')[0], + locale: getUserLanguage(), legacy: false, globalInjection: true, fallbackLocale: 'en', diff --git a/web/src/utils/locale.ts b/web/src/utils/locale.ts new file mode 100644 index 000000000..ab2e802f0 --- /dev/null +++ b/web/src/utils/locale.ts @@ -0,0 +1,3 @@ +export function getUserLanguage(): string { + return navigator.language.split('-')[0]; +} diff --git a/web/src/utils/timeAgo.ts b/web/src/utils/timeAgo.ts index 40ef3f3be..6ca86b271 100644 --- a/web/src/utils/timeAgo.ts +++ b/web/src/utils/timeAgo.ts @@ -1,8 +1,12 @@ import TimeAgo from 'javascript-time-ago'; import en from 'javascript-time-ago/locale/en.json'; +import lv from 'javascript-time-ago/locale/lv.json'; + +import { getUserLanguage } from '~/utils/locale'; TimeAgo.addDefaultLocale(en); +TimeAgo.addLocale(lv); -const timeAgo = new TimeAgo(navigator.language); +const timeAgo = new TimeAgo(getUserLanguage()); export default timeAgo; diff --git a/web/src/views/Repos.vue b/web/src/views/Repos.vue index 95ddc639f..f637d136c 100644 --- a/web/src/views/Repos.vue +++ b/web/src/views/Repos.vue @@ -1,7 +1,7 @@