Skip to content

Commit

Permalink
Bumped to version 1.0.33-dev.1
Browse files Browse the repository at this point in the history
Bumped version to match the prerelease on pub.dev
  • Loading branch information
roipeker committed Mar 28, 2024
1 parent 75f1fc8 commit 463ce3a
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 17 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.33-dev.1]
- upgraded dependencies to make it work with the latest version of dart (3.3.2). We are forced to upgrade to a prerelease of dcli, so we are publishing a prerelease of fts as well in the meantime (Thanks to [@fotiDim](https://github.com/fotiDim) for [PR#32](https://github.com/roipeker/flutter_translation_sheet/pull/32)).

## [1.0.32]
- added comments to the auto-generated files.

Expand Down
37 changes: 24 additions & 13 deletions lib/src/io/dart_gen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -118,19 +118,23 @@ void createFtsUtilsFile() {
"package:flutter/services.dart",
]);

fileContent = fileContent.replaceAll('##loadJsonSetLocale', kLoadJsonSetLocale);
fileContent = fileContent.replaceAll('##loadJsonFallback', kLoadJsonFallback);
fileContent =
fileContent.replaceAll('##loadJsonSetLocale', kLoadJsonSetLocale);
fileContent =
fileContent.replaceAll('##loadJsonFallback', kLoadJsonFallback);
var loadJsonString = kLoadJsonMethod;

// var jsonOutput = config.outputJsonTemplate;
var jsonOutputDir = '${p.dirname(config.outputJsonTemplate)}/';
loadJsonString = loadJsonString.replaceAll('##jsonDir', jsonOutputDir);
fileContent = fileContent.replaceAll('##loadJsonMethod', loadJsonString);

fileContent = fileContent.replaceAll('##decodeTranslationMethod', kDecodeTranslationMethod);
fileContent = fileContent.replaceAll(
'##decodeTranslationMethod', kDecodeTranslationMethod);
resolveTranslationCode = kResolveTranslationJson;
} else {
fileContent = fileContent.replaceAll('##loadJsonSetLocale', '_notifyUpdate();');
fileContent =
fileContent.replaceAll('##loadJsonSetLocale', '_notifyUpdate();');
fileContent = fileContent.replaceAll('##loadJsonFallback', '');
fileContent = fileContent.replaceAll('##loadJsonMethod', '');
fileContent = fileContent.replaceAll('##decodeTranslationMethod', '');
Expand All @@ -152,14 +156,16 @@ void createFtsUtilsFile() {
);

// --
fileContent = fileContent.replaceAll('##resolveTranslations', resolveTranslationCode);
fileContent =
fileContent.replaceAll('##resolveTranslations', resolveTranslationCode);

// --
fileContent = fileContent.replaceFirst(
'##argsPattern',
config.paramFtsUtilsArgsPattern,
);
fileContent = fileContent.replaceAll('##tData', config.dartTranslationClassname);
fileContent =
fileContent.replaceAll('##tData', config.dartTranslationClassname);

var patt = config.paramOutputPattern;
if (patt.isEmpty || patt == '*') {
Expand Down Expand Up @@ -189,8 +195,9 @@ void createFtsUtilsFile() {
void createDartExportFile(List<String> exportPaths) {
final dir = config.dartOutputDir;
exportPaths.sort();
var fileContents =
exportPaths.map((path) => 'export "${p.relative(path, from: dir)}";').join('\n');
var fileContents = exportPaths
.map((path) => 'export "${p.relative(path, from: dir)}";')
.join('\n');
var exportFilePath = p.join(dir, '${p.basename(dir)}.dart');

/// export the file.
Expand Down Expand Up @@ -330,12 +337,15 @@ abstract class AppLocales {

fileContent += '$fields\n';

final supportedLocales =
locales.map((String key) => '${_localeVarName(key, snake: false)}.locale').join(',');
final availableLang = locales.map((String key) => _localeVarName(key, snake: false)).join(',');
final supportedLocales = locales
.map((String key) => '${_localeVarName(key, snake: false)}.locale')
.join(',');
final availableLang =
locales.map((String key) => _localeVarName(key, snake: false)).join(',');

fileContent += ' static const available = <LangVo>[$availableLang];\n';
fileContent += ' static List<Locale> get supportedLocales => [$supportedLocales];\n';
fileContent +=
' static List<Locale> get supportedLocales => [$supportedLocales];\n';
// ' static List<Locale> get supportedLocales => _supportedLocales;\n';
// fileContent +=
// ' static final _supportedLocales = <Locale>[$_supportedLocales];\n';
Expand Down Expand Up @@ -507,7 +517,8 @@ String _buildTKeyMap({
);
tostrFields.add(fieldName);
final modifier = isRoot || !classCanBeConst ? '' : ' const';
fields.add('$fieldModifier $fieldType $fieldName = $modifier $fieldType._();');
fields.add(
'$fieldModifier $fieldType $fieldName = $modifier $fieldType._();');
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/src/samples/samples.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/// const strings for templates.
class SampleYamls {
static const home = '''
static const home = '''
## Sample home section.
---
title: Home screen
Expand Down
6 changes: 3 additions & 3 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: flutter_translation_sheet
description: Flutter Translation Sheet (fts) is a simple tool to help you with
localization (l10n) generating json, arb and dart files.
version: 1.0.32
version: 1.0.33-dev.1
maintainer: Rodrigo López (@roipeker)
homepage: https://github.com/roipeker/flutter_translation_sheet
repository: https://github.com/roipeker/flutter_translation_sheet/
Expand All @@ -20,8 +20,8 @@ dependencies:
googleapis: ^11.4.0
googleapis_auth: ^1.4.1
io: ^1.0.4
http: ^1.1.2
path: ^1.8.3
http: ^1.2.1
path: ^1.9.0
recase: ^4.1.0
watcher: ^1.1.0
yaml: ^3.1.2
Expand Down

0 comments on commit 463ce3a

Please sign in to comment.