A simple translator using Yaml
Project description
yaml-translator
A simple translator using Yaml
Usage
Create a translation file in your package.
your_package
your_package/__init__.py
your_package/translator/__init__.py
your_package/translator/en.yaml
your_package/translator/ko.yaml
your_package/translator/en.yaml file:
menu:
title: "Title"
subtitle: "{sub} Subtitle"
your_package/translator/ko.yaml file:
menu:
title: "제목"
subtitle: "소제목 {sub}"
- See "Installing Package Data" for how to add a yaml file to your deployment package.
Import package:
from yaml_translator import Translator
from your_package import translations
Create Translator instance:
t = Translator.from_module_dir(translations, "ko")
Get translated text:
t("menu.title")
t("menu.subtitle", sub="TEMP")
Change language code:
t.lang = "ko"
License
See the LICENSE file for details. In summary, yaml-translator is licensed under the MIT license.
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 Distributions
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 yaml_translator-1.0.1-py3-none-any.whl.
File metadata
- Download URL: yaml_translator-1.0.1-py3-none-any.whl
- Upload date:
- Size: 5.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
708f7c666c25963f540163aab42e36599c50229781f3e85f9dbd36b226400880
|
|
| MD5 |
5cb807b47d212ce163129dc165d07969
|
|
| BLAKE2b-256 |
06344210b28362fb7e5b7850aa0c9ea19ae9bcf11fac14814900f61c2fd76fc4
|