Skip to content

Commit

Permalink
Coverall support
Browse files Browse the repository at this point in the history
  • Loading branch information
rembish committed Apr 13, 2015
1 parent 77f9b40 commit e4a58d1
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 21 deletions.
8 changes: 6 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,9 @@ python:
- "3.4"
- "nightly"
- "pypy"
install: "pip install six"
script: python setup.py test
install:
- pip install six coveralls
script:
coverage run --source=mls setup.py test
after_success:
coveralls
41 changes: 25 additions & 16 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
MultiLingualString for Python
=============================
MultiLingualString for Python (2k and 3k)
=========================================

This simple module contains simple unicode-like object, which can contain
.. image:: https://travis-ci.org/rembish/mls.svg?branch=master
:target: https://travis-ci.org/rembish/mls

.. image:: https://coveralls.io/repos/rembish/mls/badge.svg
:target: https://coveralls.io/r/rembish/mls

.. image:: https://pypip.in/download/mls/badge.svg
:target: https://pypi.python.org/pypi/mls

This simple module implements simple unicode-like object, which can contain
multiple language mutation of one string. Actually it's subclass of unicode
type with few helping methods, that allow you to translate your string to
another languages.
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::

Expand All @@ -14,28 +23,28 @@ Here, I'll show you some usage examples::
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"
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 # => "Здравствуй, мир!"
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'"
print(repr(x)) # => "cs'Nazdar'"

a = mls({"en": "Bye", "ru": u"Пока", "cs": u"Čau"})
print a # => "Bye"
print(a) # => "Bye"
b = a.translate_to("ru")
print b # => "Пока"
print(b) # => "Пока"
c = a >> "cs"
print c # => "Čau"
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)
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"
print("world" in s) # => True
print(s[:5]) # => "Hello"
7 changes: 7 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
python-mls (1.2.1ubuntu1) stable; urgency=medium

* README fixes.
* Coverall added.

-- Aleksey Rembish <alex@rembish.org> Mon, 13 Apr 2015 17:56:26 +0200

python-mls (1.2.1) stable; urgency=medium

* Fixing doctest for py3k.
Expand Down
4 changes: 2 additions & 2 deletions debian/rules
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/make -f
# export DH_VERBOSE=1
export PYBUILD_NAME = mls
export DH_VERBOSE=1
export PYBUILD_NAME=mls

%:
dh $@ --with python2,python3 --buildsystem=pybuild
2 changes: 2 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[wheel]
universal = 1
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

setup(
name="mls",
version="1.2.1",
version="1.2.2",
py_modules=["mls"],
url="https://github.com/rembish/mls",
license="BSD",
Expand Down

0 comments on commit e4a58d1

Please sign in to comment.