localize 0.0.4 icon indicating copy to clipboard operation
localize: ^0.0.4 copied to clipboard

Internationalizing Flutter apps

localize #

Internationalizing Flutter apps

Package supported 124 languages. Language code: ISO 639-1 standard language codes

Document online #


Usage #

  • Import: import 'package:localize/localize.dart';
  • Syntaxt: "your string".localize
  • Change Language: Translate().withDefaultLocale(LangCode.en);
  • Example:
import 'package:localize/localize.dart';

  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: Text(
      floatingActionButton: FloatingActionButton(
        onPressed: () {
            setState(() {
              if (Translate().langCode == LangCode.vi) {
              } else {
        tooltip: 'Change language',
        child: Icon(Icons.add),

Configuration #

Step 1: Create folder "assets/locales" in root project folder Step 2: Create file

  • Example:
    • For Vietnamese Language:
    "Login": "Đăng nhập",
    "Register": "Đăng ký",
    "Phone": "Số điện thoại",
    "Don't have an account? Register now!": "Không có tài khoảng? Đăng ký ngay!",
    "Password": "Mật khẩu"
- For English Language:
    "Login": "Login",
    "Register": "Register",
    "Phone": "Phone",
    "Don't have an account ? Register now!": "Don't have an account ? Register now!",
    "Password": "Password"

Step 4: In pubspec.yaml, add assets to your application, add an assets section, like this:

      - assets/locales/

Step 5: Write code in function void main like below:

void main() async {
  await Translate().withDefaultLocale(LangCode.vi);
  //true if allow
  await Translate().setAcceptMissingKey(false);
## Getting Started

This project is a starting point for a Dart
a library module containing code that can be shared easily across
multiple Flutter or Dart projects.

For help getting started with Flutter, view our 
[online documentation](https://flutter.dev/docs), which offers tutorials, 
samples, guidance on mobile development, and a full API reference.