localization_builder 0.15.7 copy "localization_builder: ^0.15.7" to clipboard
localization_builder: ^0.15.7 copied to clipboard

A data class builder for localization.

localization_builder #

Generates a Flutter localization delegates from YAML or CSV.

Install #

Add the following to your pubspec.yaml:

dependencies:
  localization_builder: <latest>

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);

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);

Generate Flutter localization code #

import 'package:localization_builder/localization_builder.dart';

final code = DartLocalizationBuilder().build(result.result.copyWith(name: 'Example'));
print(code);

Used by #

  • []
0
likes
130
points
415
downloads

Publisher

unverified uploader

Weekly Downloads

A data class builder for localization.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

collection, dart_style, equatable, flutter, logging, recase, template_string, yaml

More

Packages that depend on localization_builder