Metadata-Version: 2.4
Name: kivy-garden-i18n
Version: 0.3.0
Summary: i18n for Kivy
Keywords: kivy
Author: Nattōsai Mitō
Author-email: Nattōsai Mitō <flow4re2c@gmail.com>
License-Expression: MIT
Classifier: Development Status :: 4 - Beta
Classifier: License :: OSI Approved :: MIT License
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Software Development :: Libraries
Classifier: Operating System :: OS Independent
Requires-Python: >=3.10, <4.0
Project-URL: Repository, https://github.com/gottadiveintopython/i18n
Project-URL: Documentation, https://gottadiveintopython.github.io/i18n/
Description-Content-Type: text/markdown

# kivy_garden.i18n

Internationalization support for Kivy applications.

```python
from kivy_garden.i18n.localizer import MappingBasedTranslatorFactory, Localizer

translations = {
    "greeting": {
        "ja": "おはよう",
        "en": "morning",
    },
    "app title": {
        "ja": "初めてのKivyプログラム",
        "en": "My First Kivy App",
    },
}
localizer = Localizer(MappingBasedTranslatorFactory(translations))

l = localizer
l.lang = "en"  # Set the "current language" to "en"
assert l.font_name == "Roboto"
assert l._("greeting") == "morning"
assert l._("app title") == "My First Kivy App"

l.lang = "ja"
assert l.font_name == "<a pre-installed Japanese font>"
assert l._("greeting") == "おはよう"
assert l._("app title") == "初めてのKivyプログラム"
```

Bindings:

```python
from kivy.lang import Builder

localizer.install(name="l")
label = Builder.load_string("""
Label:
    font_name: l.font_name
    text: l._("greeting")
""")
localizer.lang = "en"
assert label.font_name == "Roboto"
assert label.text == "morning"
localizer.lang = "ja"
assert label.font_name == "<a pre-installed Japanese font>"
assert label.text == "おはよう"
```

# Installation

Pin the minor version.

```
pip install "kivy-garden-i18n>=0.3,<0.4"
```

# Tested on

- CPython 3.10 + Kivy 2.3
- CPython 3.11 + Kivy 2.3
- CPython 3.12 + Kivy 2.3
- CPython 3.13 + Kivy 2.3
