localization_builder

Last updated:

0 purchases

localization_builder Image
localization_builder Images
Add to Cart

Description:

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 #

[]

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.