Comments (3)
I have never used .potfile
but I think the best way is writing lua tables just like:
pt_br = {
["Sending message"] = "Enviando mensagem"
}
Then, in the code, call to a function like __("Sending message")
that will check if there is a translated
phrase for this one. Language could be configured inside data/config.lua
from telegram-bot.
I believe a more elaborated approach would be better, to handle cases where non positional arguments must be inserted on the string. An option would be i18n.lua, which can be added to our LuaRocks dependencies.
My suggestion is to load the translation files recursively from a folder, on load_config
. The path structure would be translations/<two-letter-language-code>/<scope>.lua
, where scope
is common
or the plugin name (this would make it easy to manage the strings). Once loaded, we can set the locale from a config and expose (it's not necessary, I believe) a method so a plugin could change it on the fly.
The project could be divided in phases: implementing i18n on the core (loading it, applying the config and the common strings); extracting the strings from plugins; translating the files.
from telegram-bot.
Nice way @JulioC but I dont have time now... 😢
from telegram-bot.
Related Issues (20)
- LICENSE error
- S
- Chat_id from a chat with an official API bot HOT 1
- URL Buttons example code HOT 3
- Copy message from other channel HOT 1
- Invalid Phone Number
- Update to a recent tg version HOT 2
- nayabdl HOT 1
- mohammad HOT 3
- بل HOT 1
- HSHNNNXXXJIIIIIISUWYHNNNXYSHDDFFFFHIOIIICOPSSPAAPCCDNEEEEEWW++63 00000SSS[[POG;L.F.F.F[SSSSSSSSSSSWWWGWSSEEEE
- Detect edited msgs HOT 2
- Pokedex not displaying Info - only image
- Is there a group requirement for the BOT? HOT 1
- Python.h fatal error HOT 2
- Crash after sending command in supergroups HOT 8
- ## HOT 1
- Run it as a daemon problem on Ubuntu 16.04 HOT 1
- translate.lua : Not Working.. Help in fixing please :(
- send caption under image
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from telegram-bot.