@localey/flutter
v0.1.26
Published
Flutter and Dart adapter for Localey.
Readme
@localey/flutter
Flutter and Dart adapter for Localey.
The @localey/flutter package provides localization support for mobile applications developed with Flutter. It utilizes a robust pattern-matching engine designed specifically for Dart's declarative UI syntax.
Detection and Extraction
Unlike the web-based adapters that use full AST parsers, the Flutter adapter utilizes specialized regular expression patterns tuned for the Dart programming language. This provides high performance and reliable detection for common Flutter widget patterns.
Target Patterns
- Text Widgets: Detects string literals within
Text("...")constructors. - Property Names: Targets common UI-related properties such as
labelText,hintText,title,tooltip, andmessage. - String Literals: Identifies standard Dart string literals (single and double quotes) that appear to be user-facing content.
Code Transformation
When a string is extracted, the adapter replaces the literal with a call to the Localey Dart SDK.
- Transformation:
"Hello"->Localey.t("hello")
Usage in Flutter Projects
This adapter is automatically engaged when the flutter framework is specified in your localey.config.json. It scans files with the .dart extension and prepares them for use with the shared JSON-based translation files used by the rest of the Localey ecosystem.
