Giter Site home page Giter Site logo

michaeldark / locale_emoji Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 0.0 44 KB

Convert 🌍 Locale (languageCode, scriptCode and countryCode) to the corresponding 🏳️ Emoji Flag 🏴.

Home Page: https://www.buymeacoffee.com/michaeldark

License: MIT License

Dart 100.00%
dart dart-library dart2 emoji emojify flutter flutter-apps flutter-package flutter-packages flutter-plugin

locale_emoji's Introduction

🏳️ Locale Emoji 🏴

pub package

Convert 🌍 Locale (language code, script code and country code) to the corresponding 🏳️ Emoji Flag 🏴.
Inspired from the JS locale-emoji package.

Features

  • πŸš€ Written in pure dart
  • 🎈 NO dependencies
  • πŸ“± Flutter package for Locale extension (locale_emoji_flutter)
  • ✨ Safe to use as much as it could be

Usage

import 'package:locale_emoji/locale_emoji.dart' as le;

//...

final flagDe = le.getFlagEmoji(countryCode: 'DE'); // πŸ‡©πŸ‡ͺ
final flagDe = le.getFlagEmoji(languageCode: 'de'); // πŸ‡©πŸ‡ͺ

final flagSk = le.getFlagEmoji(languageCode: 'sk'); // πŸ‡ΈπŸ‡°
final flagSk = le.getFlagEmoji(countryCode: 'SK'); // πŸ‡ΈπŸ‡°
final flagSk = le.getFlagEmoji(languageCode: 'sk', scriptCode: 'Latin', countryCode: 'SK'); // πŸ‡ΈπŸ‡°

Flutter

For flutter, use locale_emoji_flutter package instead.

import 'package:locale_emoji_flutter/locale_emoji_flutter.dart';

//...

final Locale localeDe = Locale('de');
final Locale localeSk = Locale.fromSubtags(
  languageCode: 'sk',
  scriptCode: 'Latin',
  countryCode: 'SK',
);

final flagDe = localeDe.flagEmoji; // πŸ‡©πŸ‡ͺ
final flagSk = localeSk.flagEmoji; // πŸ‡ΈπŸ‡°

Additional information

Defaults might be updated in the origin: cldr-core. In case of any updates in cldr-core, please, run the following command in the root of the repository and submit a PR.

dart tools/update_defaults.dart

Support

Buy Me A Coffee

locale_emoji's People

Contributors

michaeldark avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.