flutter-i18n-gen

Extract hard-coded Chinese strings from Flutter/Dart files and generate .tr keys.

Updated Apr 10, 2026
One-click install
npx skills add https://github.com/dus2183-commits/flutter-skills --skill flutter-i18n-gen
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: flutter-i18n-gen
Source: https://github.com/dus2183-commits/flutter-skills/tree/main/flutter-i18n-gen
Command: npx skills add https://github.com/dus2183-commits/flutter-skills --skill flutter-i18n-gen

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill scans code for hard-coded Chinese strings and automatically generates .tr keys and translation files, enabling smooth internationalization.

Core Features & Use Cases

  • Automated extraction of hard-coded Chinese literals into translation keys.
  • Key replacement: replaces Chinese literals with 'module.key'.tr references and updates locale files under lib/app/locales.
  • Module-aware: supports module-level key naming conventions and works with existing translation structure (zh_cn, en_us).
  • Use Case: Integrate into Flutter projects to quickly bootstrap multi-language support after UI generation.

Quick Start

Run the i18n-gen tool on your Flutter project to scan for Chinese strings and generate translation keys.

Frequently Asked Questions about flutter-i18n-gen

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I extract hard-coded Chinese strings for Flutter localization?

To extract hard-coded Chinese strings for Flutter localization, this skill scans Dart source code and automatically generates .tr translation keys. It replaces Chinese literals with 'module.key'.tr references and updates the corresponding locale files.

What's the best way to generate i18n translation keys from existing Dart source code?

The best way to generate i18n translation keys from Dart code is using an automated extraction tool. This skill scans your Flutter files, extracts Chinese literals, and replaces them with module-aware 'module.key'.tr references for smooth internationalization.

Does the Flutter i18n key generation work with my existing locale structure?

Yes, the Flutter i18n key generation works with your existing locale structure. It requires a pre-existing directory structure under lib/app/locales and follows your naming conventions to map keys to zh_cn and en_us translations.

How do I replace Chinese text with .tr references in a Flutter app?

To replace Chinese text with .tr references in a Flutter app, this skill scans your codebase for hard-coded Chinese literals. It then automatically substitutes the literals with 'module.key'.tr syntax and updates the locale files accordingly.

When should I not use automated translation key extraction for Flutter?

You should not use automated translation key extraction for Flutter if your project lacks the required lib/app/locales directory structure. The tool depends on existing locale files and naming conventions to correctly map and update zh_cn and en_us translations.

Can I bootstrap multi-language support in Flutter after UI generation?

Yes, you can bootstrap multi-language support in Flutter after UI generation. By running this i18n-gen tool, it scans newly generated UI code for Chinese strings and automatically produces the required translation keys and locale file updates.