
Security News
AGENTS.md Gains Traction as an Open Format for AI Coding Agents
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.
english | 中文
shiertier_i18n
is a simple internationalization (i18n) library for Python, designed to help developers easily localize their applications into different languages. The library is based on the gettext
module and supports automatic detection of language and localization directories from environment variables, providing a simple interface for translating strings.
You can install shiertier_i18n
via pip
:
pip install git+https://github.com/shiertier-utils/shiertier_i18n.git
Please note that this project is still under development.
First, you need to initialize the I18n
class:
from shiertier_i18n import I18n
# Using default language and localization directory
i18n = I18n()
# Or specify the language and localization directory
i18n = I18n(language_str='zh_CN', locales_dir='/path/to/locales')
You can use the translate
method to translate strings:
translated_str = i18n.translate("Hello, world!")
print(translated_str)
You can also pass a dictionary to replace placeholders in the translated string:
translated_str = i18n.translate("Hello, $$name$$!", replace_dict={'$$name$$': 'Alice'})
print(translated_str)
If you only need to quickly translate a string, you can use the easy_i18n
shortcut:
from shiertier_i18n import easy_i18n
translated_str = easy_i18n("Hello, world!")
print(translated_str)
By default, the I18n
class will get the language setting from the LANGUAGE
environment variable. If LANGUAGE
is not set, it defaults to en_US
.
You can also specify the language when initializing the I18n
class:
i18n = I18n(language_str='zh_CN')
By default, the I18n
class will get the localization directory from the SHIERTIER_LOCALES_DIR
environment variable. If SHIERTIER_LOCALES_DIR
is not set, it defaults to the .shiertier/locales
directory under the user's home directory.
You can also specify the localization directory when initializing the I18n
class:
i18n = I18n(locales_dir='/path/to/locales')
gettext
This project is released under the MIT License. See the LICENSE file for details.
FAQs
A simple internationalization (i18n) library for Python.
We found that shiertier-i18n demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.
Security News
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.