Skip to content

Commit

Permalink
release: 3.18.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Tienisto committed Jun 1, 2023
1 parent f96cb4d commit 1e41b35
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import 'dart:io';

import 'package:collection/collection.dart';
import 'package:slang/builder/builder/raw_config_builder.dart';
import 'package:slang/builder/decoder/base_decoder.dart';
import 'package:slang/builder/model/i18n_locale.dart';
import 'package:slang/builder/model/raw_config.dart';
import 'package:slang/builder/model/slang_file_collection.dart';
Expand Down
18 changes: 3 additions & 15 deletions slang/lib/builder/builder/translation_map_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import 'package:slang/builder/model/enums.dart';
import 'package:slang/builder/model/i18n_locale.dart';
import 'package:slang/builder/model/slang_file_collection.dart';
import 'package:slang/builder/model/translation_map.dart';
import 'package:slang/builder/utils/path_utils.dart';

class TranslationMapBuilder {
/// This method transforms files to an intermediate model [TranslationMap].
Expand Down Expand Up @@ -66,29 +65,18 @@ class TranslationMapBuilder {
} else {
// json, yaml or normal csv

// directory name could be a locale
I18nLocale? directoryLocale = null;
if (rawConfig.namespaces) {
directoryLocale = PathUtils.findDirectoryLocale(
filePath: file.path,
inputDirectory: rawConfig.inputDirectory,
);
}

final locale = directoryLocale ?? rawConfig.baseLocale;

translationMap.addTranslations(
locale: locale,
locale: file.locale,
namespace: file.namespace,
translations: translations,
);

if (verbose) {
final baseLog = locale == rawConfig.baseLocale ? '(base) ' : '';
final baseLog = file.locale == rawConfig.baseLocale ? '(base) ' : '';
final namespaceLog =
rawConfig.namespaces ? '(${file.namespace}) ' : '';
print(
'${'$baseLog$namespaceLog${locale.languageTag}'.padLeft(padLeft)} -> ${file.path}');
'${'$baseLog$namespaceLog${file.locale.languageTag}'.padLeft(padLeft)} -> ${file.path}');
}
}
}
Expand Down
6 changes: 5 additions & 1 deletion slang/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
name: slang
description: Localization / Internationalization (i18n) solution. Use JSON, YAML or CSV files to create typesafe translations via source generation.
version: 3.17.0
version: 3.18.0
repository: https://github.com/Tienisto/slang
topics:
- i18n
- localization
- translation

environment:
sdk: ">=2.17.0 <4.0.0"
Expand Down
2 changes: 1 addition & 1 deletion slang/test/unit/utils/path_utils_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ void main() {
});

test('locale in first directory', () {
expect(f('/de/world/haha/cool.json'), I18nLocale(language: 'de'));
expect(f('/de/world/haha/cool.json'), null);
});

test('locale in last directory', () {
Expand Down
4 changes: 4 additions & 0 deletions slang_build_runner/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 3.18.0

- Bump `slang` to `3.18.0`

## 3.17.0

- Bump `slang` to `3.17.0`
Expand Down
4 changes: 2 additions & 2 deletions slang_build_runner/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: slang_build_runner
description: build_runner integration for slang. This library ensures that slang is recognized by build_runner.
version: 3.17.0
version: 3.18.0
repository: https://github.com/Tienisto/slang

environment:
Expand All @@ -11,4 +11,4 @@ dependencies:
glob: ^2.0.2

# Use tight version to ensure that all features are available
slang: '>=3.17.0 <3.18.0'
slang: '>=3.18.0 <3.19.0'
4 changes: 4 additions & 0 deletions slang_flutter/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 3.18.0

- Bump `slang` to `3.18.0`

## 3.17.0

- fix: setLocale does not work when Locale enum is from two packages (by [@fzyzcjy](https://github.com/fzyzcjy))
Expand Down
4 changes: 2 additions & 2 deletions slang_flutter/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: slang_flutter
description: Flutter support for slang. This library provides helpful Flutter API.
version: 3.17.0
version: 3.18.0
repository: https://github.com/Tienisto/slang

environment:
Expand All @@ -11,4 +11,4 @@ dependencies:
sdk: flutter

# Use tight version to ensure that all features are available
slang: '>=3.17.0 <3.18.0'
slang: '>=3.18.0 <3.19.0'

0 comments on commit 1e41b35

Please sign in to comment.