Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rolepoint/pyseeyou
A Python ICU MessageFormat parsing tool
https://github.com/rolepoint/pyseeyou
i18n messageformat python
Last synced: 10 days ago
JSON representation
A Python ICU MessageFormat parsing tool
- Host: GitHub
- URL: https://github.com/rolepoint/pyseeyou
- Owner: rolepoint
- License: mit
- Created: 2016-01-06T19:45:07.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2022-10-28T19:25:32.000Z (about 2 years ago)
- Last Synced: 2024-11-01T17:12:10.735Z (14 days ago)
- Topics: i18n, messageformat, python
- Language: Python
- Homepage:
- Size: 54.7 KB
- Stars: 17
- Watchers: 11
- Forks: 14
- Open Issues: 5
-
Metadata Files:
- Readme: README.rst
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
--------
pyseeyou
--------A Python ICU MessageFormat parsing tool,
using `parsimonious `_ to parse a
PEG, which has been taken from
`messageformat.js `_.Compatible with Python 2.7, 3.5, 3.6 and 3.7
Usage
=====.. code-block:: python
from pyseeyou import format
result = format('''{GENDER, select,
male {He}
female {She}
other {They}
} found {NUM_RESULTS, plural,
one {1 result}
other {# results}
} in {NUM_CATEGORIES, plural,
one {1 category}
other {# categories}
}.''',
{'GENDER': 'male', 'NUM_RESULTS': 1, 'NUM_CATEGORIES': '2'}, 'en')=> u'He found 1 result in 2 categories.'