2025-02-28 14:38:36 -08:00

81 lines
2.5 KiB
Markdown

# Translation Terrace
Translation Terrace is an Expo/React-Native application designed for a translation kiosk. It leverages an offline Whisper speech-to-text model and interfaces with a LibreTranslate server to provide seamless translation services.
## Project Structure
```
translation-terraces/
├── expo-file-system/
│ └── next.js
├── @react-native-async-storage/
│ └── async-storage.ts
├── .ollama/
│ ├── ExampleComponent.tsx
│ └── ExampleTest.spec.tsx
├── package.json
├── README.md
└── ...
```
## Technologies Used
- **React-Native**: Core framework for building the application.
- **Whisper Speech-to-Text Model**: Offline model for converting spoken language to text.
- **LibreTranslate Server**: Interface for translation services.
## Installation Instructions
1. **Install Packages**: Run `npm install` to install all necessary dependencies as listed in `package.json`.
2. **Prebuild Android**: Since this project cannot be run using Expo Go, prebuild the Android app by running `npm run android`.
3. **Run Unit Tests**: Execute Jest unit tests with `npm run test`.
## Usage Examples
### Example 1: Initializing Whisper Model
```javascript
import { initializeWhisper } from './path/to/whisper';
const initModel = async () => {
try {
await initializeWhisper();
console.log('Whisper model initialized successfully.');
} catch (error) {
console.error('Error initializing Whisper model:', error);
}
};
initModel();
```
### Example 2: Translating Text
```javascript
import { translateText } from './path/to/libreTranslate';
const translate = async () => {
try {
const translatedText = await translateText('Hello, world!', 'en', 'es');
console.log('Translated text:', translatedText);
} catch (error) {
console.error('Error translating text:', error);
}
};
translate();
```
## Contributing Guidelines
1. **Create Feature Branch**: Use the naming convention `<year>-<work week>_<username>_<feature_description>` for your feature branch.
2. **Initiate Pull Request (PR)**: Open a PR and provide a detailed description of the changes made.
3. **Discuss Features**: Suggest new features or improvements in GitTea issues.
## License Information
This project is licensed under the MIT License. For more details, please refer to the [LICENSE](LICENSE) file.
---
Feel free to explore the codebase and contribute to Translation Terrace! If you have any questions or need further assistance, feel free to reach out.