Viewing version 0.0.3. Open the latest package page.

flutter_i18n

0.0.3

i18n made easy for Flutter. With flutter_i18n you can make your app international, using just a simple .json file!

Download archive

Readme

flutter_i18n

I18n made easy, for Flutter!


Why you should use flutter_i18n?

The main goal of flutter_i18n is to simplify the i18n process in Flutter. I would like to recreate the same experience that you have with the Angular i18n: simple json files, one for each language that you want to support.

Configuration

To use this library, you must create in your project's root the following subfolders:

/assets/flutter_i18n

and put inside them the json related to the translation, using the following configuration:

  • If you want to specify the country code

    /assets/flutter_i18n/{languageCode}_{countryCode}.json

  • otherwise

    /assets/flutter_i18n/{languageCode}.json

Of course, you must declare the subtree in your pubspec.yaml as assets:

flutter:
  assets:
    - assets/flutter_i18n/

The next step consist in the configuration of the localizationsDelegates; to use flutter_i18n, you should configure as follows:

localizationsDelegates: [
        FlutterI18nDelegate(useCountryCode),
        GlobalMaterialLocalizations.delegate,
        GlobalWidgetsLocalizations.delegate
],

The useCountryCode parameter depends on the json configuration:

  • if you used the pattern {languageCode}_{countryCode}, useCountryCode must be true
  • if you used the pattern {languageCode}, useCountryCode must be false

flutter_i18n in action

After the configuration steps, the only thing to do is invoke the following method:

FlutterI18n.translate(buildContext, "your.key")

Where:

  • buildContext is the BuildContext instance of the widget
  • your.key is the key to translate
Changelog

[0.0.1] - TODO: Add release date.

  • TODO: Describe initial release.

Installing

export PUB_HOSTED_URL=https://pub.mirror.p-hatan.ir
flutter pub add 'flutter_i18n:0.0.3'
pubspec.yaml
name: flutter_i18n
description: i18n made easy for Flutter. With flutter_i18n you can make your app international, using just a simple .json file!
version: 0.0.3
author: Matteo Pietro Dazzi <matteopietro.dazzi@gmail.com>
homepage: https://github.com/ilteoood/flutter_i18n

dependencies:
  flutter:
    sdk: flutter
  flutter_localizations:
    sdk: flutter

dev_dependencies:
  flutter_test:
    sdk: flutter

environment:
  sdk: '>=1.19.0 <3.0.0'

Version history

VersionPublishedArchiveSHA-256
0.0.1Cached · Upstream SHA-256 matchedDownloadbc62ed0c…6b4262
0.0.2Cached · Upstream SHA-256 matchedDownload53d2a591…76baee
0.0.3Cached · Upstream SHA-256 matchedDownload4f262b0d…c3d320
0.1.0Cached · Upstream SHA-256 matchedDownloadc8a7e81b…80768b
0.2.0Cached · Upstream SHA-256 matchedDownload74c6b69c…045ed4
0.3.0Cached · Upstream SHA-256 matchedDownload4eba6520…f1c244
0.4.0Cached · Upstream SHA-256 matchedDownload32557618…ba7775
0.5.0Cached · Upstream SHA-256 matchedDownload2b118d26…b206e5
0.5.1Cached · Upstream SHA-256 matchedDownload7cfdec9f…4888b4
0.5.2Cached · Upstream SHA-256 matchedDownloade3fcf081…0ebfcc
0.6.0Cached · Upstream SHA-256 matchedDownload65c9167c…f84f62
0.6.1Cached · Upstream SHA-256 matchedDownloadde342cf3…7fb15e
0.6.2Cached · Upstream SHA-256 matchedDownload620a8242…5d4929
0.6.3Cached · Upstream SHA-256 matchedDownload95d2ec26…a2f65e
0.6.4Cached · Upstream SHA-256 matchedDownload9b0231b6…0f9de4
0.7.0Cached · Upstream SHA-256 matchedDownload4e21b4d8…850d78
0.8.0Cached · Upstream SHA-256 matchedDownload88a9bab0…622bff
0.8.1Cached · Upstream SHA-256 matchedDownload61dc2387…9d4a4c
0.8.2Cached · Upstream SHA-256 matchedDownload4f1217f1…a0305c
0.8.3Cached · Upstream SHA-256 matchedDownload411807a5…403fd6
0.9.0Cached · Upstream SHA-256 matchedDownload84b7bb76…6f1f2e
0.10.0Cached · Upstream SHA-256 matchedDownload79bb2c69…9b5f61
0.10.1Cached · Upstream SHA-256 matchedDownloadf862efcd…113a8d
0.11.0Cached · Upstream SHA-256 matchedDownload575ab368…85f14d
0.11.1Cached · Upstream SHA-256 matchedDownload5ea04898…f7e32e
0.12.0Cached · Upstream SHA-256 matchedDownload8b93a285…d0bc7e
0.13.0Cached · Upstream SHA-256 matchedDownloadc6391b80…6c927c
0.13.1Cached · Upstream SHA-256 matchedDownloadc48f9f5e…8b6bd5
0.13.2Cached · Upstream SHA-256 matchedDownloadfb23273a…6f6aea
0.14.0Cached · Upstream SHA-256 matchedDownload8eda74b3…23c255
0.15.0Cached · Upstream SHA-256 matchedDownload0b8452f6…b81b80
0.16.0Cached · Upstream SHA-256 matchedDownload3821b4a2…d770cb
0.16.1Cached · Upstream SHA-256 matchedDownload92d94b69…79e702
0.16.2Cached · Upstream SHA-256 matchedDownloada1578783…e42e4d
0.16.3Cached · Upstream SHA-256 matchedDownload480a953b…17aeab
0.17.0Cached · Upstream SHA-256 matchedDownloade087afc1…5858bc
0.18.0Cached · Upstream SHA-256 matchedDownloadd1659c8b…4d2f18
0.19.0Cached · Upstream SHA-256 matchedDownloadfa476f0a…79426c
0.19.1Cached · Upstream SHA-256 matchedDownloadf0a5815e…cac246
0.19.2Cached · Upstream SHA-256 matchedDownload6ec2e77e…199745
0.19.3Cached · Upstream SHA-256 matchedDownload548e327f…b56326
0.19.4Cached · Upstream SHA-256 matchedDownload9532ebbc…6e732e
0.20.0Cached · Upstream SHA-256 matchedDownloadecef39ae…defb5b
0.20.1Cached · Upstream SHA-256 matchedDownload9b1507fd…d995fa
0.21.0-intl.nullsafetyCached · Upstream SHA-256 matchedDownload3baaed18…dbd00a
0.21.0Cached · Upstream SHA-256 matchedDownload5322101a…054f68
0.21.1Cached · Upstream SHA-256 matchedDownload139750e7…51ea63
0.22.0Cached · Upstream SHA-256 matchedDownload9f2455cc…cabd5a
0.22.1Cached · Upstream SHA-256 matchedDownload0ff3150a…420d8c
0.22.2Cached · Upstream SHA-256 matchedDownload4bf68422…75d59b
0.22.3Cached · Upstream SHA-256 matchedDownload94aed869…20f07b
0.22.4Cached · Upstream SHA-256 matchedDownloadae96d3f6…33d5ad
0.30.0Cached · Upstream SHA-256 matchedDownload5f2203e5…1b5418
0.31.0Cached · Upstream SHA-256 matchedDownload454d2c4e…56810d
0.31.1Cached · Upstream SHA-256 matchedDownload3dc20ca9…4ebcf8
0.32.0Cached · Upstream SHA-256 matchedDownload3f498993…ddc25b
0.32.1Cached · Upstream SHA-256 matchedDownloadd0dbf49b…6bac44
0.32.2Cached · Upstream SHA-256 matchedDownload3eeb3d57…69725c
0.32.3Cached · Upstream SHA-256 matchedDownload143b397a…58d269
0.32.4Cached · Upstream SHA-256 matchedDownload5f453b25…25af66
0.33.0Cached · Upstream SHA-256 matchedDownloadb71fe887…f20363
0.34.0Cached · Upstream SHA-256 matchedDownloadc7e9752c…b29636
0.35.0Cached · Upstream SHA-256 matchedDownload091af697…bdcfa6
0.35.1Cached · Upstream SHA-256 matchedDownloadc823a9c9…05f1c2
0.36.0Cached · Upstream SHA-256 matchedDownload0e88d479…ec5062
0.36.1Cached · Upstream SHA-256 matchedDownloadeed5e5d2…4663bc
0.36.2Cached · Upstream SHA-256 matchedDownload37334bfa…44be46
0.36.3Cached · Upstream SHA-256 matchedDownloadfe2bd740…66570c
0.37.0Cached · Upstream SHA-256 matchedDownload9c2e4cbf…9f56b8
0.37.1Cached · Upstream SHA-256 matchedDownloadaf7d625e…7bd9b6

Dependencies

flutter { "sdk": "flutter" }

flutter_localizations { "sdk": "flutter" }