
Security News
Node.js Moves Toward Stable TypeScript Support with Amaro 1.0
Amaro 1.0 lays the groundwork for stable TypeScript support in Node.js, bringing official .ts loading closer to reality.
ResourceBundle is a module that manages internationalization of string resources.
ResourceBundle is a package that manages internationalization / localization (i18n / l10n) of string resources.
It is inspired by Java's ResourceBundle and accepts the same format as a Java PropertyResourceBundle
.
Note: ResourceBundle is not the pythonic way of internationalization / localization. This package is only intended to be used if you absolutely have to work with ResourceBundle files or need a quick working way when porting from Java.
For information on how to do internationalization in python, see the official documentation. You can use the
ResourceBundle.Converter.to_gettext()
method to convert your ResourceBundle files to gettextpo
files.
The ResourceBundle module can be downloaded from PyPI:
# Linux / macOS
$ python3 -m pip install ResourceBundle
# Windows
> py -m pip install ResourceBundle
Assuming you come from Java, you are probably familiar with the ResourceBundle file format. If not, you can read about it here.
Get a ResourceBundle instance is by using ResourceBundle.get_bundle(name, locale)
.
import ResourceBundle
bundle = ResourceBundle.get_bundle("Strings", "en")
# It is now possible to get a resource with the get() method
bundle.get("key")
If the key could not be found in the ResourceBundle the parent ResourceBundles will be searched
until a matching key was found.
If the key is not present in any of its parents a ResourceBundle.exceptions.NotInResourceBundleError
will be raised.
The ResourceBundle module can convert ResourceBundle files to gettext pot
/ po
files.
This can be done by using the ResourceBundle.Converter.to_gettext()
method.
from ResourceBundle import Converter
# convert all .properties files in the current directory to .po files
Converter.to_gettext(".", ".")
Note however that this step is obsolete if you are using gettext
properly
as this will include automatically extracting strings from your source code with the help of a library like
Babel with its pybabel tool.
The function is only intended as a head start to keep existing translations.
FAQs
ResourceBundle is a module that manages internationalization of string resources.
We found that ResourceBundle 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
Amaro 1.0 lays the groundwork for stable TypeScript support in Node.js, bringing official .ts loading closer to reality.
Research
A deceptive PyPI package posing as an Instagram growth tool collects user credentials and sends them to third-party bot services.
Product
Socket now supports pylock.toml, enabling secure, reproducible Python builds with advanced scanning and full alignment with PEP 751's new standard.