Fintasys / emoji_picker_flutter

A Flutter package that provides an Emoji picker widget with 1500+ emojis in 8 categories.
MIT License
170 stars 127 forks source link

Add language support for en, de, es, fr, hi, pt, it, ja, ru, zh and more #223

Closed Fintasys closed 2 weeks ago

Fintasys commented 3 weeks ago

closes: #203

Description

Usage

EmojiPicker(
         textEditingController: _controller,
         scrollController: _scrollController,
         config: Config(
             emojiSet: _getEmojiLocale,
        ),
)

List<CategoryEmoji> _getEmojiLocale(Locale locale) {
  switch (locale.languageCode) {
    case "ja":
      return emojiSetJapanese;
    case "de":
      return emojiSetGerman;
    default:
      return emojiSetEnglish;
  }
}
emavgl commented 3 weeks ago

About the usage: wouldn't be possible to pass just the Locale object and the library behind the hood fetch the correct set?

Fintasys commented 3 weeks ago

@emavgl It's possible but it would remove the possibility to users to add other languages by their own

emavgl commented 3 weeks ago

EmojiPicker( textEditingController: _controller, scrollController: _scrollController, config: Config( emojiSet: _getEmojiLocale(locale), ), )

I would still keep emojiSet so if the user wants to do some change, they are free to implement _getEmojiLocale(locale) or similar as they want to, in their app.

While in the library you already have the map Locale -> EmojiSet and you can easily achive something like

   config: Config(
       locale: userLocale;
  ),

Where userLocale is an https://api.flutter.dev/flutter/dart-ui/Locale-class.html

Fintasys commented 3 weeks ago

@emavgl Ah I get it. That's of course also a possibility, thx! I will think about it and make further changes once I got time 🙏

emavgl commented 3 weeks ago

Sure, thank you so much for your work!