translation_string_extractor

Creator: coderz1093

Last updated:

0 purchases

translation_string_extractor Image
translation_string_extractor Images
Add to Cart

Description:

translation string extractor

Translation String Extractor #
Extracts strings marked for translation with .tr or .tr() and writes them into JSON file or returns a Map.
The tool will ignore file names ending in .g.dart.
Input:
import 'package:flutter/material.dart';
import 'package:get/get.dart';

class TestClass extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Column(children: [
Text('Hello'.tr),
Text("""World""".tr),
]);
}
}
copied to clipboard
Output:
{
"Hello": "Hello",
"World": "World"
}
copied to clipboard
Installation #
dev_dependencies:
translation_string_extractor: <latest>
copied to clipboard
Or install the package globally:
dart pub global activate translation_string_extractor
copied to clipboard
Usage #
As a dev dependency:
dart run translation_string_extractor:extract -d=lib -o=locale.json
copied to clipboard
Globally:
translation_string_extractor -d=lib -o=locale.json
copied to clipboard
Public Signature:

TranlationStringExtractor ...

static void extractStrings(String directory, String outputFile);

static Map<String, String> read(String directory) {
SplayTreeMap<String, String> map = SplayTreeMap<String, String>();

static void write(Map<String, String> map, String outputFile);
copied to clipboard
Issues #
https://github.com/xErik/translation_string_extractor/issues
License #
This package is licensed under the MIT license.

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.