refactor: remove electron-related code

This commit is contained in:
codytseng
2024-12-21 23:20:30 +08:00
parent bed8df06e8
commit 2b1e6fe8f5
200 changed files with 2771 additions and 8432 deletions

31
src/i18n/index.ts Normal file
View File

@@ -0,0 +1,31 @@
import i18n from 'i18next'
import { initReactI18next } from 'react-i18next'
import LanguageDetector from 'i18next-browser-languagedetector'
import en from './en'
import zh from './zh'
import dayjs from 'dayjs'
const resources = {
en,
zh
}
i18n
.use(LanguageDetector)
.use(initReactI18next)
.init({
fallbackLng: 'en',
resources,
interpolation: {
escapeValue: false // react already safes from xss
}
})
i18n.services.formatter?.add('date', (timestamp, lng) => {
if (lng?.startsWith('zh')) {
return dayjs(timestamp).format('YYYY/MM/DD')
}
return dayjs(timestamp).format('MMM D, YYYY')
})
export default i18n