mymmrac / telego

Telegram Bot API library for Go
https://telego.pixelbox.dev
MIT License
553 stars 42 forks source link

Language codes #186

Closed defany closed 5 months ago

defany commented 5 months ago

⭐️ Feature description

Hello! I guess we need to replace Lang string fields with language codes from golang.org/x/text/language

It may be very helpful to avoid errors with language's constants

🌈 Your view

No response

🧐 Code example

No response

mymmrac commented 5 months ago

Interesting package, but I personally don't see much value in adding it into Telego simply because it doesn't have a good way to compare language tags (you still at the end of the day will need to compare strings) and it has a pretty good API to convert string into language.Tag using language.Make func (even no need to handle an error), so if you will have a use case for using this package it would be really easy to introduce it yourself.

For most of the cases (at least those I encountered) having LanguageCode as string is more convenient and easier to work with. Hence I am not going to add it.