← ClaudeAtlas

flutter-setup-localizationlisted

Add `flutter_localizations` and `intl` dependencies, enable "generate true" in `pubspec.yaml`, and create an `l10n.yaml` configuration file. Use when initializing localization support for a new Flutter project.
izo/Ulk · ★ 1 · Data & Documents · score 68
Install: claude install-skill izo/Ulk
# Internationalizing Flutter Applications ## Contents - [Core Concepts](#core-concepts) - [Setup Workflow](#setup-workflow) - [Implementation Workflow](#implementation-workflow) - [Advanced Formatting](#advanced-formatting) - [Examples](#examples) ## Core Concepts Flutter handles internationalization (i18n) and localization (l10n) via the `flutter_localizations` and `intl` packages. The standard approach uses App Resource Bundle (`.arb`) files to define localized strings, which are then compiled into a generated `AppLocalizations` class for type-safe access within the widget tree. ## Setup Workflow Copy and track this checklist when initializing internationalization in a Flutter project: - [ ] **Task Progress** - [ ] 1. Add dependencies to `pubspec.yaml`. - [ ] 2. Enable the `generate` flag. - [ ] 3. Create the `l10n.yaml` configuration file. - [ ] 4. Configure `MaterialApp` or `CupertinoApp`. ### 1. Add Dependencies Add the required localization packages to the project. Execute the following commands in the terminal: ```bash flutter pub add flutter_localizations --sdk=flutter flutter pub add intl:any ``` Verify your `pubspec.yaml` includes the following under `dependencies`: ```yaml dependencies: flutter: sdk: flutter flutter_localizations: sdk: flutter intl: any ``` ### 2. Enable Code Generation Open `pubspec.yaml` and enable the `generate` flag within the `flutter` section to automate localization tasks: ```yaml flutter: generate: true ```