MCPcopy Create free account
hub / github.com/alephdata/aleph / selectLocale

Function selectLocale

ui/src/selectors.js:56–72  ·  view source on GitHub ↗
(state)

Source from the content-addressed store, hash-verified

54}
55
56export function selectLocale(state) {
57 // determine the active locale to be used by the user interface. this is
58 // either saved in localStorage or extracted from metadata. The initial
59 // request to metadata will be sent with unmodified Accept-Language headers
60 // allowing the backend to perform language negotiation.
61 const role = selectCurrentRole(state);
62
63 if (role.locale) {
64 return role.locale;
65 }
66 const { metadata } = state;
67 if (metadata && metadata.app) {
68 return metadata.app.locale;
69 }
70
71 return 'en';
72}
73
74export function selectMetadata(state) {
75 const metadata = selectObject(state, state, 'metadata');

Callers 15

mapStateToPropsFunction · 0.90
mapStateToPropsFunction · 0.90
mapStateToPropsFunction · 0.90
mapStateToPropsFunction · 0.90
mapStateToPropsFunction · 0.90
mapStateToPropsFunction · 0.90
mapStateToPropsFunction · 0.90
mapStateToPropsFunction · 0.90
mapStateToPropsFunction · 0.90
mapStateToPropsFunction · 0.90
mapStateToPropsFunction · 0.90
App.jsxFile · 0.90

Calls 1

selectCurrentRoleFunction · 0.85

Tested by

no test coverage detected