Localize_and_translate

Flutter localization in easy steps
Alternatives To Localize_and_translate
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
Flutter Architecture Blueprints1,308
a year ago30mitDart
Flutter Architecture Blueprints is a project that introduces MVVM architecture and project structure approaches to developing Flutter apps.
Slidy780
a month ago95May 17, 20214apache-2.0Dart
CLI package manager and template for Flutter
Easy_localization68356a month ago85May 13, 2022165mitDart
Easy and Fast internationalizing your Flutter Apps
Flutter.cn404
5 days ago89otherDart
Flutter CN docs translation plan, get started from the wiki: https://github.com/cfug/flutter.cn/wiki
Flutter382
16 days ago4mitDart
A boilerplate project for Flutter using RiverPod, Dio, auto_route, Freezed and generated with very_good_cli
Flutter Translate342122 months ago43July 02, 20222otherDart
Flutter Translate is a fully featured localization / internationalization (i18n) library for Flutter.
Flutter_rounded_date_picker296
17 months ago18September 05, 202233otherDart
The Flutter plugin that help you can choose dates and years with rounded calendars and customizable themes.
Flutter_sheet_localization23912 years ago8June 09, 202119mitDart
Generate Flutter localization from a simple online Google Sheets.
Slang22159 days ago103May 22, 20228mitDart
Type-safe i18n solution for Flutter
Flutter_i18n1991213 months ago60June 08, 20225mitDart
I18n made easy, for Flutter!
Alternatives To Localize_and_translate
Select To Compare


Alternative Project Comparisons
Readme

localize_and_translate

Flutter localization in easy steps

Pub Example

Fork Star Watch

Screenshots

screenshot 1 screenshot 2

Tutorial

Video

Methods

Method Job
init() initialize things, before runApp()
'word'.tr() word translation - string extension
translate('word') word translation
translate('word',{"key":"value"}) word translation with replacement arguments
setNewLanguage(context,newLanguage:'en',restart: true, remember: true,) change language
isDirectionRTL() is Direction RTL check
currentLanguage Active language code
locale Active Locale
locals() Locales list
delegates Localization Delegates

Installation

  • add .json translation files as assets
  • For example : 'assets/lang/ar.json' | 'assets/lang/en.json'
  • structure should look like
{
    "appTitle": " ", 
    "buttonTitle": "English", 
    "textArea": "      "
}
  • define them as assets in pubspec.yaml
flutter:
  assets:
    - assets/lang/

Initialization

  • Add imports to main.dart
  • Make main() async and do the following
  • Ensure flutter activated WidgetsFlutterBinding.ensureInitialized()
  • Initialize await translator.init(); with neccassry parameters
  • Inside runApp() wrap entry class with LocalizedApp()
  • Note : make sure you define it's child into different place "NOT INSIDE"
import 'package:flutter/material.dart';
import 'package:localize_and_translate/localize_and_translate.dart';

main() async {
  // if your flutter > 1.7.8 :  ensure flutter activated
  WidgetsFlutterBinding.ensureInitialized();

  await translator.init(
    localeType: LocalizationDefaultType.device,
    languagesList: <String>['ar', 'en'],
    assetsDirectory: 'assets/lang/',
  );

  runApp(
    LocalizedApp(
      child: MyApp(),
    ),
  );
}
  • LocalizedApp() child example -> MaterialApp()
class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Home(),
      localizationsDelegates: translator.delegates, // Android + iOS Delegates
      locale: translator.locale, // Active locale
      supportedLocales: translator.locals(), // Locals list
    );
  }
}

Usage

  • use translate('appTitle')
  • use setNewLanguage(context, newLanguage: 'ar', remember: true, restart: true);

Example

Example

Contributors

Contributors List

Popular Localization Projects
Popular Flutter Projects
Popular Text Processing Categories
Related Searches

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.
Dart
Flutter
Translation
Localization
Translate
Flutter Plugin