Skip to content

Commit

Permalink
feat: Migrate to Mineral package release
Browse files Browse the repository at this point in the history
  • Loading branch information
LeadcodeDev committed Mar 29, 2023
1 parent df35f12 commit 726d7f2
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 7 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 2.0.0
- Rewrite package to follow new `mineral: ^3.1.0` version of Core.

## 1.1.0
- Write readme.

Expand Down
3 changes: 1 addition & 2 deletions lib/mineral_i18n.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';
8 changes: 4 additions & 4 deletions lib/src/mixins/translation.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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<String, dynamic>? replacers }) {
dynamic target = ioc.use<I18n>().translationManager.cache[lang];
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 726d7f2

Please sign in to comment.