Last updated:
0 purchases
localization builder
localization_builder #
Generates a Flutter localization delegates from YAML or CSV.
Install #
Add the following to your pubspec.yaml:
dependencies:
localization_builder: <latest>
copied to clipboard
Usage #
YAML Parsing #
import 'package:yaml/yaml.dart';
import 'package:localization_builder/localization_builder.dart';
final parser = YamlLocalizationParser();
final yaml = await File('example.yaml').readAsString();
final node = loadYaml(yaml);
final result = parser.parse(node);
copied to clipboard
CSV Parsing #
import 'dart:convert';
import 'package:csv/csv.dart';
import 'package:localization_builder/localization_builder.dart';
final parser = CsvLocalizationParser();
final csv = await File('example.csv').readAsBytes();
final rows = csv.transform(utf8.decoder)
.transform(CsvToListConverter(
shouldParseNumbers: false,
))
.toList();
final result = parser.parse(rows);
copied to clipboard
Generate Flutter localization code #
import 'package:localization_builder/localization_builder.dart';
final code = DartLocalizationBuilder().build(result.result.copyWith(name: 'Example'));
print(code);
copied to clipboard
Used by #
[]
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.