Skip to main content

yaml-translator

PyPI PyPI - Python Version GitHub

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}"

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.

Metadata

Release files for yaml-translator 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for yaml-translator 1.0.1
File Interpreter ABI Platform
yaml_translator-1.0.1-py3-none-any.whl Python 3 none any Details

Release files / yaml_translator-1.0.1-py3-none-any.whl

Download URL yaml_translator-1.0.1-py3-none-any.whl
Size 5.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
708f7c666c25963f540163aab42e36599c50229781f3e85f9dbd36b226400880
BLAKE2b-256 checksum
How to use checksums
06344210b28362fb7e5b7850aa0c9ea19ae9bcf11fac14814900f61c2fd76fc4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.11

Security for yaml-translator 1.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

1.0.1 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page