Create multilingual interfaces for your tkinter applications.
tkinter-msgcat leverages Tk's msgcat to provide a per-instance message catalog which holds all the translations, while allowing them to be kept in separate files away from code.
tkinter-msgcat requires Python 3.7+
pip install tkinter-msgcat
✨ Getting Started
For storing the translation files I recommend this folder hierarchy:
project (or src/project) ├── __init__.py └── msgs ├── __init__.py ├── hi.msg └── mr.msg
This layout is recommended by Tcl.
Add some translations in the
.msgfiles, in this case
tcl ::msgcat::mcset hi "Hello" "नमस्ते"
Create a Tkinter window or instance, technically.
Let's put tkinter-msgcat into action!
```python from pathlib import Path from tkmsgcat import *
msgsdir = Path(file).parent / "msgs" load(msgsdir) locale("hi") get("Hello") # "नमस्ते" 🥳 ```
All contributions are welcome and acknowledged. Please read the contributor's guide.
The code in this project is released under the 3-Clause BSD License.