diff --git a/.github/workflows/flutter-drive-android.yml b/.github/workflows/flutter-drive-android.yml index 24d79eb..c07b58d 100644 --- a/.github/workflows/flutter-drive-android.yml +++ b/.github/workflows/flutter-drive-android.yml @@ -2,7 +2,7 @@ name: Flutter drive Android on: push jobs: drive_android: - runs-on: macos-latest + runs-on: ubuntu-latest strategy: matrix: api-level: [21, 29, 31] @@ -13,6 +13,11 @@ jobs: - uses: subosito/flutter-action@v2 with: channel: stable + - name: Enable KVM group perms + run: | + echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules + sudo udevadm control --reload-rules + sudo udevadm trigger --name-match=kvm - name: Run Flutter Driver basic tests uses: reactivecircus/android-emulator-runner@v2 with: diff --git a/.github/workflows/flutter-drive-ios.yml b/.github/workflows/flutter-drive-ios.yml index 1c599ab..ad19be0 100644 --- a/.github/workflows/flutter-drive-ios.yml +++ b/.github/workflows/flutter-drive-ios.yml @@ -5,9 +5,10 @@ jobs: strategy: matrix: device: - - "iPhone 8" - - "iPhone 11 Pro Max" - - "iPhone 13 Pro Max" + - "iPhone 15" + - "iPhone 15 Plus" + - "iPhone 15 Pro" + - "iPhone 15 Pro Max" fail-fast: true runs-on: macos-latest steps: diff --git a/CHANGELOG.md b/CHANGELOG.md index 24c06b8..eed8194 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -288,4 +288,7 @@ Upgrade intl@0.18.1, xml2json@6.2.2, toml@0.15.0, http@1.1.2 Fix: deprecation warnings ## [0.35.1] -Change intl version to '>=0.17.0-0 <=0.19.0' \ No newline at end of file +Change intl version to '>=0.17.0-0 <=0.19.0' + +## [0.36.0] +Ability to define custom separator \ No newline at end of file diff --git a/example/pubspec.lock b/example/pubspec.lock index 27a13cd..7fadfde 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -5,26 +5,26 @@ packages: dependency: transitive description: name: _fe_analyzer_shared - sha256: eb376e9acf6938204f90eb3b1f00b578640d3188b4c8a8ec054f9f479af8d051 + sha256: "0b2f2bd91ba804e53a61d757b986f89f1f9eaed5b11e4b2f5a2468d86d6c9fc7" url: "https://pub.dev" source: hosted - version: "64.0.0" + version: "67.0.0" analyzer: dependency: transitive description: name: analyzer - sha256: "69f54f967773f6c26c7dcb13e93d7ccee8b17a641689da39e878d5cf13b06893" + sha256: "37577842a27e4338429a1cbc32679d508836510b056f1eedf0c8d20e39c1383d" url: "https://pub.dev" source: hosted - version: "6.2.0" + version: "6.4.1" args: dependency: transitive description: name: args - sha256: eef6c46b622e0494a36c5a12d10d77fb4e855501a91c1b9ef9339326e58f0596 + sha256: "7cf60b9f0cc88203c5a190b4cd62a99feea42759a7fa695010eb5de1c0b2252a" url: "https://pub.dev" source: hosted - version: "2.4.2" + version: "2.5.0" async: dependency: transitive description: @@ -77,10 +77,10 @@ packages: dependency: transitive description: name: coverage - sha256: "595a29b55ce82d53398e1bcc2cba525d7bd7c59faeb2d2540e9d42c390cfeeeb" + sha256: "3945034e86ea203af7a056d98e98e42a5518fff200d6e8e6647e1886b07e936e" url: "https://pub.dev" source: hosted - version: "1.6.4" + version: "1.8.0" crypto: dependency: transitive description: @@ -93,10 +93,10 @@ packages: dependency: "direct main" description: name: cupertino_icons - sha256: d57953e10f9f8327ce64a508a355f0b1ec902193f66288e8cb5070e7c47eeb2d + sha256: ba631d1c7f7bef6b729a622b7b752645a2d076dba9976925b8f25725a30e1ee6 url: "https://pub.dev" source: hosted - version: "1.0.6" + version: "1.0.8" fake_async: dependency: transitive description: @@ -109,18 +109,18 @@ packages: dependency: transitive description: name: ffi - sha256: "7bf0adc28a23d395f19f3f1eb21dd7cfd1dd9f8e1c50051c069122e6853bc878" + sha256: "493f37e7df1804778ff3a53bd691d8692ddf69702cf4c1c1096a2e41b4779e21" url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.1.2" file: dependency: transitive description: name: file - sha256: "1b92bec4fc2a72f59a8e15af5f52cd441e4a7860b49499d69dfa817af20e925d" + sha256: "5fc22d7c25582e38ad9a8515372cd9a93834027aacf1801cf01164dac0ffa08c" url: "https://pub.dev" source: hosted - version: "6.1.4" + version: "7.0.0" flutter: dependency: "direct main" description: flutter @@ -137,7 +137,7 @@ packages: path: ".." relative: true source: path - version: "0.35.1" + version: "0.36.0" flutter_localizations: dependency: transitive description: flutter @@ -178,10 +178,10 @@ packages: dependency: "direct main" description: name: http - sha256: d4872660c46d929f6b8a9ef4e7a7eff7e49bbf0c4ec3f385ee32df5119175139 + sha256: "761a297c042deedc1ffbb156d6e2af13886bb305c2a343a4d972504cd67dd938" url: "https://pub.dev" source: hosted - version: "1.1.2" + version: "1.2.1" http_multi_server: dependency: transitive description: @@ -227,6 +227,30 @@ packages: url: "https://pub.dev" source: hosted version: "0.6.7" + leak_tracker: + dependency: transitive + description: + name: leak_tracker + sha256: "78eb209deea09858f5269f5a5b02be4049535f568c07b275096836f01ea323fa" + url: "https://pub.dev" + source: hosted + version: "10.0.0" + leak_tracker_flutter_testing: + dependency: transitive + description: + name: leak_tracker_flutter_testing + sha256: b46c5e37c19120a8a01918cfaf293547f47269f7cb4b0058f21531c2465d6ef0 + url: "https://pub.dev" + source: hosted + version: "2.0.1" + leak_tracker_testing: + dependency: transitive + description: + name: leak_tracker_testing + sha256: a597f72a664dbd293f3bfc51f9ba69816f84dcd403cdac7066cb3f6003f3ab47 + url: "https://pub.dev" + source: hosted + version: "2.0.1" logging: dependency: transitive description: @@ -239,34 +263,34 @@ packages: dependency: transitive description: name: matcher - sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e" + sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb url: "https://pub.dev" source: hosted - version: "0.12.16" + version: "0.12.16+1" material_color_utilities: dependency: transitive description: name: material_color_utilities - sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41" + sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a" url: "https://pub.dev" source: hosted - version: "0.5.0" + version: "0.8.0" meta: dependency: transitive description: name: meta - sha256: a6e590c838b18133bb482a2745ad77c5bb7715fb0451209e1a7567d416678b8e + sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04 url: "https://pub.dev" source: hosted - version: "1.10.0" + version: "1.11.0" mime: dependency: transitive description: name: mime - sha256: e4ff8e8564c03f255408decd16e7899da1733852a9110a58fe6d1b817684a63e + sha256: "2e123074287cc9fd6c09de8336dae606d1ddb88d9ac47358826db698c176a1f2" url: "https://pub.dev" source: hosted - version: "1.0.4" + version: "1.0.5" node_preamble: dependency: transitive description: @@ -287,34 +311,34 @@ packages: dependency: transitive description: name: path - sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" + sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" url: "https://pub.dev" source: hosted - version: "1.8.3" + version: "1.9.0" path_provider: dependency: "direct main" description: name: path_provider - sha256: a1aa8aaa2542a6bc57e381f132af822420216c80d4781f7aa085ca3229208aaa + sha256: c9e7d3a4cd1410877472158bee69963a4579f78b68c65a2b7d40d1a7a88bb161 url: "https://pub.dev" source: hosted - version: "2.1.1" + version: "2.1.3" path_provider_android: dependency: transitive description: name: path_provider_android - sha256: "477184d672607c0a3bf68fbbf601805f92ef79c82b64b4d6eb318cbca4c48668" + sha256: a248d8146ee5983446bf03ed5ea8f6533129a12b11f12057ad1b4a67a2b3b41d url: "https://pub.dev" source: hosted - version: "2.2.2" + version: "2.2.4" path_provider_foundation: dependency: transitive description: name: path_provider_foundation - sha256: "19314d595120f82aca0ba62787d58dde2cc6b5df7d2f0daf72489e38d1b57f2d" + sha256: f234384a3fdd67f989b4d54a5d73ca2a6c422fa55ae694381ae0f4375cd1ea16 url: "https://pub.dev" source: hosted - version: "2.3.1" + version: "2.4.0" path_provider_linux: dependency: transitive description: @@ -327,10 +351,10 @@ packages: dependency: transitive description: name: path_provider_platform_interface - sha256: "94b1e0dd80970c1ce43d5d4e050a9918fce4f4a775e6142424c30a29a363265c" + sha256: "88f5779f72ba699763fa3a3b06aa4bf6de76c8e5de842cf6f29e2e06476c2334" url: "https://pub.dev" source: hosted - version: "2.1.1" + version: "2.1.2" path_provider_windows: dependency: transitive description: @@ -351,18 +375,18 @@ packages: dependency: transitive description: name: platform - sha256: ae68c7bfcd7383af3629daafb32fb4e8681c7154428da4febcff06200585f102 + sha256: "12220bb4b65720483f8fa9450b4332347737cf8213dd2840d8b2c823e47243ec" url: "https://pub.dev" source: hosted - version: "3.1.2" + version: "3.1.4" plugin_platform_interface: dependency: transitive description: name: plugin_platform_interface - sha256: f4f88d4a900933e7267e2b353594774fc0d07fb072b47eedcd5b54e1ea3269f8 + sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" url: "https://pub.dev" source: hosted - version: "2.1.7" + version: "2.1.8" pool: dependency: transitive description: @@ -375,10 +399,10 @@ packages: dependency: transitive description: name: process - sha256: "53fd8db9cec1d37b0574e12f07520d582019cb6c44abf5479a01505099a34a09" + sha256: "21e54fd2faf1b5bdd5102afd25012184a6793927648ea81eea80552ac9405b32" url: "https://pub.dev" source: hosted - version: "4.2.4" + version: "5.0.2" pub_semver: dependency: transitive description: @@ -540,10 +564,10 @@ packages: dependency: transitive description: name: vm_service - sha256: c538be99af830f478718b51630ec1b6bee5e74e52c8a802d328d9e71d35d2583 + sha256: b3d56ff4341b8f182b96aceb2fa20e3dcb336b9f867bc0eafc0de10f1048e957 url: "https://pub.dev" source: hosted - version: "11.10.0" + version: "13.0.0" watcher: dependency: transitive description: @@ -556,26 +580,26 @@ packages: dependency: transitive description: name: web - sha256: afe077240a270dcfd2aafe77602b4113645af95d0ad31128cc02bce5ac5d5152 + sha256: "97da13628db363c635202ad97068d47c5b8aa555808e7a9411963c533b449b27" url: "https://pub.dev" source: hosted - version: "0.3.0" + version: "0.5.1" web_socket_channel: dependency: transitive description: name: web_socket_channel - sha256: d88238e5eac9a42bb43ca4e721edba3c08c6354d4a53063afaa568516217621b + sha256: "58c6666b342a38816b2e7e50ed0f1e261959630becd4c879c4f26bfa14aa5a42" url: "https://pub.dev" source: hosted - version: "2.4.0" + version: "2.4.5" webdriver: dependency: transitive description: name: webdriver - sha256: "3c923e918918feeb90c4c9fdf1fe39220fa4c0e8e2c0fffaded174498ef86c49" + sha256: "003d7da9519e1e5f329422b36c4dcdf18d7d2978d1ba099ea4e45ba490ed845e" url: "https://pub.dev" source: hosted - version: "3.0.2" + version: "3.0.3" webkit_inspection_protocol: dependency: transitive description: @@ -588,18 +612,18 @@ packages: dependency: transitive description: name: win32 - sha256: b0f37db61ba2f2e9b7a78a1caece0052564d1bc70668156cf3a29d676fe4e574 + sha256: "0eaf06e3446824099858367950a813472af675116bf63f008a4c2a75ae13e9cb" url: "https://pub.dev" source: hosted - version: "5.1.1" + version: "5.5.0" xdg_directories: dependency: transitive description: name: xdg_directories - sha256: "589ada45ba9e39405c198fe34eb0f607cddb2108527e658136120892beac46d2" + sha256: faea9dee56b520b55a566385b84f2e8de55e7496104adada9962e0bd11bcff1d url: "https://pub.dev" source: hosted - version: "1.0.3" + version: "1.0.4" xml: dependency: transitive description: @@ -612,10 +636,10 @@ packages: dependency: transitive description: name: xml2json - sha256: d97aed12d54193611c442c268155398f4170b52cfc0058aabbd79160c9c8eefb + sha256: "52b7c8d350fdce09545b058982c26689ee89f1eb188cc9910d585665bfe27bc0" url: "https://pub.dev" source: hosted - version: "6.2.2" + version: "6.2.3" yaml: dependency: transitive description: @@ -625,5 +649,5 @@ packages: source: hosted version: "3.1.2" sdks: - dart: ">=3.2.0 <4.0.0" - flutter: ">=3.10.0" + dart: ">=3.3.0 <4.0.0" + flutter: ">=3.16.6" diff --git a/lib/loaders/file_translation_loader.dart b/lib/loaders/file_translation_loader.dart index 27565eb..ea0d4bc 100644 --- a/lib/loaders/file_translation_loader.dart +++ b/lib/loaders/file_translation_loader.dart @@ -4,9 +4,9 @@ import 'package:flutter/services.dart'; import 'package:flutter/widgets.dart'; import 'package:flutter_i18n/loaders/decoders/base_decode_strategy.dart'; import 'package:flutter_i18n/loaders/decoders/json_decode_strategy.dart'; +import 'package:flutter_i18n/loaders/decoders/toml_decode_strategy.dart'; import 'package:flutter_i18n/loaders/decoders/xml_decode_strategy.dart'; import 'package:flutter_i18n/loaders/decoders/yaml_decode_strategy.dart'; -import 'package:flutter_i18n/loaders/decoders/toml_decode_strategy.dart'; import 'package:flutter_i18n/loaders/file_content.dart'; import 'package:flutter_i18n/loaders/translation_loader.dart'; @@ -16,6 +16,7 @@ import '../utils/message_printer.dart'; class FileTranslationLoader extends TranslationLoader implements IFileContent { final String fallbackFile; final String basePath; + final String separator; final bool useCountryCode; final bool useScriptCode; AssetBundle assetBundle = rootBundle; @@ -25,11 +26,17 @@ class FileTranslationLoader extends TranslationLoader implements IFileContent { set decodeStrategies(List? decodeStrategies) => _decodeStrategies = decodeStrategies ?? - [JsonDecodeStrategy(), YamlDecodeStrategy(), XmlDecodeStrategy(), TomlDecodeStrategy()]; + [ + JsonDecodeStrategy(), + YamlDecodeStrategy(), + XmlDecodeStrategy(), + TomlDecodeStrategy() + ]; FileTranslationLoader( {this.fallbackFile = "en", this.basePath = "assets/flutter_i18n", + this.separator = "_", this.useCountryCode = false, this.useScriptCode = false, forcedLocale, @@ -74,9 +81,9 @@ class FileTranslationLoader extends TranslationLoader implements IFileContent { } Map _deepMergeMaps( - Map map1, - Map map2, - ) { + Map map1, + Map map2, + ) { var result = Map.of(map1); map2.forEach((key, mapValue) { @@ -127,11 +134,11 @@ class FileTranslationLoader extends TranslationLoader implements IFileContent { @protected String _composeSuffixCode() { String countryCode = ""; - if(useScriptCode && locale!.scriptCode != null) { - countryCode = "${countryCode}_${locale!.scriptCode}"; + if (useScriptCode && locale!.scriptCode != null) { + countryCode = "${countryCode}${separator}${locale!.scriptCode}"; } if (useCountryCode && locale!.countryCode != null) { - countryCode = "${countryCode}_${locale!.countryCode}"; + countryCode = "${countryCode}${separator}${locale!.countryCode}"; } return countryCode; } diff --git a/lib/loaders/namespace_file_translation_loader.dart b/lib/loaders/namespace_file_translation_loader.dart index 7665b58..f9f7b36 100644 --- a/lib/loaders/namespace_file_translation_loader.dart +++ b/lib/loaders/namespace_file_translation_loader.dart @@ -5,9 +5,6 @@ import 'package:flutter_i18n/utils/message_printer.dart'; /// Loads translations from separate files class NamespaceFileTranslationLoader extends FileTranslationLoader { final String fallbackDir; - final String basePath; - final bool useCountryCode; - final bool useScriptCode; final List? namespaces; AssetBundle assetBundle = rootBundle; @@ -16,13 +13,15 @@ class NamespaceFileTranslationLoader extends FileTranslationLoader { NamespaceFileTranslationLoader( {required this.namespaces, this.fallbackDir = "en", - this.basePath = "assets/flutter_i18n", - this.useCountryCode = false, - this.useScriptCode = false, + basePath = "assets/flutter_i18n", + separator = "_", + useCountryCode = false, + useScriptCode = false, forcedLocale, decodeStrategies}) : super( basePath: basePath, + separator: separator, useCountryCode: useCountryCode, useScriptCode: useScriptCode, forcedLocale: forcedLocale, diff --git a/lib/loaders/network_file_translation_loader.dart b/lib/loaders/network_file_translation_loader.dart index fb0adf1..0416bd5 100644 --- a/lib/loaders/network_file_translation_loader.dart +++ b/lib/loaders/network_file_translation_loader.dart @@ -13,11 +13,13 @@ class NetworkFileTranslationLoader extends FileTranslationLoader { {required this.baseUri, forcedLocale, fallbackFile = "en", + separator = "_", useCountryCode = false, useScriptCode = false, decodeStrategies}) : super( fallbackFile: fallbackFile, + separator: separator, useCountryCode: useCountryCode, forcedLocale: forcedLocale, decodeStrategies: decodeStrategies); diff --git a/pubspec.lock b/pubspec.lock index 48d1105..4a07ce3 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -73,10 +73,10 @@ packages: dependency: "direct main" description: name: http - sha256: d4872660c46d929f6b8a9ef4e7a7eff7e49bbf0c4ec3f385ee32df5119175139 + sha256: "761a297c042deedc1ffbb156d6e2af13886bb305c2a343a4d972504cd67dd938" url: "https://pub.dev" source: hosted - version: "1.1.2" + version: "1.2.1" http_parser: dependency: transitive description: @@ -93,6 +93,30 @@ packages: url: "https://pub.dev" source: hosted version: "0.18.1" + leak_tracker: + dependency: transitive + description: + name: leak_tracker + sha256: "78eb209deea09858f5269f5a5b02be4049535f568c07b275096836f01ea323fa" + url: "https://pub.dev" + source: hosted + version: "10.0.0" + leak_tracker_flutter_testing: + dependency: transitive + description: + name: leak_tracker_flutter_testing + sha256: b46c5e37c19120a8a01918cfaf293547f47269f7cb4b0058f21531c2465d6ef0 + url: "https://pub.dev" + source: hosted + version: "2.0.1" + leak_tracker_testing: + dependency: transitive + description: + name: leak_tracker_testing + sha256: a597f72a664dbd293f3bfc51f9ba69816f84dcd403cdac7066cb3f6003f3ab47 + url: "https://pub.dev" + source: hosted + version: "2.0.1" logging: dependency: "direct main" description: @@ -105,34 +129,34 @@ packages: dependency: transitive description: name: matcher - sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e" + sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb url: "https://pub.dev" source: hosted - version: "0.12.16" + version: "0.12.16+1" material_color_utilities: dependency: transitive description: name: material_color_utilities - sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41" + sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a" url: "https://pub.dev" source: hosted - version: "0.5.0" + version: "0.8.0" meta: dependency: transitive description: name: meta - sha256: a6e590c838b18133bb482a2745ad77c5bb7715fb0451209e1a7567d416678b8e + sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04 url: "https://pub.dev" source: hosted - version: "1.10.0" + version: "1.11.0" path: dependency: "direct main" description: name: path - sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" + sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" url: "https://pub.dev" source: hosted - version: "1.8.3" + version: "1.9.0" pedantic: dependency: "direct dev" description: @@ -226,14 +250,22 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.4" + vm_service: + dependency: transitive + description: + name: vm_service + sha256: b3d56ff4341b8f182b96aceb2fa20e3dcb336b9f867bc0eafc0de10f1048e957 + url: "https://pub.dev" + source: hosted + version: "13.0.0" web: dependency: transitive description: name: web - sha256: afe077240a270dcfd2aafe77602b4113645af95d0ad31128cc02bce5ac5d5152 + sha256: "97da13628db363c635202ad97068d47c5b8aa555808e7a9411963c533b449b27" url: "https://pub.dev" source: hosted - version: "0.3.0" + version: "0.5.1" xml: dependency: transitive description: @@ -246,10 +278,10 @@ packages: dependency: "direct main" description: name: xml2json - sha256: d97aed12d54193611c442c268155398f4170b52cfc0058aabbd79160c9c8eefb + sha256: "52b7c8d350fdce09545b058982c26689ee89f1eb188cc9910d585665bfe27bc0" url: "https://pub.dev" source: hosted - version: "6.2.2" + version: "6.2.3" yaml: dependency: "direct main" description: @@ -259,4 +291,4 @@ packages: source: hosted version: "3.1.2" sdks: - dart: ">=3.2.0 <4.0.0" + dart: ">=3.3.0 <4.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index 0ba2a56..ca019d4 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: flutter_i18n description: i18n made easy for Flutter. With flutter_i18n you can make your app international, using just a simple .json, .xml, .yaml or .toml file! -version: 0.35.1 +version: 0.36.0 homepage: https://github.com/ilteoood/flutter_i18n issue_tracker: https://github.com/ilteoood/flutter_i18n/issues