i18n: localize post badges

This commit is contained in:
Xylight committed 2024-06-03 16:06:08 -07:00
1 parent 0f0e34d347
commit f9935cee32
4 files changed
+44 -13

No files matched your search

+3 -1
View File
@@ -1,4 +1,6 @@
<script lang="ts">
import { locale } from '$lib/translations'
export let date: Date
export let relativeTo: Date | undefined = undefined
export let options: Intl.RelativeTimeFormatOptions = {
@@ -36,7 +38,7 @@
if (diffInMillis >= thresholds[i].threshold) {
const value = Math.round(diffInMillis / thresholds[i].threshold)
let language = 'en'
let language = $locale
if (typeof navigator != 'undefined') {
language = navigator.language
}