Download wp-calypso/client/state/ui/language/reducer.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 608 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/state/ui/language/reducer.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/client/state/ui/language/reducer.js
-
curl -L -o reducer.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/state/ui/language/reducer.js
608 Bytes
| import config from '@automattic/calypso-config'; | |
| import { LOCALE_SET } from 'calypso/state/action-types'; | |
| const initialState = { | |
| localeSlug: config( 'i18n_default_locale_slug' ), | |
| localeVariant: null, | |
| }; | |
| /** | |
| * Tracks the state of the ui locale | |
| * @param {Object} state Current state | |
| * @param {Object} action Action payload | |
| * @returns {Object} Updated state | |
| */ | |
| export default function language( state = initialState, action ) { | |
| switch ( action.type ) { | |
| case LOCALE_SET: | |
| return { | |
| localeSlug: action.localeSlug, | |
| localeVariant: action.localeVariant, | |
| }; | |
| default: | |
| return state; | |
| } | |
| } | |