i18n for Kivy
Project description
kivy_garden.i18n
Internationalization support for Kivy applications.
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:
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file kivy_garden_i18n-0.3.0.tar.gz.
File metadata
- Download URL: kivy_garden_i18n-0.3.0.tar.gz
- Upload date:
- Size: 6.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
86b50a19ef4a70aa5eb157d616b8d8e80bd31596f396cdc20ed58f5d525bef4d
|
|
| MD5 |
9d9b42391f8eab7f7917adac746a026b
|
|
| BLAKE2b-256 |
b3637ad6279062d6dd97ed0a58504da2e093a9164d87cec78d78fa6e31818fac
|
Provenance
The following attestation bundles were made for kivy_garden_i18n-0.3.0.tar.gz:
Publisher:
release.yml on gottadiveintopython/i18n
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
kivy_garden_i18n-0.3.0.tar.gz -
Subject digest:
86b50a19ef4a70aa5eb157d616b8d8e80bd31596f396cdc20ed58f5d525bef4d - Sigstore transparency entry: 835858760
- Sigstore integration time:
-
Permalink:
gottadiveintopython/i18n@ceb40bf0071d91c5b255e62ec7bcd73067133be9 -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/gottadiveintopython
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@ceb40bf0071d91c5b255e62ec7bcd73067133be9 -
Trigger Event:
push
-
Statement type:
File details
Details for the file kivy_garden_i18n-0.3.0-py3-none-any.whl.
File metadata
- Download URL: kivy_garden_i18n-0.3.0-py3-none-any.whl
- Upload date:
- Size: 8.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d8ec351c40e32d82915453413ea90e8ee248837c53b74ca24417b22cf9b6039b
|
|
| MD5 |
64f3462120cd991972293b9b1bf835ff
|
|
| BLAKE2b-256 |
d46a1b0b0eb1114e60c79d7aa1767c5e3877c94036667f5ee95253657e08adad
|
Provenance
The following attestation bundles were made for kivy_garden_i18n-0.3.0-py3-none-any.whl:
Publisher:
release.yml on gottadiveintopython/i18n
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
kivy_garden_i18n-0.3.0-py3-none-any.whl -
Subject digest:
d8ec351c40e32d82915453413ea90e8ee248837c53b74ca24417b22cf9b6039b - Sigstore transparency entry: 835858768
- Sigstore integration time:
-
Permalink:
gottadiveintopython/i18n@ceb40bf0071d91c5b255e62ec7bcd73067133be9 -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/gottadiveintopython
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@ceb40bf0071d91c5b255e62ec7bcd73067133be9 -
Trigger Event:
push
-
Statement type: