Small fix to show current local on settings

This commit is contained in:
Adolfo Reyna
2025-01-24 10:15:43 -05:00
parent d349598981
commit d7263477bc
2 changed files with 12 additions and 6 deletions

View File

@@ -9,10 +9,11 @@ import API from '../API.js';
import { useSnapshot } from 'valtio';
import GlobalState from '../contexts/GlobalState.js';
import ProfileCardHorizontal from "../components/ProfileCardHorizontal.js";
import { reloadAppAsync } from "expo";
let MenuView = ({ navigation }) => {
const [value, setValue] = React.useState('es');
const [value, setValue] = React.useState(i18n.locale);
const [myProfiles, setMyProfiles] = React.useState([]);
const gState = useSnapshot(GlobalState);
const viewer = gState.me;
@@ -34,6 +35,8 @@ let MenuView = ({ navigation }) => {
i18n.locale = locale;
Moment.locale(locale);
setValue(locale);
//Change local on profile then reload
//reloadAppAsync();
}
const profileLists = myProfiles.map((profile) => {
const DefaultPhoto = "https://social.emmint.com/uploads/e6f9be6d665dc43417701bf16a90122c.png";
@@ -73,19 +76,21 @@ let MenuView = ({ navigation }) => {
{profileLists}
</List.Accordion>
<List.Section title="User Actions">
<List.Item title={i18n.t('message.profile')} onPress={() => { navigation.navigate("ProfileSettings") }} left={props => <List.Icon {...props} icon="person" />} />
<List.Item title={i18n.t('message.settings')} left={props => <List.Icon {...props} icon="settings" />} />
<List.Item title={i18n.t('message.logout')} onPress={() => { navigation.navigate("Logout") }} left={props => <List.Icon {...props} icon="logout" />} />
<List.Item key='ProfileEditor' title={i18n.t('message.profile')} onPress={() => { navigation.navigate("ProfileSettings") }} left={props => <List.Icon {...props} icon="person" />} />
<List.Item key='Settings' title={i18n.t('message.settings')} left={props => <List.Icon {...props} icon="settings" />} />
<List.Item key="Logout" title={i18n.t('message.logout')} onPress={() => { navigation.navigate("Logout") }} left={props => <List.Icon {...props} icon="logout" />} />
</List.Section>
<List.Section title="Fellowship App">
<List.Item title={i18n.t('message.invite')} onPress={() => { navigation.navigate("Invite") }} left={props => <List.Icon {...props} icon="person-add" />} />
<List.Item title={i18n.t('message.about')} left={props => <List.Icon {...props} icon="more" />} />
<List.Item key='Invite' title={i18n.t('message.invite')} onPress={() => { navigation.navigate("Invite") }} left={props => <List.Icon {...props} icon="person-add" />} />
<List.Item key='About' title={i18n.t('message.about')} left={props => <List.Icon {...props} icon="more" />} />
</List.Section>
<View style={{ padding: 10 }}>
<Text>App Language:</Text>
<RadioButton.Group onValueChange={newValue => changeLang(newValue)} value={value}>
<RadioButton.Item value="es" label="Español" />
<RadioButton.Item value="en" label="English" />
<RadioButton.Item value="da" label="Danish" />
<RadioButton.Item value="fr" label="French" />
</RadioButton.Group>
</View>
</ImageBackground>

View File

@@ -300,6 +300,7 @@ const messages = {
const i18n = new I18n(messages);
// Set the locale once at the beginning of your app.
// TODO: Check user Lcale
i18n.locale = getLocales()[0].languageCode;
moment.locale(i18n.locale);