feat: add polish language (#190)
This commit is contained in:
parent
249593d547
commit
616c5bdd50
3 changed files with 216 additions and 3 deletions
|
|
@ -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')
|
||||
})
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue