adminjs
Version:
Admin panel for apps written in node.js
22 lines (18 loc) • 463 B
text/typescript
import type { Locale } from '../../../locale/config.js'
import { LOCALE_INITIALIZE } from '../actions/initialize-locale.js'
export type LolcaleInState = Locale
const defaultLocale = { language: 'en', translations: {} } as Locale
export const localesReducer = (
state: Locale = defaultLocale,
action: {
type: string
data: Locale
},
) => {
switch (action.type) {
case LOCALE_INITIALIZE:
return action.data
default:
return state
}
}