Skip to content

Commit

Permalink
Badges.
Browse files Browse the repository at this point in the history
  • Loading branch information
marcglasberg committed Dec 13, 2024
1 parent 7b94afb commit 3ab9c79
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 17 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Sponsored by [MyText.ai](https://mytext.ai)

[![](./example/SponsoredByMyTextAi.png)](https://mytext.ai)

## 14.0.0-dev.1
## 14.0.0-dev.2

Version 14 brings important improvements, like new interpolation methods, useful
extensions, and improved standardization, with the cost of a few breaking changes that
Expand Down
36 changes: 22 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
[![](./example/SponsoredByMyTextAi.png)](https://mytext.ai)

[![pub package](https://img.shields.io/pub/v/i18n_extension.svg)](https://pub.dartlang.org/packages/i18n_extension)
[![Pub Version](https://img.shields.io/pub/v/i18n_extension?style=flat-square&logo=dart)](https://pub.dev/packages/i18n_extension)
[![Code Check](https://github.com/marcglasberg/i18n_extension/actions/workflows/code_check.yaml/badge.svg)](https://github.com/marcglasberg/i18n_extension/actions/workflows/code_check.yaml)
![Code Climate issues](https://img.shields.io/github/issues/marcglasberg/i18n_extension?style=flat-square)
![GitHub closed issues](https://img.shields.io/github/issues-closed/marcglasberg/i18n_extension?style=flat-square)
![GitHub contributors](https://img.shields.io/github/contributors/marcglasberg/i18n_extension?style=flat-square)
![GitHub repo size](https://img.shields.io/github/repo-size/marcglasberg/i18n_extension?style=flat-square)
![GitHub forks](https://img.shields.io/github/forks/marcglasberg/i18n_extension?style=flat-square)
![GitHub stars](https://img.shields.io/github/stars/marcglasberg/i18n_extension?style=flat-square)
![CodeFactor Grade](https://img.shields.io/codefactor/grade/github/marcglasberg/i18n_extension?style=flat-square)
![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)

# Translate your app!

Expand All @@ -16,10 +25,9 @@
> This package was mentioned by Google during
> the [Dart 2.7 announcement](https://medium.com/dartlang/dart-2-7-a3710ec54e97)
> Read
>
the [Medium article](https://medium.com/flutter-community/i18n-extension-flutter-b966f4c65df9)
> Read the
> [Medium article](https://medium.com/flutter-community/i18n-extension-flutter-b966f4c65df9)
&nbsp;<br>

Expand All @@ -37,16 +45,16 @@ To make it translatable, just add `.i18n` to the string:
Text('How are you?'.i18n);
```

The text will automatically show the correct translation based on the current locale.
The text will be translated based on the current locale.
For example, if your app supports `en-US`, `pt-BR`, and `es` (American English, Brazilian
Portuguese, and Spanish):

- When the current locale is `en-US`, it shows `'How are you?'`
- When the current locale is `pt-BR`, it shows `'Como vai?'`
- When the current locale is `es`, it shows `'¿Cómo estás?'`
- When the locale is `en-US`, it shows `'How are you?'`
- When the locale is `pt-BR`, it shows `'Como vai?'`
- When the locale is `es`, it shows `'¿Cómo estás?'`
- And so on for any other locales you want to support

Note the original English string doubles as the **"translation key"** to
Note the original English string `'How are you?'` doubles as the **"translation key"** to
find the appropriate translation. One advantage of this approach is that you don’t need
to come up with _unique identifiers_ for each string.

Expand Down Expand Up @@ -124,19 +132,19 @@ Interpolating by replacing placeholders with values, with the `args` function:

```dart
// Hello John and Mary
'Hello {} and {}'.args('John', 'Mary');
'Hello {} and {}'.i18n.args('John', 'Mary');
// Also works with iterables
'Hello {} and {}'.args(['John', 'Mary']);
'Hello {} and {}'.i18n.args(['John', 'Mary']);
// Named placeholders
'Hello {name} and {other}'.args({'name': 'John', 'other': 'Mary'});
'Hello {name} and {other}'.i18n.args({'name': 'John', 'other': 'Mary'});
// Numbered placeholders
'Hello {1} and {2}'.args({1: 'John', 2: 'Mary'});
'Hello {1} and {2}'.i18n.args({1: 'John', 2: 'Mary'});
// And you can mix placeholder types
'Hello {name}, let’s meet up with {} and {other} to explore {1} and {2}.'.args('Charlie', {'name': 'Alice', 'other': 'Bob'}, {1: 'Paris', 2: 'London'});
'Hello {name}, let’s meet up with {} and {other} to explore {1} and {2}.'.i18n.args('Charlie', {'name': 'Alice', 'other': 'Bob'}, {1: 'Paris', 2: 'London'});
```

Interpolating by
Expand Down
4 changes: 2 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: i18n_extension
description: Translation and Internationalization (i18n) for Flutter. Easy to use for both large and small projects. Uses Dart extensions to reduce boilerplate.
version: 14.0.0-dev.1
version: 14.0.0-dev.2
# author: Marcelo Glasberg <[email protected]>
homepage: https://github.com/marcglasberg/i18n_extension
topics:
Expand All @@ -14,7 +14,7 @@ environment:
sdk: '>=3.5.0 <4.0.0'

dependencies:
intl: ^0.19.0
intl: '>=0.17.0-0 <=0.20.1'
i18n_extension_core: ^3.0.0-dev.2
shared_preferences: ^2.3.3
flutter:
Expand Down

0 comments on commit 3ab9c79

Please sign in to comment.