pofile.py: Added new exception called PoFileError and thrown if flagged
This new exception is thrown when the po parser finds an invalid pofile.
This helps handle invalid po files that are parsed. Invalid po files may cause
other possible errors such as a UnicodeEncodeError.
Jon Dufresne [Sat, 21 Oct 2017 16:47:07 +0000 (09:47 -0700)]
Include license file in the generated wheel package
The wheel package format supports including the license file. This is
done using the [metadata] section in the setup.cfg file. For additional
information on this feature, see:
Roy Williams [Sat, 27 May 2017 00:04:27 +0000 (17:04 -0700)]
Fix an invalid string to bytes comparison in Python 3
In Python 3 this branch would never evaluate to `True` due to comparing a string to bytes.
This was flagged by running some unit tests with the `-bb` flag, so I've added
`-bb` to run with the babel unit tests in Python3.5
Here's some docs on the `-bb` flag:
https://docs.python.org/3.5/library/warnings.html#default-warning-filters
https://docs.python.org/3/howto/pyporting.html#use-continuous-integration-to-stay-compatible
Michael Birtwell [Wed, 12 Oct 2016 15:13:50 +0000 (16:13 +0100)]
pofile parsing. Fix handling of obsolete + refactor
Fixes the handling of the unit before the obsolete unit.
Previously it would mark the unit before an obsolete unit as obsolete
also.
Some refactoring:
* the transition between finishing one unit and starting the next
is clearer
* separate the processing of keywords and continuation lines
* combine the reset and initialisation code
* Make the handling of strings consistent.
* Add some nascent error handling, removed some errors in test inputs
ldwoolley [Fri, 7 Oct 2016 23:39:04 +0000 (16:39 -0700)]
Improve Date Fields descriptions for issue #419
Described recommendation to use "Y" with "w" for consistent results in ISO year-week and indicated possible surprising results for year rollover and total number of weeks in a year.
Roman Rader [Tue, 9 Aug 2016 08:29:12 +0000 (11:29 +0300)]
Add option 'add_location' for location line formatting
Support of add_location option added, can be either 'full', 'file'
or 'never'. 'full' includes both file and line number; 'file' includes
only the file name without line number; 'never' doesn't include the
location comment at all (same as --no-location).
Max Shenfield [Mon, 11 Jul 2016 15:17:15 +0000 (10:17 -0500)]
Updated plurals.py to match Mozilla and CLDR references
This commit updates the plural rules, and in some cases the plural
number, for languages based on review of
https://developer.mozilla.org/en-US/docs/Mozilla/Localization/Localization_and_Plurals,
and
http://www.unicode.org/cldr/charts/29/supplemental/language_plural_rules.html.
I changed the interface (either the number of plurals, or the meaning
of each index), for the following languages:
• Arabic (ar): numplurals same, semantics differ per Mozilla's "Plural rule #12". 3 has been made more accurate, 4 has been switched with 5, and the meaning of both has been refined to match the rule.
• Belarusian (ar): numplurals updated to 3, using Mozilla's "Plural
rule #7". Previously the default, where anything except one is plural.
• Breton (br): numplurals updated to 6, using Mozilla's "Plural rule
• Bosnian (bs): numplurals updated to 3, using Mozilla's "Plural rule
• Irish Gaelic (ga): numplurals update from 3 to 5, using Mozilla's
"Plural rule #11". Cases have been added for n between 3 and 6, and n
between 7 and 10.
• Icelandic (is): same numplurals (2), semantics updated using
Mozilla's "Plural rule #15". 0 now means that n ends in 1, and is not
11, instead of just the number 1.
• Maltese (mt): same numplurals, same rule. Fixed rule, index 1 now
includes numbers ending in 1 (except the number 1)
I'm ignoring these two rules listed on the Mozilla resource
• Hungarian - listed as `(n != 1)`. It is not required to pluralize a
noun if a qualitative or quantitative amount precedes it
http://www.hungarianreference.com/plurals.aspx.
• Vietnamese - listed as `(n != 1)`. It only seems to have one plural
according to this lesson:
http://yourvietnamese.com/vietnamese-grammar/nouns-in-vietnamese/.
There are some additional languages listed in the Mozilla reference
that are not in the plurals document, and could be added:
• Lower Sorbian (dsb) (4, '(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 ||
n%100==4 ? 2 : 3)')
• Upper Sorbian (hsb) (4, '(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 ||
n%100==4 ? 2 : 3)')
• Scottish Gaelic (gd) (4, '(n==1 || n==11 ? 0 : n==2 || n==12 ? 1 :
(n>=3 && n<=10) || (n>=13 && n<=19) ? 2 : 3)')
• Faroese (fo) (2, '(n != 1)')
• Frisian (fy) (2, '(n != 1)')
• Macedonian (mk) (3, '(n%10==1 ? 0 : n%10==2 ? 1 : 2)')