diff --git a/slang/lib/builder/builder/slang_file_collection_builder.dart b/slang/lib/builder/builder/slang_file_collection_builder.dart index f75d4867..4d64186e 100644 --- a/slang/lib/builder/builder/slang_file_collection_builder.dart +++ b/slang/lib/builder/builder/slang_file_collection_builder.dart @@ -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'; diff --git a/slang/lib/builder/builder/translation_map_builder.dart b/slang/lib/builder/builder/translation_map_builder.dart index 54a5965d..353704d9 100644 --- a/slang/lib/builder/builder/translation_map_builder.dart +++ b/slang/lib/builder/builder/translation_map_builder.dart @@ -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]. @@ -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}'); } } } diff --git a/slang/pubspec.yaml b/slang/pubspec.yaml index c6030a6a..dfd70991 100644 --- a/slang/pubspec.yaml +++ b/slang/pubspec.yaml @@ -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" diff --git a/slang/test/unit/utils/path_utils_test.dart b/slang/test/unit/utils/path_utils_test.dart index dc9a7564..1459f3df 100644 --- a/slang/test/unit/utils/path_utils_test.dart +++ b/slang/test/unit/utils/path_utils_test.dart @@ -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', () { diff --git a/slang_build_runner/CHANGELOG.md b/slang_build_runner/CHANGELOG.md index 3900313d..0e53a98a 100644 --- a/slang_build_runner/CHANGELOG.md +++ b/slang_build_runner/CHANGELOG.md @@ -1,3 +1,7 @@ +## 3.18.0 + +- Bump `slang` to `3.18.0` + ## 3.17.0 - Bump `slang` to `3.17.0` diff --git a/slang_build_runner/pubspec.yaml b/slang_build_runner/pubspec.yaml index 61bebfbc..629681a9 100644 --- a/slang_build_runner/pubspec.yaml +++ b/slang_build_runner/pubspec.yaml @@ -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: @@ -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' diff --git a/slang_flutter/CHANGELOG.md b/slang_flutter/CHANGELOG.md index 018f30ca..e108dd2c 100644 --- a/slang_flutter/CHANGELOG.md +++ b/slang_flutter/CHANGELOG.md @@ -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)) diff --git a/slang_flutter/pubspec.yaml b/slang_flutter/pubspec.yaml index fa50ffb0..33f4baf0 100644 --- a/slang_flutter/pubspec.yaml +++ b/slang_flutter/pubspec.yaml @@ -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: @@ -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'