Skip to content
forked from rolepoint/pyseeyou

A Python ICU MessageFormat parsing tool - fork waiting for https://github.com/rolepoint/pyseeyou/pull/17 to be merged

License

Notifications You must be signed in to change notification settings

iotile/pyseeyou

 
 

Repository files navigation

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

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.'

About

A Python ICU MessageFormat parsing tool - fork waiting for https://github.com/rolepoint/pyseeyou/pull/17 to be merged

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%