Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
A python package to easily translate po and pot files in any language supported by Google Translate.
.. image:: https://img.shields.io/pypi/v/potranslator.svg :target: https://pypi.python.org/pypi/potranslator :alt: Pypi Python Package Index Status
.. image:: https://img.shields.io/travis/SekouD/potranslator.svg :target: https://travis-ci.org/SekouD/potranslator :alt: Linux Continuous Integration Status
.. image:: https://ci.appveyor.com/api/projects/status/liecctj9hj0qwc7q/branch/master?svg=true :target: https://ci.appveyor.com/project/SekouD/potranslator :alt: Windows Continuous Integration Status
.. image:: https://readthedocs.org/projects/potranslator/badge/?version=latest :target: https://potranslator.readthedocs.io/en/latest/?badge=latest :alt: Documentation Status
.. image:: https://pyup.io/repos/github/SekouD/potranslator/shield.svg :target: https://pyup.io/repos/github/SekouD/potranslator/ :alt: Depedencies Update Status
.. image:: https://pyup.io/repos/github/SekouD/potranslator/python-3-shield.svg :target: https://pyup.io/repos/github/SekouD/potranslator/ :alt: Python 3 Readiness
.. image:: https://codecov.io/gh/SekouD/potranslator/branch/master/graph/badge.svg :target: https://codecov.io/gh/SekouD/potranslator. :alt: Code Coverage Status
.. image:: https://snyk.io/test/github/SekouD/potranslator/badge.svg?targetFile=requirements.txt :target: https://snyk.io/test/github/SekouD/potranslator?targetFile=requirements.txt :alt: Code Vulnerability Status
potranslator
is a package to easily translate po and pot files generated by Sphinx_ or other tools in any language supported by Google Translate.
potranslator
auto-detects the language in the original pot files and auto-translates the pot files into the supplied target languages.
The Command Line Interface of potranslator
and its documentation are based on sphinx-intl_.
Optional: supports the Transifex collaborative service to upload the auto-generated translations to transifex_ for collaborative corrections of the translations.
This section describes how to translate documents generated by Sphinx_ with the potranslator
command.
Create your document(s) by using Sphinx:
.. code-block:: console
$ sphinx-build -b html /path/to/docs path/to/docs/_build
Optionally add the settings to your conf.py
if you have one:
.. code-block:: python
locale_dirs = ['locale/'] #path is an example but this is the recommended path. gettext_compact = False #optional.
locale_dirs
is required and gettext_compact
is optional.
Extract the document's translatable messages into pot files (make sure you are in the folder containing make.bat
and Makefile
if you are on windows):
.. code-block:: console
$ make gettext
Translate/Update your documents in German and Japanese:
.. code-block:: console
$ potranslator update -p _build/gettext -l de -l ja
Done. You got these directories that contain po files with auto-translated entries:
.. code-block:: console
./locale/de/LC_MESSAGES/
./locale/ja/LC_MESSAGES/
Translate/Update your documents in Japanese, build the compiled mo files and generate the translated html documents:
Command line (for Unix systems):
.. code-block:: console
$ potranslator build
$ make -e SPHINXOPTS="-D language='ja'" html
Command line (for Windows cmd.exe):
.. code-block:: console
> set SPHINXOPTS=-D language=de
> potranslator build
> .\make.bat html
Command line (for PowerShell):
.. code-block:: console
> Set-Item env:SPHINXOPTS "-D language=de"
> potranslator build
> .\make.bat html
That's all!
These features need the transifex-client
_ library.
You need to use the tx
command to use the following features:
tx push -s
: push pot (translation catalogs) to transifex.tx pull -l ja
: pull po (translated catalogs) from transifex.Your transifex_ account if you want to upload/download po files from transifex.
external library: transifex-client
_
It is strongly recommended to use virtualenv for this procedure:
.. code-block:: console
$ pip install potranslator
If you want to use the Optional Features
_, you need install this additional library:
.. code-block:: console
$ pip install potranslator[transifex]
Type potranslator
without arguments to show the help instructions.
All command-line options can be set with environment variables using the format POTRANSLATOR_<UPPER_LONG_NAME> .
Dashes (-) have to replaced with underscores (_).
For example, to set the target languages:
.. code-block:: console
$ export POTRANSLATOR_LANGUAGE=de,ja
On the Windows command line:
.. code-block:: console
> set POTRANSLATOR_LANGUAGE=de,ja
This is the same as passing the option to potranslator directly:
.. code-block:: console
$ potranslator --language=de --language=ja
Add the following settings to your sphinx document's conf.py if it exists:
.. code-block:: python
locale_dirs = ['locale/'] #for example gettext_compact = False #optional
make gettext
will generate pot files into the _build/gettext
directory,
however pot files can be generated in the locale/pot
directory if convenient.
You can do that by replacing _build/gettext
with locale/pot
in your
Makefile
and/or make.bat
that was generated by sphinx-quickstart.
Licensed under the BSD license. See the LICENSE file for specific terms.
The Command Line Interface and the transifex_ integration of potranslator
are adapted from sphinx-intl_.
See: https://github.com/SekouD/potranslator/blob/master/HISTORY.rst
.. _Sphinx: http://sphinx-doc.org .. _sphinx-intl: https://pypi.org/project/sphinx-intl .. _transifex: https://transifex.com .. _transifex-client: https://pypi.python.org/pypi/transifex-client .. _setuptools: https://pypi.python.org/pypi/setuptools .. _six: https://pypi.python.org/pypi/six .. _babel: https://pypi.python.org/pypi/babel .. _click: https://pypi.python.org/pypi/click .. _googletrans: https://pypi.org/project/googletrans .. _polib: https://pypi.org/project/polib
FAQs
A python package to easily translate po and pot files in any language supported by Google Translate.
We found that potranslator 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.