Skip to content

Latest commit

 

History

History
 
 

example

Regionalizations (r13n) Example

License: MIT

An example application that showcases the usage of the r13n flutter package.

Built by Very Good Ventures


Getting Started 🚀

To run the desired project either use the launch configuration in VSCode/Android Studio or use the following commands:

flutter pub get
flutter run

Working with Regionalizations 🌐

This project relies on the r13n flutter package and on the r13n brick.

Adding Regions

  1. For each supported region, add a new .arb file in lib/r13n/arb.
├── r13n
│   ├── arb
│   │   ├── app_gb.arb
│   │   └── app_us.arb
  1. Add the translated strings to each .arb file:

app_us.arb

{
    "@@region": "us",
    "supportEmail": "[email protected]"
}

app_gb.arb

{
    "@@region": "gb",
    "supportEmail": "[email protected]"
}
  1. If you don't already have mason_cli, use the following command:
dart pub global activate mason_cli
  1. Then, install the r13n brick globally.
mason add -g r13n
  1. 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
  1. Use the new string.
import 'package:example/r13n/r13n.dart';

@override
Widget build(BuildContext context) {
  final r13n = context.r13n;
  return Text(r13n.supportEmail);
}