An example application that showcases the usage of the r13n flutter package.
Built by Very Good Ventures
To run the desired project either use the launch configuration in VSCode/Android Studio or use the following commands:
flutter pub get
flutter run
This project relies on the r13n flutter package and on the r13n brick.
- For each supported region, add a new
.arb
file inlib/r13n/arb
.
├── r13n
│ ├── arb
│ │ ├── app_gb.arb
│ │ └── app_us.arb
- Add the translated strings to each
.arb
file:
app_us.arb
{
"@@region": "us",
"supportEmail": "[email protected]"
}
app_gb.arb
{
"@@region": "gb",
"supportEmail": "[email protected]"
}
- If you don't already have
mason_cli
, use the following command:
dart pub global activate mason_cli
- Then, install the
r13n
brick globally.
mason add -g r13n
- Generate files.
mason make r13n --on-conflict overwrite
├── r13n
│ ├── arb
│ │ ├── gen
│ │ │ ├── app_regionalizations_gb.g.dart
│ │ │ ├── app_regionalizations_us.g.dart
│ │ │ └── app_regionalizations.g.dart
│ │ ├── app_us.arb
│ │ └── app_gb.arb
- Use the new string.
import 'package:example/r13n/r13n.dart';
@override
Widget build(BuildContext context) {
final r13n = context.r13n;
return Text(r13n.supportEmail);
}