Skip to content

Commit

Permalink
## [1.0.17+35]
Browse files Browse the repository at this point in the history
## [1.0.17+35]
- add support to unwrap long texts `$ref: file.txt`, extension has to be **.txt**. This allows to have long multiline (html/markup) in a plain text file, instead of doing it inside the yaml.
  • Loading branch information
roipeker committed Aug 11, 2021
1 parent 7327737 commit 89084d0
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## [1.0.17+35]
- add support to unwrap long texts `$ref: file.txt`, extension has to be **.txt**. This allows to have long multiline (html/markup) in a plain text file, instead of doing it inside the yaml.

## [1.0.16+34]
- remove type matching for optionalParameters in arb generation.
This avoids issues with the main Type
Expand Down
2 changes: 1 addition & 1 deletion example/wiki/samples/getx/step1/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class HomePageView extends StatelessWidget {
children: <Widget>[
Text('You have pushed the button this many times:'),
Obx(
() => Text(
() => Text(
controller.counterText,
style: Theme.of(context).textTheme.headline4,
),
Expand Down
15 changes: 12 additions & 3 deletions lib/src/io/yaml_parser.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,9 @@ String openYaml(String path) {
}

void _addDoc(String path, Map into) {
// trace('the dir is:: ', p.dirname(path));
// var parentDir = io.File(path).parent.path;
var parentDir = p.dirname(path);
var string = openYaml(path);
// trace('Opening yaml ', path);
if (string.isEmpty) {
print('Yaml file "$path" is empty or doesn\'t exists.');
} else {
Expand Down Expand Up @@ -65,7 +63,18 @@ void _copyDoc(YamlMap doc, String dir, Map into) {

if (value.containsKey(kRef)) {
var dir2 = joinDir([dir, value[kRef]]);
_addDoc(dir2, target);

/// special case to unwrap plain text files.
if (p.extension(dir2) == '.txt') {
var string = openString(dir2);
if (string.isNotEmpty) {
into[k] = string;
} else {
error('file reference "$dir2" is empty');
}
} else {
_addDoc(dir2, target);
}
} else {
_copyDoc(value, dir, target);
}
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: flutter_translation_sheet
description: Flutter Translation Sheet (fts) is a simple tool to help you with localization (l10n), using automatic GoogleSheet translations via (Gtranslate), generating json & dart files.
version: 1.0.16+34
version: 1.0.17+35
homepage: https://github.com/roipeker/flutter_translation_sheet

executables:
Expand Down

0 comments on commit 89084d0

Please sign in to comment.