danhper / python-i18n

Easy to use i18n library for Python
https://pypi.python.org/pypi/python-i18n
MIT License
228 stars 45 forks source link

Translation cannot start with % #21

Closed stefansimik closed 4 years ago

stefansimik commented 4 years ago

Hi, if translation starts with '%' character, translation fails on error:

Example - if translation is:

perc_of_clients: % of clients

then error is thrown:

I18nFileLoadError: Invalid YAML: while scanning for the next token found character '%', that cannot start any token

What can I do, to allow % character in translations?

danhper commented 4 years ago

Hi, You can simply quote the string, it should work:

perc_of_clients: "% of clients"

Please comment if that does not fix it.

stefansimik commented 3 years ago

Hi, You can simply quote the string, it should work:

perc_of_clients: "% of clients"

Please comment if that does not fix it.

Hi, this does not really work. That means, this still throws an error: free_sentence: "25% of people are young people."

What helped is this syntax - write character % twice: free_sentence: 25%% of people are young people.