sangfor_trans: Free sangfor translate for Python
python 3.4+ python 2.7+
Quickstart
You can install it from PyPI:
code: bash
$ pip install sangfor_trans
or manual install:
code: bash
$ python setup.py install
single sentence translation
code: python
>>> from sangfor_trans import get_translate
>>> from sangfor_trans.config import GOOGLE, BAIDU
>>> translator = get_translate.GetTranslator(GOOGLE)
>>> translator.translate("auto", "zh", "hello world. \n this is my book")
u'你好,世界。这是我的书'
support language
.. code::
'afrikaans': 'af',
'arabic': 'ar',
'belarusian': 'be',
'bulgarian': 'bg',
'catalan': 'ca',
'czech': 'cs',
'welsh': 'cy',
'danish': 'da',
'german': 'de',
'greek': 'el',
'english': 'en',
'esperanto': 'eo',
'spanish': 'es',
'estonian': 'et',
'persian': 'fa',
'finnish': 'fi',
'french': 'fr',
'irish': 'ga',
'galician': 'gl',
'hindi': 'hi',
'croatian': 'hr',
'hungarian': 'hu',
'indonesian': 'id',
'icelandic': 'is',
'italian': 'it',
'hebrew': 'iw',
'japanese': 'ja',
'korean': 'ko',
'latin': 'la',
'lithuanian': 'lt',
'latvian': 'lv',
'macedonian': 'mk',
'malay': 'ms',
'maltese': 'mt',
'chinese_simplified': 'zh-CN',
'chinese_traditional': 'zh-TW',
'auto': 'auto'
How to make python third-party library and upload to PyPi
step1: python setup.py sdist
step2: pip install twine
step3: we need to register an account on PyPI and create a file ~/.pypirc in the local user root directory(windows: the .pypirc file is in C:\Users\sangfor), so that we don't need to enter the account password in the future.
[distutils]
index-servers=pypi
[pypi]
repository = https://upload.pypi.org/legacy/
username = <username>
password = <password>
step4: Next comes the last step, uploading packaged libraries. We use twine here. If there is no installation in the environment, we need to use PIP install twine to install it first.
twine upload dist/*
End: At this point, you can see your own source code package on the web page, and you can use our own Python library by using PIP install package name.
Metadata
Release files for sangfor-trans 0.1.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| sangfor_trans-0.1.5.tar.gz | 11.7 kB | Without provenance | Details for sangfor_trans-0.1.5.tar.gz |
Release files / sangfor_trans-0.1.5.tar.gz
| Download URL | sangfor_trans-0.1.5.tar.gz |
|---|---|
| Size | 11.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
063afd2083e552f5769460278a1c451025c76fa1084f884c0aa791de11e17a66
|
|
BLAKE2b-256 checksum How to use checksums |
2f7a15c5fcb078b01777d4ec62dd57b8ba24a71721a11a0066574e864ecbb592
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/2.7.12
|
Security for sangfor-trans 0.1.5
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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.