File size: 463 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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
  }
}