This simple module implements simple unicode-like object, which can contain multiple language mutation of one string. Actually it’s subclass of unicode type (for python 2k) / string type (for py3k) with few helping methods, that allow you to translate your string to another languages.
Here, I’ll show you some usage examples:
from locale import setlocale, LC_ALL
from mls import mls
setlocale(LC_ALL, "en_US.UTF-8") # Our system locale will be US english
empty = mls() # same as unicode, but
print(empty.language) # with .language attribute containing "en"
s = mls("Hello, world!")
t = s.translate_to("ru_RU", u"Здравствуй, мир!") # generate new ru-mutation
print(t.language) # => "ru"
print(t) # => "Здравствуй, мир!"
x = mls("Ahoj", language="cs") # czech mutation of "Hi"
x <<= "Nazdar" # Change translation to another
print(repr(x)) # => "cs'Nazdar'"
a = mls({"en": "Bye", "ru": u"Пока", "cs": u"Čau"})
print(a) # => "Bye"
b = a.translate_to("ru")
print(b) # => "Пока"
c = a >> "cs"
print(c) # => "Čau"
v = mls(en="Vodka", pl=u"Wódka", ru=u"Водка")
print(repr(v >> "pl")) # => "pl'W\xf3dka'"
print(repr(v >> "fr")) # => "fr'Vodka'" (no translation to french)
# Also you can use any unicode/str methods
print("world" in s) # => True
print(s[:5]) # => "Hello"
Metadata
Release files for mls 1.2.2
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 | |
|---|---|---|---|---|
| mls-1.2.2.tar.gz | 3.6 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mls-1.2.2-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
Total release size: 9.0 kB
Release files / mls-1.2.2.tar.gz
| Download URL | mls-1.2.2.tar.gz |
|---|---|
| Size | 3.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ab1d7f9bf21c7d3a86c3b88e342a36175b7fb3609aa22c15edc6e311aa0b2ed2
|
|
BLAKE2b-256 checksum How to use checksums |
eb6ec6305320e44abd20810dd8207900b65b3c5a78673e9fc2f1c8dc21269dd2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / mls-1.2.2-py2.py3-none-any.whl
| Download URL | mls-1.2.2-py2.py3-none-any.whl |
|---|---|
| Size | 5.4 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
7ad426c1d6613ba638a7e9a7e74fe29ed8aef71322b0118d30f24aa1af4b0ecf
|
|
BLAKE2b-256 checksum How to use checksums |
a95a86aac2366757487ebd2da2505716439b0ad07302f8714ba2719e3d5d67ac
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for mls 1.2.2
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.