Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kristijorgji/android_to_flutter_localizations
Simple projects to help me convert many translations from Android xml to dart intl for Flutter
https://github.com/kristijorgji/android_to_flutter_localizations
Last synced: about 1 month ago
JSON representation
Simple projects to help me convert many translations from Android xml to dart intl for Flutter
- Host: GitHub
- URL: https://github.com/kristijorgji/android_to_flutter_localizations
- Owner: kristijorgji
- License: mit
- Created: 2020-03-25T21:23:06.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2021-03-31T18:22:49.000Z (over 3 years ago)
- Last Synced: 2023-03-03T21:22:04.285Z (almost 2 years ago)
- Language: JavaScript
- Size: 19.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# android_to_flutter_localizations
I created this simple app to help me automate the conversion of translations from Android xml format to Flutter dart intl.
It is useful when migrating Android apps to Flutter.## How to use
First install dependencies
```bash
npm install
```
Then example run
```bash
node index.js --inputPath /android_app/app/src/main/res/values/strings.xml --outputPath ./out.dart
```## Example of the conversion
Assume the android `strings.xml` file has the following content:```xml
Gjatë kërkesës tuaj ndodhi një gabim, ju lutem provoni përsëri ose kontaktoni stafin
Gabim teknik
Lidhja me internetin dështoi
Janar
Shkurt
Mars
Prill
Maj
Qershor
Korrik
Gusht
Shtator
Tetor
Nёntor
Dhjetor
```
The output in my case at `lib/localization/app_localizations.dart` would be:
```dart
String get internal_server_error =>
Intl.message('Gjatë kërkesës tuaj ndodhi një gabim, ju lutem provoni përsëri ose kontaktoni stafin', name: 'internal_server_error');
String get network_error_dialog_title =>
Intl.message('Gabim teknik', name: 'network_error_dialog_title');
String get network_error_dialog_message =>
Intl.message('Lidhja me internetin dështoi', name: 'network_error_dialog_message');String get months_0 =>
Intl.message('Janar', name: 'months_0');
String get months_1 =>
Intl.message('Shkurt', name: 'months_1');
String get months_2 =>
Intl.message('Mars', name: 'months_2');
String get months_3 =>
Intl.message('Prill', name: 'months_3');
String get months_4 =>
Intl.message('Maj', name: 'months_4');
String get months_5 =>
Intl.message('Qershor', name: 'months_5');
String get months_6 =>
Intl.message('Korrik', name: 'months_6');
String get months_7 =>
Intl.message('Gusht', name: 'months_7');
String get months_8 =>
Intl.message('Shtator', name: 'months_8');
String get months_9 =>
Intl.message('Tetor', name: 'months_9');
String get months_10 =>
Intl.message('Nёntor', name: 'months_10');
String get months_11 =>
Intl.message('Dhjetor', name: 'months_11');
```