Skip to content

Commit

Permalink
updated readme, documentation and setup.py
Browse files Browse the repository at this point in the history
  • Loading branch information
alchrabas committed Dec 18, 2015
1 parent 2afaa8a commit fdc33a4
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ What is it not for?
-------------------

| All advanced features are optional, but it's surely not intended to be used when:
| - you are sure you don't need anything except literal text i18n
| - you are sure you don't need anything except literal text i18n
| - you'd like to use it as a templating engine
| - you'd like to make some lexical analysis
| - you'd like to create a natural language generator or a chatterbot
Expand Down Expand Up @@ -310,7 +310,7 @@ Custom functions
----------------

If none of previously mentioned options was a solution for your problem,
then custom functions come to the reascue. It's possible to create a
then custom functions come to the rescue. It's possible to create a
meta-tag being in fact a custom python function which can do almost
everything and then return a translated tag.

Expand Down
1 change: 1 addition & 0 deletions docs/user-guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,7 @@ That's right. We have specified an identifier for an inner tag (*obj_g*), which
The inner tag's identifier gets the grammatical form contained in an inner tag. It is then transported to the switch field which makes the correct decision.

So the full Polish translation looks like that:

**Polish**
::

Expand Down
14 changes: 11 additions & 3 deletions docs/user-reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,22 @@ Apart from built-in decorators it’s possible to define custom ones.
}

def add_dots(value):
return "".join([char + "." for char in value])
return ".".join(value)

self.pys.register_decorator("add_dots", add_dots)
pyslate_en.register_decorator("add_dots", add_dots)

>>> pyslate_en.t("some_message@add_dots")
>>> pyslate_en.t("message_container")
Message is: I.m.p.o.r.t.a.n.t. .m.e.s.s.a.g.e

>>> pyslate_en.t("message_container@add_dots")
M.e.s.s.a.g.e. .i.s.:. .I...m...p...o...r...t...a...n...t... ...m...e...s...s...a...g...e


It's possible to decorate both requested tag, inner tag fields and variable fields.
In the last command, value of "some_message" tag gets dots added and then the whole texts gets dots added.
There are three dots between the letters, because second decorator adds dots between
every single character, including dots added by first decorator.

.. _Available_Decorators:

Available decorators
Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@
'the program: translation of messages, formatting dates and numbers to provide multi-language support.',
long_description=long_description,
classifiers=[
"Development Status :: 2 - Pre-Alpha",
"Development Status :: 5 - Production/Stable",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.3",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"License :: OSI Approved :: MIT License",
],
author=pyslate.__author__,
Expand Down

0 comments on commit fdc33a4

Please sign in to comment.