Refactor localization and simplify HomeScreen functionality
- Removed English and Russian localization files, focusing solely on Turkmen. - Simplified language initialization in i18n.ts to default to Turkmen. - Cleaned up HomeScreen by removing modal for language selection and related state management.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { StyleSheet, ScrollView, I18nManager, Modal, Pressable } from 'react-native';
|
||||
import { StyleSheet, ScrollView } from 'react-native';
|
||||
import { Text, View } from '@/components/Themed';
|
||||
import FeatureCard from '@/components/FeatureCard';
|
||||
import PrayerTimeCard from '@/components/PrayerTimeCard';
|
||||
@@ -12,16 +12,13 @@ import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
||||
|
||||
|
||||
export default function HomeScreen() {
|
||||
const [modalVisible, setModalVisible] = useState(false);
|
||||
const insets = useSafeAreaInsets();
|
||||
|
||||
const changeLanguage = async (lang: 'en' | 'tk' | 'ru') => {
|
||||
if (!lang) return;
|
||||
setModalVisible(false);
|
||||
if (lang === i18n.locale.substring(0, 2)) return;
|
||||
await AsyncStorage.setItem('user-language', lang);
|
||||
i18n.locale = lang;
|
||||
I18nManager.forceRTL(false); // Assuming LTR for all three languages
|
||||
Updates.reloadAsync();
|
||||
};
|
||||
|
||||
@@ -44,31 +41,8 @@ export default function HomeScreen() {
|
||||
|
||||
<View style={styles.header}>
|
||||
<Text style={styles.title}>{i18n.t('home')}</Text>
|
||||
<Pressable onPress={() => setModalVisible(true)} style={pickerSelectStyles.inputIOS}>
|
||||
<Text style={{ color: 'white' }}>{currentLanguage}</Text>
|
||||
</Pressable>
|
||||
</View>
|
||||
|
||||
<Modal
|
||||
animationType="slide"
|
||||
transparent={true}
|
||||
visible={modalVisible}
|
||||
onRequestClose={() => {
|
||||
setModalVisible(!modalVisible);
|
||||
}}>
|
||||
<Pressable style={styles.modalOverlay} onPress={() => setModalVisible(false)}>
|
||||
<View style={styles.modalView}>
|
||||
{languages.map((lang) => (
|
||||
<Pressable
|
||||
key={lang.value}
|
||||
style={styles.modalButton}
|
||||
onPress={() => changeLanguage(lang.value as 'en' | 'tk' | 'ru')}>
|
||||
<Text style={styles.modalButtonText}>{lang.label}</Text>
|
||||
</Pressable>
|
||||
))}
|
||||
</View>
|
||||
</Pressable>
|
||||
</Modal>
|
||||
<ScrollView>
|
||||
<View style={styles.innerContainer}>
|
||||
{/* <FeatureCard
|
||||
|
||||
Reference in New Issue
Block a user