https://github.com/xaldarof/modified-localization
Modified Localization simplifies the localization process, saving time and ensuring accuracy. Expand your app's accessibility and connect with users worldwide with Modified Localization.
https://github.com/xaldarof/modified-localization
flutter generate localization package
Last synced: about 2 months ago
JSON representation
Modified Localization simplifies the localization process, saving time and ensuring accuracy. Expand your app's accessibility and connect with users worldwide with Modified Localization.
- Host: GitHub
- URL: https://github.com/xaldarof/modified-localization
- Owner: xaldarof
- License: apache-2.0
- Created: 2023-01-31T10:10:48.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-03-27T09:24:33.000Z (about 3 years ago)
- Last Synced: 2025-01-05T04:44:16.040Z (over 1 year ago)
- Topics: flutter, generate, localization, package
- Language: Dart
- Homepage:
- Size: 311 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://pub.dev/packages/modified_localization)
# example
Run in terminal : `flutter pub run modified_localization:generate -o locale_keys.g.dart --source-dir /your_dir`
## example/resources/langs/en-EN.json
```json
{
"hi": "Hi !",
"welcome": "Welcome {}"
}
```
Will be generated strings class like this, then you can use it without .tr(), if arguments needed will be generated args function
```dart
abstract class Strings {
static String get hi => 'hi'.tr();
static String welcome(String arg0) {
return 'welcome'.tr(args: [arg0]);
}
}
```
### [example/lib/main.dart](https://github.com/aissat/easy_localization/blob/master/example/lib/main.dart)
```dart
class MyHomePage extends StatefulWidget {
MyHomePage({Key? key, required this.title}) : super(key: key);
final String title;
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State {
@override
Widget build(BuildContext context) {
return Scaffold(
body: Container(
child: Column(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(Strings.hi),
Text(Strings.welcome("Flutter")),
],
),
alignment: Alignment.center,
),
);
}
}
```