From 726d7f2ea419b74d5eee5a1dd9381c787aefef46 Mon Sep 17 00:00:00 2001 From: LeadcodeDev Date: Wed, 29 Mar 2023 20:58:45 +0200 Subject: [PATCH] feat: Migrate to Mineral package release --- .github/workflows/publish.yaml | 19 +++++++++++++++++++ CHANGELOG.md | 3 +++ lib/mineral_i18n.dart | 3 +-- lib/src/mixins/translation.dart | 8 ++++---- pubspec.yaml | 2 +- 5 files changed, 28 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/publish.yaml diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml new file mode 100644 index 0000000..6b99e45 --- /dev/null +++ b/.github/workflows/publish.yaml @@ -0,0 +1,19 @@ +name: Publish to pub.dev + +on: + push: + tags: + - 'v[0-9]+.[0-9]+.[0-9]+*' # tag pattern on pub.dev: 'v' +# Publish using custom workflow +jobs: + publish: + permissions: + id-token: write + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: dart-lang/setup-dart@v1 + - name: Install dependencies + run: dart pub get + - name: Publish + run: dart pub publish --force diff --git a/CHANGELOG.md b/CHANGELOG.md index 497ef39..ca6a49f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 2.0.0 +- Rewrite package to follow new `mineral: ^3.1.0` version of Core. + ## 1.1.0 - Write readme. diff --git a/lib/mineral_i18n.dart b/lib/mineral_i18n.dart index 10ee6b8..f4f68da 100644 --- a/lib/mineral_i18n.dart +++ b/lib/mineral_i18n.dart @@ -2,5 +2,4 @@ library i18n; export 'src/i18n.dart'; export 'src/contracts/i18n_contract.dart'; -export 'src/mixins/translation.dart'; - +export 'src/mixins/translation.dart'; \ No newline at end of file diff --git a/lib/src/mixins/translation.dart b/lib/src/mixins/translation.dart index d3887f8..14f64d8 100644 --- a/lib/src/mixins/translation.dart +++ b/lib/src/mixins/translation.dart @@ -5,11 +5,11 @@ mixin Translation { /// Translates the sentence defined by the key set into the requested language. /// Replacement parameters can be injected. /// ```dart - /// final String sentence = t(Lang.enGB, 'foo.bar'); - /// print(sentence) 👈 'Hello {user}' + /// final String sentence = t('en', 'foo.bar'); + /// print(sentence); 👈 'Hello {user}' /// - /// final String sentence = t(Lang.enGB, 'foo.bar', { 'user': 'Freeze' }); - /// print(sentence) 👈 'Hello Freeze' + /// final String sentence = t('en', 'foo.bar', replacers { 'user': 'Freeze' }); + /// print(sentence); 👈 'Hello Freeze' /// ``` String t (String lang, String key, { Map? replacers }) { dynamic target = ioc.use().translationManager.cache[lang]; diff --git a/pubspec.yaml b/pubspec.yaml index a016404..62f5ef9 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: mineral_i18n description: I18n allows you to translate your text content into multiple languages -version: 1.1.0 +version: 2.0.0 repository: https://github.com/mineral-dart/i18n # homepage: https://www.example.com