Localize and Internationalize Applications with Intl and the Flutter SDK in Dart's Flutter Framework
utopian-io·@tensor·
0.000 HBDLocalize and Internationalize Applications with Intl and the Flutter SDK in Dart's Flutter Framework
 #### What Will I Learn? - You will learn how to localize and internationalize Flutter applications - You will learn how to generate and use Intl classes and code - You will learn how to build and use ARB files for localization - You will learn about Location Delegates and how to make custom Location Delegates - You will learn how to Localize an API with Open Weather Map's API #### Requirements ##### System Requirements: - [IDEA intellij](https://www.jetbrains.com/idea/), [Visual Studio Code](https://code.visualstudio.com/) with the Dart/Flutter [Plugins](https://github.com/flutter/flutter-intellij), [Android Studio](https://developer.android.com/studio/index.html) or [Xcode](https://developer.apple.com/xcode/) - The [Flutter SDK](https://flutter.io/get-started/install/) on the latest Master Build - An Android or iOS Emulator or device for testing ##### OS Support for Flutter: - Windows 7 SP1 or later (64-bit) - macOS (64-bit) - Linux (64-bit) #### Required Knowledge - A basic knowledge of localization - A fair understanding of Mobile development and Imperative or Object Oriented Programming - Basic knowledge of how to read JSON-like data or ARB data #### Resources for Flutter and this Project: - Flutter Website: https://flutter.io/ - Flutter Official Documentation: https://flutter.io/docs/ - Flutter Installation Information: https://flutter.io/get-started/install/ - Flutter GitHub repository: https://github.com/flutter/flutter - Flutter Dart 2 Preview Information: https://github.com/flutter/flutter/wiki/Trying-the-preview-of-Dart-2-in-Flutter - Flutter Technical Overview: https://flutter.io/technical-overview/ - Dart Website: https://www.dartlang.org/ - Open Weather Map Website: https://openweathermap.org/ - Flutter Awesome GitHub Repository: https://github.com/Solido/awesome-flutter #### Sources: Flutter Logo (Google): https://flutter.io/ #### Difficulty - Intermediate #### Description In this tutorial, we look at some of the ways that we can **localize and internationalize** a Flutter Application. We do this by making use of the **Weather Application** that was built in past tutorials. We are able to localize the **API requests** and some of the **Assets** in the application using the **Flutter SDK and the INTL plugin**. #### Outline and Overview **Localization** is a fairly important concept for mobile applications. It allows the developer to deploy their application to more markets and it allows users to feel more comfortable using the application. Localization can let your application target and adapt to various cultures and areas of the world in a way that is seamless. In flutter, localization is fairly non-invasive and streamlined, however, it is hidden behind a few bits of **code generation**. ##### Outline for this Tutorial ##### Item 1: Localizaton with l10n The **l10n localization convention** is a popular way to implement localization in applications. In Dart, there are multiple different libraries that can be used to localize your applications. In Flutter, many of these libraries are baked directly into the **SDK** which provides a certain amount of **ease of use** for the developer. The **Intl plugin** and the **flutter localization plugin** are the two main plugins featured in the flutter framework. **Localization in Flutter** is done by way of widgets; more specifically **inherited widgets**.  Above you can see the main custom delegate implemented in our application. This delegate follows a pattern that is very similar to a typical **inherited widget**. We use an `of` method to proliferate the data that is inside of the localization class into the rest of our application just like you would with an inherited widget. The main difference is that the **material application widget** has properties that were designed to automatically interface with this type of widget. ##### Item 2: Generating ARB and Code with Intl and Intl translation We can generate our initial **ARB files** after creating the skeleton for the localization class. Once we've defined the **getter methods** for the values that we wish to localize; we can then run a build command to generate a main template file. The syntax of these files looks like **JSON** and it makes use of a **Key/Value pair** system to allow for easy lookup and use.  Here we have the main `intl_messages.arb` file. This is a fully generated file that allows us to create the **ARB files** that will be used to generate the boilerplate Dart code. You can see the two different **Key/Value pairs** as well as the associated **meta-data** . This **meta-data** allows other developers understand the initial intention of these **ARB files** and makes it easy for translators to understand the context of the attached assets. #### Item 3: Flutter's Builtin Localization Delegate Classes The **Architects of the Flutter Framework** chose to create more general delegate classes that can be used to add in **common localization features** to the application. The two main **Localization Delegate** classes provided in the flutter SDK are the **Global Material Localizations Delegate** and the **Global Widgets Localizations Delegate**. The **Global Material Localizations Delegate** automatically localizes any text or assets that are naturally a part of the widgets in the standard library. This includes pictures and text which have been incorporated into the widget library. The **Global Widgets Localizations Delegate** is responsible for adjusting the screen orientation of assets during localization. This includes changing text orientation from left to right to right to left depending on the language set.  Here you can see the **Localizations Delegates** property for the **Material Application widget**. In this property we have the **Custom Delegate** as well as the **two primary default delegates**. Just by placing the delegates into this list, we are able to receive the benefits from their features. Both of the general delegates have built in support for fifteen different locales and languages. Also, because the localization features are fed into the top of the application's widget tree; flutter is able to quickly and dynamically change the localization of the application. #### Project GitHub Repository: The Source Code for this project can be found [here](https://github.com/tensor-programming/Weather_Tutorial) #### Commands Used: Intl Commands used in this tutorial can be found [here](https://gist.github.com/tensor-programming/d53e7da4a609cef640881ca30dbf3982) #### Video Tutorial <iframe width="560" height="315" src="https://www.youtube.com/embed/IhsHGJEOSYM" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe> #### Projects and Series > #### Related Videos > - [Building a Weather Application with Dart's Flutter Framework (Part 1, Handling Complex JSON with Built Code Generation)](https://utopian.io/u/44612250) > - [Building a Weather Application with Dart's Flutter Framework (Part 2, Creating a Repository and Model)](https://utopian.io/u/44918839) > - [Building a Weather Application with Dart's Flutter Framework (Part 3, RxCommand (RxDart) and Adding an Inherited Widget)](https://utopian.io/u/45106441) > - [Building a Weather Application with Dart's Flutter Framework (Part 4, Using RxWidget to Build a Reactive User Interface)](https://utopian.io/u/45277762) > ##### Stand Alone Projects: > - [Dart Flutter Cross Platform Chat Application Tutorial](https://steemit.com/@tensor/dart-flutter-cross-platform-chat-application-tutorial) > - [Building a Temperature Conversion Application using Dart's Flutter Framework](https://utopian.io/u/38673252) > - [Managing State with Flutter Flux and Building a Crypto Tracker Application with Dart's Flutter Framework](https://utopian.io/u/43961141) > ##### Building a Calculator > - [Building a Calculator Layout using Dart's Flutter Framework](https://utopian.io/u/39348292) > - [Finishing our Calculator Application with Dart's Flutter Framework](https://utopian.io/u/39522895) > ##### Movie Searcher Application > - [Building a Movie Searcher with RxDart and SQLite in Dart's Flutter Framework (Part 1)](https://utopian.io/u/41053969) > - [Building a Movie Searcher with RxDart and SQLite in Dart's Flutter Framework (Part 2)](https://utopian.io/u/41208913) > - [Building a Movie Searcher with RxDart and SQLite in Dart's Flutter Framework (Part 3, Final)](https://utopian.io/u/41384278) > #### Minesweeper Game > - [Building a Mine Sweeper Game using Dart's Flutter Framework (Part 1)](https://utopian.io/u/42282888) > - [Building a Mine Sweeper Game using Dart's Flutter Framework (Part 2)](https://utopian.io/u/42433127) > - [Building a Mine Sweeper Game using Dart's Flutter Framework (Part 3)](https://utopian.io/u/42568713) > - [Building a Mine Sweeper Game using Dart's Flutter Framework (Part 4, Final)](https://utopian.io/u/42697072) #### Curriculum - [Building a Multi-Page Application with Dart's Flutter Mobile Framework](https://utopian.io/u/36304896) - [Making Http requests and Using Json in Dart's Flutter Framework](https://utopian.io/u/36711012) - [Building Dynamic Lists with Streams in Dart's Flutter Framework](https://utopian.io/u/36947451) - [Using GridView, Tabs, and Steppers in Dart's Flutter Framework](https://utopian.io/u/37160274) - [Using Global Keys to get State and Validate Input in Dart's Flutter Framework](https://utopian.io/u/37555657) - [The Basics of Animation with Dart's Flutter Framework](https://utopian.io/u/37731908) - [Advanced Physics Based Animations in Dart's Flutter Framework](https://utopian.io/u/38077640) - [Building a Drag and Drop Application with Dart's Flutter Framework](https://utopian.io/u/38246831) - [Building a Hero Animation and an Application Drawer in Dart's Flutter Framework](https://utopian.io/u/38433382) - [Using Inherited Widgets and Gesture Detectors in Dart's Flutter Framework](https://utopian.io/u/38862139) - [Using Gradients, Fractional Offsets, Page Views and Other Widgets in Dart's Flutter Framework](https://utopian.io/u/39001452) - [Making use of Shared Preferences, Flex Widgets and Dismissibles with Dart's Flutter framework](https://utopian.io/u/39694109) - [Using the Different Style Widgets and Properties in Dart's Flutter Framework](https://utopian.io/u/39890067) - [Composing Animations and Chaining Animations in Dart's Flutter Framework](https://utopian.io/u/40065925) - [Building a Countdown Timer with a Custom Painter and Animations in Dart's Flutter Framework](https://utopian.io/u/40384708) - [Reading and Writing Data and Files with Path Provider using Dart's Flutter Framework](https://utopian.io/u/40536227) - [Exploring Webviews and the Url Launcher Plugin in Dart's Flutter Framework](https://utopian.io/u/40707081) - [Adding a Real-time Database to a Flutter application with Firebase](https://utopian.io/u/41791441) - [Building a List in Redux with Dart's Flutter Framework](https://utopian.io/u/41963715) - [Managing State with the Scoped Model Pattern in Dart's Flutter Framework](https://utopian.io/u/42126946) - [Authenticating Guest Users for Firebase using Dart's Flutter Framework](https://utopian.io/u/43164921) - [How to Monetize Your Flutter Applications Using Admob](https://utopian.io/u/43345353) - [Using Geolocator to Communicate with the GPS and Build a Map in Dart's Flutter Framework](https://utopian.io/u/43502503) - [Managing the App Life Cycle and the Screen Orientation in Dart's Flutter Framework](https://utopian.io/u/43654354) - [Making use of General Utility Libraries for Dart's Flutter Framework](https://utopian.io/u/44131554) - [Interfacing with Websockets and Streams in Dart's Flutter Framework](https://utopian.io/u/44306750) - [Playing Local, Network and YouTube Videos with the Video Player Plugin in Dart's Flutter Framework](https://utopian.io/u/45623138) <br /><hr/><em>Posted on <a href="https://utopian.io/utopian-io/@tensor/localize-and-internationalize-applications-with-intl-and-the-flutter-sdk-in-dart-s-flutter-framework">Utopian.io - Rewarding Open Source Contributors</a></em><hr/>
👍 jinzo, ubg, awesome-gadgets, freyman, edgarf1979, piaristmonk, opaulo, sbi2, lockout, rantar, luoq, maxpatternman, patternbot, estronitex, qurator-tier-1-2, polbot, clayjohn, loshcat, greenorange, supreme-verdict, alphacore, skybreaker, thegrandestine, lilith, audiosiren, the-reaper, kittenpics, mobbs, buckydurddle, mirkosche, javicuesta, steemstem, lemouth, anarchyhasnogods, robotics101, rionpistorius, felixrodriguez, simplifylife, erodedthoughts, enzor, sco, adetola, mittymartz, hadji, de-stem, derbesserwisser, temitayo-pelumi, justtryme90, mountain.phil28, deutsch-boost, biomimi, lafona-miner, fredrikaa, borislavzlatanov, abigail-dantes, thevenusproject, the-devil, dysfunctional, foundation, himal, dna-replication, curie, liberosist, meerkat, locikll, ksolymosi, leczy, markangeltrueman, tantawi, howtostartablog, gabox, chimtivers96, lamouthe, hendrikdegrote, slickhustler007, esaia.mystic, anwenbaumeister, skycae, rachelsmantra, pacokam8, ertwro, vadimlasca, nitesh9, chillingotter, sethroot, mahdiyari, kerriknox, juanjdiaz89, bobdos, jamhuery, mathowl, kushed, saunter-pl, victorcovrig, clweeks, steem-hikers, misterakpan, mountainjewel, ghostgtr, steem.curator, ewuoso, zeeshan003, pharesim, pangoli, gra, physics.benjamin, sakura1012, positiveninja, serylt, alexdory, nedspeaks, infinitelearning, rjbauer85, chloroform, ugonma, kryzsec, dexterdev, akeelsingh, suravsingh, whileponderin, amavi, dber, imamalkimas, gentleshaid, blessing97, kenadis, carloserp-2000, wdoutjah, michelios, spederson, thinknzombie, massivevibration, onartbali, benleemusic, ntowl, thinkingmind, torico, coloringiship, bennettitalia, aamin, apteacher, vanessahampton, alinabarbu, mrcalxy, hsynterkr, arcjen02, mikefrancis, hmayak, utopian-io, fasusi, irza, tibra,