Queen support for localization in flutter

Related tags

Utilities nations
Overview

Nations ๐ŸŒ

test

Features

  • translation without context ๐Ÿš€
  • custom configuration
    • value not found builder
    • fallback locale
    • supported locales
    • fall back to base before loading the fallback
  • Translation files Loaders
    • json
    • dart
    • even Api or any data source ๐Ÿ˜Ž
  • Translation
    • Pluralization ๐Ÿ’ช
      • single count
      • range
      • to infinity
      • more the one number
    • Attributes
    • Nested translation 'validation.too_short' ๐Ÿ•ธ
    • Gender
      • Male
      • Female
      • Gender default set the gender once then it will be used every were else
  • App
    • auto RTL - LTR based on the current locale
    • reloading the app automatically ๐Ÿ”„
    • automatically save the last preferred language in the shared preferences ๐Ÿš€
  • public API
    • easily integrated with other packages to save more time and provided locaization out of the box base on your app configuration ๐Ÿ”ฅ
  • customization
    • easy to override the messages ๐Ÿ”ฑ
    • capitalize first character in the first word
    • capitalize first character in each word
  • other
    • support All Platforms โœ”
    • support Null-Safety โœ”

Nations Assets

this package contains translated message to use out of the box , no need to add them any more example

final message = 'login'.tr
log(message);

also you did't add login message in your assets and translate it to the your supported languages it will use the nation assets and gets you the correct translated message if the MaterialApp locale is arabic it will be ุชุณุฌูŠู„ ุงู„ุฏุฎูˆู„ and if the locale is English it will be Sign In any so on out of the box

does this means i can't override the login keyword ?

no the package will use the default values only if you don't have one in you assets so you can override it any time

does this package have a big data sets ? - Will This Make The App very big ?

no this package will contains the necessary and the common keywords sings use in Authentication , Validation , searching , Filtering , introductions , ...etc and will be added manually to choses carefully which means you gonna support more languages out of the box in the entire app

Usage

simple translation

you can use the .tr extension or tr() function directly

'key'.tr

Gender

Male

// male
'key'.trMale

Female

// male
'key'.trFemale

use the default gender

  /// * translate a text **AND** use the default gender
  'key'.gender

translation attributes

  'key'.args(args)

plural

  'key'.plural(count,args)

Package Integration Example with queen_validators

example

why make it like this ?

  • this will make packages takes control of the localization which will spare the developer of this responsibility
  • like when using a validation package for example the failure message should be automatically localized out of the box !
  • would this package prevent the developer to use custom translated messages ? No ,, it will only provide a default values in many languages out of the box !
  • would this increase the app size ? No , this will provide the necessary values only

attributes

which allows to customize the translated message

Example in validation : Arabic => "ุงู„ุญุฏ ุงู„ุงู‚ุตูŠ ู„ู„ุญุฑูˆู 255" English => "max length is 255"

255 is the max length and might changes some times is 255 or 55 or just 2 depend on the form how to achieve that in nations ?

"max_length_is":"max length is :count"

and in your code

final msg = 'max_length_is'.args({"count":255});

for now the generations is not done yet after we finish them no more String keys and dynamic parameters every thing will be hard type and stricter to avoid future bugs

Helpers

  • capitalizeFirstChar(String) to make the first word capital
  • capitalizeEachWord to make every word capital in one line more entire paragraph
  • numberToLocale(String,[Locale?]) localize numbers based on locale

Whats next ?

  • make sure tests cover every thing
  • logs base on the flavor
  • productivity - avoiding bugs
    • VsCode extension
      • Go to source
      • See the Translated keyword
      • add keyword to translations
    • CLI - Lighthouse ๐Ÿ’ก
      • lh make:locale generate api for translation files
      • lh locale:fix show bugs in the localization (same schema , duplicates , missing , same as the nation assets) ๐Ÿ” ๐Ÿ†•
      • lh locale:list show supported locales list
      • lh tr:shrink shrinking assets by removing useless spaces before building
      • code generation Tr.key and you will get the translated message directly ๐Ÿ†•
        • show gender API
        • show attributes API
        • show plural API
        • show nested API
You might also like...

A flutter utility to easily create flavors in your flutter application

Flutter Flavorizr A flutter utility to easily create flavors in your flutter application Getting Started Let's start by setting up our environment in

Jan 1, 2023

๐Ÿ”ฅFlutterFire is a set of Flutter plugins that enable Flutter apps to use Firebase services.

๐Ÿ”ฅFlutterFire is a set of Flutter plugins that enable Flutter apps to use Firebase services.

FlutterFire is a set of Flutter plugins that enable Flutter apps to use Firebase services. You can follow an example that shows how to use these plugins in the Firebase for Flutter codelab.

Jan 2, 2023

Ecosistema de paquetes para Dart y Flutter desarrollados y mantenidos por la comunidad de Flutter Cuba relacionados con la tienda cubana de aplicaciones para dispositivos Android llamada Apklis.

Ecosistema de paquetes para Dart y Flutter desarrollados y mantenidos por la comunidad de Flutter Cuba relacionados con la tienda cubana de aplicaciones para dispositivos Android llamada Apklis.

Ecosistema de paquetes para Dart y Flutter desarrollados y mantenidos por la comunidad de Flutter Cuba relacionados con la tienda cubana de aplicacion

Oct 24, 2022

UME is an in-app debug kits platform for Flutter. Produced by Flutter Infra team of ByteDance

UME is an in-app debug kits platform for Flutter. Produced by Flutter Infra team of ByteDance

flutter_ume English Flutter ๅบ”็”จๅ†…่ฐƒ่ฏ•ๅทฅๅ…ทๅนณๅฐ ๅฝ“ๅ‰็‰ˆๆœฌๅ†…็ฝฎ 10 ไธชๆ’ไปถ๏ผŒ ๅผ€ๅ‘่€…ๅฏไปฅๅˆ›ๅปบ่‡ชๅทฑ็š„ๆ’ไปถ๏ผŒๅนถ้›†ๆˆ่ฟ› UME ๅนณๅฐใ€‚ ่ฏฆ่งๆœฌๆ–‡ไธบ UME ๅผ€ๅ‘ๆ’ไปถ้ƒจๅˆ†ใ€‚ flutter_ume ๅฟซ้€ŸๆŽฅๅ…ฅ ็‰นๅˆซ่ฏดๆ˜Ž ๅŠŸ่ƒฝไป‹็ป ไธบ UME ๅผ€ๅ‘ๆ’ไปถ ็‰ˆๆœฌ่ฏดๆ˜Ž ๅ…ผๅฎนๆ€ง ๅ•ๆต‹่ฆ†็›–็Ž‡

Dec 30, 2022

An android application built using Flutter that computes the Body Mass Index of person and suggestion to carry ,by taking Inputs (Weight, Height, and Age), Built using Flutter

An android application built using Flutter that computes the Body Mass Index of person and suggestion to carry ,by taking Inputs (Weight, Height, and Age), Built using Flutter

BMI Calculator ๐Ÿ’ช Our Goal The objective of this tutorial is to look at how we can customise Flutter Widgets to achieve our own beautiful user interfa

Nov 2, 2022

The Coolicons icon pack for Flutter with over 400 icons available for your flutter project.

The Coolicons icon pack for Flutter with over 400 icons available for your flutter project.

coolicons This flutter package allows you to use the Coolicons icon pack. ๐ŸŽ– Installation In the dependencies: section of your pubspec.yaml, add the f

Oct 22, 2022

An extension to the Flutter SDK for building Flutter applications for Tizen devices.

An extension to the Flutter SDK for building Flutter applications for Tizen devices.

Flutter for Tizen An extension to the Flutter SDK for building Flutter applications for Tizen devices. Flutter and the related logo are trademarks of

Dec 16, 2022

Fluro is a Flutter routing library that adds flexible routing options like wildcards, named parameters and clear route definitions.

Fluro is a Flutter routing library that adds flexible routing options like wildcards, named parameters and clear route definitions.

Fluro is a Flutter routing library that adds flexible routing options like wildcards, named parameters and clear route definitions.

Jan 4, 2023

AOP for Flutter(Dart)

AOP for Flutter(Dart)

AspectD Salute to AspectJ. AspectD is an AOP(aspect oriented programming) framework for dart. Like other traditional aop framework, AspectD provides c

Jan 7, 2023
Releases(0.0.7)
Owner
Ahmed Masoud
jack of all trades is a master of SOME
Ahmed Masoud
Flutter localization example

?? Showcase ?? Installation โœ”๏ธ ํŒจํ‚ค์ง€ ์ถ”๊ฐ€ & ๋””๋ ‰ํ† ๋ฆฌ ์„ ์–ธ (pubspec.yaml) dependencies: easy_localization: ^3.0.0 # ํ˜„์ง€ํ™” flutter_phoenix: ^1.0.0 # ์•ฑ ์žฌ์‹œ์ž‘ flu

Mincheol Shin 0 May 21, 2022
Let's Encrypt support for the shelf package (free and automatic HTTPS certificate support).

shelf_letsencrypt shelf_letsencrypt brings support for Let's Encrypt to the shelf package. Usage To use the LetsEncrypt class import 'dart:io'; impor

Graciliano Monteiro Passos 8 Oct 31, 2022
Library for help you make userbot or bot telegram and support tdlib telegram database and only support nodejs dart and google-apps-script

To-Do telegram client dart โœ…๏ธ support multi token ( bot / userbot ) โœ…๏ธ support bot and userbot โœ…๏ธ support telegram-bot-api local server โœ…๏ธ support tel

Azka Full Snack Developer:) 73 Jan 7, 2023
The Dart Time Machine is a date and time library for Flutter, Web, and Server with support for timezones, calendars, cultures, formatting and parsing.

The Dart Time Machine is a date and time library for Flutter, Web, and Server with support for timezones, calendars, cultures, formatting and parsing.

null 2 Oct 8, 2021
Easy to use session wrapper that adds support to session storage and management in flutter.

flutter_session_manager Adds an easy to use wrapper to session management in flutter. Allows for easy session storage and management. The session pers

Eduardo Migueis 2 Feb 15, 2022
Flutter Map plugin for ArcGIS Esri. Currently support feature layer (point, polygon)

Flutter Map plugin for ArcGIS Esri Currently support feature layer(point, polygon, polyline coming soon) We are working on more features A Dart implem

Munkh-Altai 17 Nov 9, 2022
A generator to create config class from json files that support many environments

A generator to create config class from json files that support many environments. Motivation If you use a json file to config your applications, perp

Diego Cardenas 0 Oct 9, 2021
library to help you create database on local memory, support json local database inspired by lowdb

Licensed Licensed under the MIT License <http://opensource.org/licenses/MIT>. SPDX-License-Identifier: MIT Copyright (c) 2021 Azkadev <http://github.c

Azka Full Snack Developer:) 35 Oct 17, 2022
Flutter Version Management: A simple CLI to manage Flutter SDK versions.

fvm Flutter Version Management: A simple cli to manage Flutter SDK versions. FVM helps with the need for a consistent app builds by allowing to refere

Leo Farias 3.2k Jan 8, 2023