Example TString
Example Path
Example Path String
My name is {name}, my age is {age}
Hello, my name is Jack and I am 20 years old.
  • View example/lib/widgets/example/i18n.j2.html
  • Controller example/lib/controllers/home_controller.dart
  • Languages directory example/lib/languages
        
// Configs:

WaConfigs configs = WaConfigs(
    languagePath: pathTo('./example/languages'),
);

...

Future<String> exampleLanguage() async {
    rq.addParams({
        'exampleTString': TString('example.tstring').write(rq),
        'examplePathString': 'example.path'.tr.write(rq),
        'exampleTranslateParams': 'example.params'.tr.write(rq, {
            'name': 'Alexandre',
            'age': Random().nextInt(100),
        }),
    });
    return renderTemplate('example/i18n');
}

...

Widgets:

<div class="alert alert-success my-3">
    <?= $t('example.params', {'name': 'Jack', 'age': 20} ) ?>
</div>