Skip to main content

Create multilingual interfaces for your tkinter applications

Project description

ci Tests Build Docs Coverage Status
pypi Version License Python Versions
qa security: bandit mypy: checked code style: black

tkinter-msgcat

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.

⏬ Installation

tkinter-msgcat requires Python 3.7+

pip install tkinter-msgcat

✨ Getting Started

  1. 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.

  2. Add some translations in the .msg files, in this case hi.msg:

    ::msgcat::mcset hi "Hello" "नमस्ते"
    
  3. Create a Tkinter window or instance, technically.

  4. Let's put tkinter-msgcat into action!

    from pathlib import Path
    from tkmsgcat import *
    
    msgsdir = Path(__file__).parent / "msgs"
    load(msgsdir)
    locale("hi")
    get("Hello")  # "नमस्ते" 🥳
    

🤝 Contributing

All contributions are welcome and acknowledged. Please read the contributor's guide.

© License

The code in this project is released under the 3-Clause BSD License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tkinter_msgcat-0.1.0.tar.gz (12.9 kB view hashes)

Uploaded Source

Built Distribution

tkinter_msgcat-0.1.0-py3-none-any.whl (7.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page