Skip to content

Commit

Permalink
Merge pull request #231 from PaulineMoovency/master
Browse files Browse the repository at this point in the history
upgrade packages
  • Loading branch information
ilteoood authored Jan 29, 2025
2 parents 8b8ce4a + 123f008 commit 3b0de0f
Show file tree
Hide file tree
Showing 7 changed files with 224 additions and 184 deletions.
35 changes: 29 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@

*flutter_i18n* now manage strings that contain parameters; an example can be: "Hello, {user}!"
For a correct translation, you must use the third parameter of the *translate* method, a *Map<String, String>* where:

- the keys are the placeholders used in the *.json* file (i.e. user)
- the values are what you want to display

## [0.3.0]

*flutter_i18n* now supports language change at runtime. To use it, you ***must*** invoke the method

```sh
await FlutterI18n.refresh(buildContext, languageCode, {countryCode});
```
Expand All @@ -17,6 +19,7 @@ await FlutterI18n.refresh(buildContext, languageCode, {countryCode});
## [0.4.0]

*flutter_i18n* now supports plurals. To use it, invoke the method:

```sh
FlutterI18n.plural(buildContext, "your.key", pluralValue);
```
Expand All @@ -41,7 +44,6 @@ FlutterI18n.plural(buildContext, "clicked.times", pluralValue);

FlutterI18n will choose the right key using the value of pluralValue: it will match the last key with a value <= of pluralValue.


## [0.5.0]

*flutter_i18n* now supports the `basePath` configuration.
Expand Down Expand Up @@ -112,6 +114,7 @@ You can use it when the translation *key* is not found.
## [0.10.0]

Added stateless widgets in order to avoid to deal with BuildContext.

```dart
I18nText("your.key", Text(""))
I18nText("your.key", Text(""), translationParams: {"user": "Flutter lover"})
Expand All @@ -122,9 +125,9 @@ I18nPlural("clicked.times", 2, Text(""))

New translation mechanism, with different and customizable loaders provided:

* FileTranslationLoader
* NetworkFileTranslationLoader
* E2EFileTranslationLoader
- FileTranslationLoader
- NetworkFileTranslationLoader
- E2EFileTranslationLoader

## [0.11.1]

Expand Down Expand Up @@ -181,7 +184,7 @@ Test fix for [issue/115](https://github.com/ilteoood/flutter_i18n/issues/115)

New loader provided:

* LocalTranslationLoader
- LocalTranslationLoader

## [0.19.0]

Expand Down Expand Up @@ -223,6 +226,7 @@ Fix for #150
## [0.22.0]

Initial Flutter 2 support:

- intl upgraded to version 0.17.0
- example app upgraded to Android X
- null safe migration
Expand Down Expand Up @@ -251,51 +255,70 @@ Support for toml format
Fix for #173

## [0.31.0]

Fix for #179

## [0.31.1]

Fix for #184

## [0.32.0]

Fix for #186
Recursively merge the translation map with the fallback map

## [0.32.1]

Fix for #189

## [0.32.2]

Fix for #190

## [0.32.3]

Fix for #197 and #196

## [0.32.4]

Dependencies upgrade

## [0.32.5]

Dependencies upgrade

## [0.33.0]

Support for Dart 3 and Flutter 3.10
Fix for #204

## [0.34.0]

Upgrade http@1.1.0, logging@1.2.0, xml2json@6.2.0, yaml@3.1.2, path@1.8.3
Fix: deprecation warnings

## [0.35.0]

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'

## [0.36.0]

Ability to define custom separator

## [0.36.1]

Fix for #222

## [0.36.2]

Fix for #185
Fix for #216
Fix for #216

## [0.36.3]

Upgrade packages
Original file line number Diff line number Diff line change
@@ -1,23 +1,19 @@
package io.flutter.plugins;

import io.flutter.plugin.common.PluginRegistry;
import androidx.annotation.Keep;
import androidx.annotation.NonNull;
import io.flutter.Log;

import io.flutter.embedding.engine.FlutterEngine;

/**
* Generated file. Do not edit.
* This file is generated by the Flutter tool based on the
* plugins that support the Android platform.
*/
@Keep
public final class GeneratedPluginRegistrant {
public static void registerWith(PluginRegistry registry) {
if (alreadyRegisteredWith(registry)) {
return;
}
}

private static boolean alreadyRegisteredWith(PluginRegistry registry) {
final String key = GeneratedPluginRegistrant.class.getCanonicalName();
if (registry.hasPlugin(key)) {
return true;
}
registry.registrarFor(key);
return false;
private static final String TAG = "GeneratedPluginRegistrant";
public static void registerWith(@NonNull FlutterEngine flutterEngine) {
}
}
23 changes: 15 additions & 8 deletions example/lib/basic_example.dart
Original file line number Diff line number Diff line change
Expand Up @@ -81,16 +81,23 @@ class MyHomeState extends State<MyHomePage> {
TextButton(
key: const Key('changeLanguage'),
onPressed: () async {
final Locale? currentLang = FlutterI18n.currentLocale(context);
await FlutterI18n.refresh(context, currentLang!.languageCode == 'en' ? const Locale('it') : const Locale('en'));
final Locale? currentLang =
FlutterI18n.currentLocale(context);
await FlutterI18n.refresh(
context,
currentLang!.languageCode == 'en'
? const Locale('it')
: const Locale('en'));

ScaffoldMessenger.of(context).showSnackBar(SnackBar(
content: Text(FlutterI18n.translate(
context, "button.toastMessage")),
));
if (context.mounted) {
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
content: Text(FlutterI18n.translate(
context, "button.toastMessage")),
));
}
},
child: Text(
FlutterI18n.translate(context, "button.label.language")))
child: Text(FlutterI18n.translate(
context, "button.label.language")))
],
),
),
Expand Down
2 changes: 1 addition & 1 deletion example/lib/local_example.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class Test extends StatefulWidget {
final FlutterI18nDelegate flutterI18nDelegate;

@override
_TestState createState() => _TestState();
State<Test> createState() => _TestState();
}

class _TestState extends State<Test> {
Expand Down
Loading

0 comments on commit 3b0de0f

Please sign in to comment.