exceptionz-expo-lingua
v2.0.3
Published
A translation library for Expo apps that auto-translates text nodes and displays a language selector modal.
Maintainers
Readme
exceptionz-expo-lingua
A translation library for Expo apps that auto-translates text nodes and displays a language selector modal.
Features
- Expo Ready: Zero configuration for Expo Go.
- Automatic Translation: Uses Google Translate free API to translate text on the fly.
- Persistent Storage: Remembers user language preference across sessions.
- Unified UI: Includes
LanguageSwitcherbutton andLanguageModal.
Installation
npx expo install exceptionz-expo-lingua @react-native-async-storage/async-storageUsage
1. Wrap your app with LinguaProvider
import { LinguaProvider } from 'exceptionz-expo-lingua';
export default function App() {
return (
<LinguaProvider defaultLang="en">
<AppContent />
</LinguaProvider>
);
}2. Use the T component for translatable text
import { T } from 'exceptionz-expo-lingua';
const MyComponent = () => <T>Hello World</T>;3. Add the language switcher UI
import { LanguageModal, LanguageSwitcher } from 'exceptionz-expo-lingua';
const AppContent = () => (
<View style={{ flex: 1 }}>
<Text>Content here...</Text>
<LanguageModal />
<LanguageSwitcher />
</View>
);