1
0
mirror of https://github.com/tooot-app/app synced 2025-06-05 22:19:13 +02:00

Added support for KO and VI

This commit is contained in:
Zhiyuan Zheng
2022-02-06 23:25:16 +01:00
parent e35d18c969
commit 7bf428f179
8 changed files with 51 additions and 20 deletions

View File

@ -3,8 +3,6 @@ import { RootState } from '@root/store'
import * as Updates from 'expo-updates'
import * as StoreReview from 'expo-store-review'
export const supportedLngs = ['zh-Hans', 'en']
export type ContextsState = {
storeReview: {
context: Readonly<number>

View File

@ -1,14 +1,10 @@
import { createAsyncThunk, createSlice, PayloadAction } from '@reduxjs/toolkit'
import { LOCALES } from '@root/i18n/locales'
import { RootState } from '@root/store'
import * as Analytics from 'expo-firebase-analytics'
import * as Localization from 'expo-localization'
import { pickBy } from 'lodash'
enum AvailableLanguages {
'zh-Hans',
'en'
}
export const changeAnalytics = createAsyncThunk(
'settings/changeAnalytics',
async (newValue: SettingsState['analytics']) => {
@ -31,12 +27,10 @@ export const settingsInitialState = {
enabled: false
},
language: Object.keys(
pickBy(AvailableLanguages, (_, key) => Localization.locale.includes(key))
pickBy(LOCALES, (_, key) => Localization.locale.startsWith(key))
)
? Object.keys(
pickBy(AvailableLanguages, (_, key) =>
Localization.locale.includes(key)
)
pickBy(LOCALES, (_, key) => Localization.locale.startsWith(key))
)[0]
: 'en',
theme: 'auto',
@ -88,10 +82,6 @@ export const getSettingsBrowser = (state: RootState) => state.settings.browser
export const getSettingsAnalytics = (state: RootState) =>
state.settings.analytics
export const {
changeFontsize,
changeLanguage,
changeTheme,
changeBrowser
} = settingsSlice.actions
export const { changeFontsize, changeLanguage, changeTheme, changeBrowser } =
settingsSlice.actions
export default settingsSlice.reducer