feat: add polish language (#190)

This commit is contained in:
Maxblake 2025-03-02 03:51:18 +00:00 committed by GitHub
parent 249593d547
commit 616c5bdd50
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 216 additions and 3 deletions

View file

@ -3,10 +3,12 @@ import i18n from 'i18next'
import { initReactI18next } from 'react-i18next'
import en from './en'
import zh from './zh'
import pl from './pl'
const resources = {
en,
zh
zh,
pl
}
i18n
@ -14,13 +16,13 @@ i18n
type: 'languageDetector',
detect: function () {
const lng = localStorage.getItem('i18nextLng')
if (lng === 'zh' || lng === 'en') {
if (lng === 'pl' || lng === 'zh' || lng === 'en') {
return lng
}
return undefined
},
cacheUserLanguage: function (lng: string) {
if (lng === 'zh' || lng === 'en') {
if (lng === 'pl' || lng === 'zh' || lng === 'en') {
localStorage.setItem('i18nextLng', lng)
}
}
@ -38,6 +40,9 @@ i18n.services.formatter?.add('date', (timestamp, lng) => {
if (lng?.startsWith('zh')) {
return dayjs(timestamp).format('YYYY/MM/DD')
}
if (lng?.startsWith('pl')) {
return dayjs(timestamp).format('DD/MM/YYYY/')
}
return dayjs(timestamp).format('MMM D, YYYY')
})