l10m 0.0.2 l10m: ^0.0.2 copied to clipboard
A library for modular localization in Dart.
l10m #
l10m
is a Dart library for generating module translations files.
Usage #
To use this library, add l10m
as a dependency in your pubspec.yaml
file.
dependencies:
l10m: any
Then, import the library in your code:
import 'package:l10m/l10m.dart
;`
Command-line Interface #
The l10m
library provides a command-line interface for generating translation files
You can run the command-line interface with the following options:
--module-path
or-m
: Path to the modules folder. Defaults to lib/modules.--output-folder
or-o
: Output folder for the generated files. Defaults to l10n/generated.--root-path
or-r
: Path to the root folder where the localization files are located. Defaults to lib.--template-arb-file
or-t
: Path to the template arb file. Defaults to app_en.arb.--help
or-h
: Show the help.
Example usage #
dart run l10m -m lib/modules -o l10n/generated -r lib -t app_en.arb
This will generate the root translations and module translations based on the provided paths and template arb file.
output: #
lib/
--l10n/
----generated/
------app_localizations.dart
------app_localizations_en.dart
------app_localizations_es.dart
----app_en.arb // File previously located in the root folder
----app_es.arb // File previously located in the root folder
--modules/
----module1/
------generated/
--------module1_localizations.dart
--------module1_localizations_en.dart
--------module1_localizations_es.dart
------module1_en.arb // File previously located in the module folder
------module1_es.arb // File previously located in the module folder
----module2/
------generated/
--------module2_localizations.dart
--------module2_localizations_en.dart
--------module2_localizations_es.dart
------module2_en.arb // File previously located in the module folder
------module2_es.arb // File previously located in the module folder
----module3/
------generated/
--------module3_localizations.dart
--------module3_localizations_en.dart
--------module3_localizations_es.dart
------module3_en.arb // File previously located in the module folder
------module3_es.arb // File previously located in the module folder