Flutter devs, ever feel like you're stuck in a loop localization drudgery?
Fear not, weary coder! Even if you're not a Flutter master (yet!), this article will have you saying "I'm beginning to see the pattern...".
We all know Flutter is fast compared to native development (looking at you, Android Studio!), but buckle up because Flutter Mason is about to blow your development speed right out of the water. ️ This article will be your guide to the specific Flutter Mason trick that'll make ARB localization a breeze.
Localiz
As it's description mentioned "Ease and Speed up Internationalizing Flutter Apps" this brick integrate all the arb dependencies, configuration and arb files for you.
How ? 🤔
Alright, installation time! But before we dive in, here's a friendly reminder:
We've got two options for getting Mason and mason_cli on your machine. For the command-line cowboys,there's the classic
dart pub global activate mason_cli
.
But if you're a true programmer of culture (and a Homebrew user), you can unleash the power of
brew tap felangel/mason; brew install mason
.
Finally, the moment we've all been waiting for: installing the localiz brick.
You can do this locally with mason add localiz
or go full global dominance with mason add -g localiz
. The choice is yours, but choose wisely!
Use it
All you need to do now it to use it on your project
mason make localiz
this will trigger the brick, and it will ask you:
Choose language to include in your app?
◯ English (en)
◯ Arabic (ar)
◯ Chinese (zh-CN)
◯ Spanish (es)
◯ French (fr-FR)
it's a multiple selection so use the spacebar to select the languages you want to include when localizing your app
after this the brick will ask you which language of those you select it's the default and will act like the arb template reference.
That's it! Now you can high-five yourself, commit your changes, push it to the repo, mark your Jira ticket as "DONE" with the smug satisfaction of a champion.
The localiz brick takes care of everything: installing those pesky packages (intl, flutter_localizations), generating the l10n.yaml config file with your default language, and even creates the l10n folder within your lib directory pre-populated with all the languages you selected.
Basically, it saves you a ton of time on tedious setup, freeing you up to focus on the real coding magic. Because, let's be honest, life is way too short to be wrangling ARB files manually.
Top comments (0)