easy_locale 0.0.12 copy "easy_locale: ^0.0.12" to clipboard
easy_locale: ^0.0.12 copied to clipboard

Easy localization & internationalization (i18n) library.

example/lib/main.dart

import 'package:easy_locale/easy_locale.dart';
import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      home: MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key});

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  void initState() {
    super.initState();
    lo.init();
  }

  @override
  Widget build(BuildContext context) {
    lo.set(key: 'home title', locale: 'ko', value: '다국어 설정');
    lo.merge({
      'test': {
        'en': 'Test',
        'ko': '테스트',
      },
    });
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
        title: Text('home title'.t),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            Text(
              'test'.t,
            ),
          ],
        ),
      ),
    );
  }
}
1
likes
140
points
685
downloads

Publisher

verified publishersonub.com

Weekly Downloads

Easy localization & internationalization (i18n) library.

Homepage
Repository (GitHub)
View/report issues

Topics

#locale #i18n #localization #easy-packages

Documentation

API reference

License

MIT (license)

Dependencies

devicelocale, flutter

More

Packages that depend on easy_locale