* Remove redundant @licence/@license from test suite files.
They already have full licence headers. And @licence raises a
warning in Doxygen.
* Fix weird messes of comments inside comments and other things.
Change-Id: I38da8ca76330f72b8dc22b0ecf1ea69d5ea55ede
* The updates include incompatible changes for plural forms in Russian,
Prussian, Tagalog, Manx and several languages that fall back to Russian.
In addition there are minor changes for other languages.
* Test cases were updated to reflect these changes.
Bug: 62861
Change-Id: I7cce477925330fe5bbf51a8470060dc1223981d0
MediaWiki default is "@return type Description", so set a type after
return and start the description with a capital letter. Also use the
more common spelling of boolean.
See http://phpdoc.org/docs/latest/references/phpdoc/tags/return.html for
more about @return
Change-Id: I4e5198822fe92836f9cef9918a9fc1a1a1e0a043
The results of this function are used to decide whether a code is
valid for loading an i18n file without any further normalization.
Partially reverts 93348f3 which made the regular expression case-
insensitive. Per IRC discussion, language codes should always be
lowercase and it's up to callers to deal with that.
Change-Id: I8975c3374a37935080d9f7eca6a602e32f67a87b
Add an out parameter to Language::sprintfDate that returns the amount of
time that its output is valid for (e.g., an output format of 'Y-m-d' at
11:50 PM would be valid for 600 seconds).
Change-Id: I3f5a80aa4d303f92c97d24ab780af920894d24ef
When parsing, filter any array values that are empty string
before using strtr php function so that strtr can handle
the array.
Bug: 64347
Change-Id: I94761caa70d44febfa0999c91048a01044fc1fbe
Swapped some "$var type" to "type $var" or added missing types
before the $var. Changed some other types to match the more common
spelling. Makes beginning of some text in captial.
Also added some missing @param.
Change-Id: Ic8aaf0a93796b97d0fa4617c1f86ff59f4b36131
LocalisationCache and Language have to take the JSON files into account
in deciding if a language is present or not.
Standardizing language validity checking with isSupportedLanguage
and isValidBuiltInCode.
Co-Authored-By: Niklas Laxström <niklas.laxstrom@gmail.com>
Co-Authored-By: Siebrand Mazeland <siebrand@kitano.nl>
Change-Id: I35bbb3a7a145fc48d14fff620407dff5ecfdd4fc
- Added spaces after if/foreach/catch
- Added new line before end of file
- Added or removed spaces before/after parenthesis, comma
- Added spaces around string concat
Change-Id: I0590070f1b3542108e242730e8d9a3ba9831e94f
Russian (ru) plural rules have a major change. The 'few' form is
merged with the 'other' form. The current forms are 'one', 'many', 'other'.
In MW ru plural rules were overridden using convertPlural methdod
in LanguagesRu.php with 3 forms.
Effectively forms[1] and forms[2] are swapped.
Followup: I9930b290d004667a3bb09e5c1663ec2c9c27d8a6
Bug: 56931
Change-Id: Ia5779e42315d3f41f52dce2bfffaee0a4297d23b
Updated plurals.xml with new data from CLDR 24.
This data is according to UTS #35 Rev 33.
Update the CLDRPluralRuleParser.js to version 1.1 from upstream
https://github.com/santhoshtr/CLDRPluralRuleParser
Changes to the plural rules:
* Hebrew override removed since CLDR 24 matches with MW plural rules.
* Updated the syntax of overridden rules to TR35 Rev 33 for
Lower Sorbian (dsb), Upper Sorbian (hsb), Belarusian in Taraskievica
orthography (be_tarask), Old Church Slavonic (cu), Bhojpuri (bho),
Samogitian (sgs).
* Removed Manx (gv) override. See I46ab3dadc7fe08c1e60bbd81a1ee841e166e9608.
* Removed the overriden convertPlural method for Serbian from LanguageSr.php,
since CLDR 24 matches with MW rules. Updated and added more tests.
Tests updated for Serbocroatian (sh), too. Old CLDR versions had 4 plural
rules and MW had only 3. In CLDR 24, the form 'many' was removed and it
became identical to the MW. Same for Bosnian (bs) and Croatian (hr).
Also for variants sr-ec and sr-el
* Macedonian (mk) used to count 11 as 'other' form.
CLDR 24 counts it as 'one'.
Not overriding, using CLDR 24 here.
Updated the tests. MW will not override this.
* Armenian (hy) used to count 0 as 'other'.
Now it is 'one' form.
Updated the tests. MW will not override this.
* Latvian (lv) used to count only 0 as 'zero' form, but CLDR 24, any number
satisifying the following formula is counted as zero:
n % 10 = 0 or n % 100 = 11..19 or v = 2 and f % 100 = 11..19
Examples: 0, 10~20, 30, 40, 50, 60, 100.
Updated the tests accordingly. Not overriding it in MW.
Users will see different plural form for the above numbers.
* Removed Ukranian custom plural rule since it match with MW
* Russian (ru) plural rules have a major change.
The 'few' form is merged with the 'other' form.
The current forms are 'one', 'many', 'other'.
In MW ru plural rules were overridden using convertPlural methdod
in LanguagesRu.php with 3 forms.
Effectively forms[1] and forms[2] are swapped.
This will affect the messages, and such messages
must be reviewed and updated. This change is not included in this patch and
wil be done separately.
Russian is the only remaining language class with convertPlural method overridden.
Notable impact on the exising messages:
* For languages ru, uk, be_tarask, sr, For the special case
of two plural forms and first mapped to 1 and rest to the other form, syntax like
{{plural:$1|1=one|other}} should be used.
For further information regarding each of the above language changes, see
1. http://unicode.org/cldr/trac/ticket/3727
2. http://goo.gl/H2HEz
CLDR 24 can handle fractions. Ideally it should start working
in MW without any code changes, but MW language test suite
does not have enough tests to confirm.
Followup: e571717e06
Bug: 56931
Change-Id: I9930b290d004667a3bb09e5c1663ec2c9c27d8a6
* New operands i, v, w, f, t
* New operators =, !=, %
* Ignore "samples", which are basically unit tests embedded in rule
specifications
* Ignore the new "other" rules, which have an empty condition. It
doesn't really makes sense to parse them, since the empty condition
means special handling should be done in the caller, it is not
equivalent to an unconditional true or false.
* Trailing zero support requires that the input number be a string.
Documented this.
* Fixed some comments
* Added test cases for new features
Bug: 56931
Change-Id: I96986c0c664f785e75b0a4ced2ec9e37b72681c1
Backported the plural rules from CLDR 24 as an override to CLDR 23 rules
exising in MediaWiki. The syntax for plural rules changed in CLDR 24, so
modified the syntax to fit the CLDR 23 syntax
Once we are ready with the updated parsers for CLDR 24(See bug 56931),
we should remove the override.
Since we remove the custom plural forms in MW in favor of CLDR,
the following changes comes into effect:
1. 'few' form used as 'zero' form in MW. Practially that make 'one' form used
as 'two' form and 'two' used as 'few' form.
This breaks existing gv {{PURAL}} usage as dicussed in the bug report
2. CLDR defines 'few' form as n % 100 = 0,20,40,60 but MW adds 80 also to that
list, ie n % 100 = 0,20,40,60, 80. So with this patch, 80 is no longer considered
as 'few' plural form.
Bug: 47099
Change-Id: I46ab3dadc7fe08c1e60bbd81a1ee841e166e9608
Russian has overridden convertPlural method, that was not
taking care of explicit plural forms.
Follow up: I2a9f93567087babb896999f1214d3c56afc67c96
Bug: 54514
Change-Id: Ia977fa544b1d0e40222c7296b7145dcd6f93ecc2
A new protected method looks for explicitly defined forms.
Every overriden language class is required to use this method.
Includes tests.
Redoing old patch I6dc759e3dfb05d6673209ba00da6592a384d5300
Bug: 46422
Change-Id: I2a9f93567087babb896999f1214d3c56afc67c96
Localization of numeric values should operate on the values as strings,
and should handle strings representign very large numbers gracefully.
Change-Id: I95394b96f9b70deb06ab818b54e08ac4ccb38c6c
When truncating a string at a point where it contains a space (ie "hello
world" to 9 chars), the resultant string will have a space before the
ellipsis ("hello ..."). This is both gramatically incorrect and just looks
wrong, and is fixed by trimming the string before appending the ellipsis.
Change-Id: Iec86b17bfc8c50e4c1a96fd373861841fc57848d
This change:
- Adds method scope
- adds @covers tags
- adds various @todos
- fixes some comments
Before the changes tests ran with:
1383 tests, 1412 assertions 10 skips
After changes the results remain the same
Change-Id: Iee57447bdb47026952ef5dcce6fed5dad0f80e52
I have no clue how this ever actually worked under Zend, but it
definitely didn't with HHVM. Now it works on both.
Change-Id: I521dfb74f30306736adda5662598fd036ad9849b
Currently if the site language is zh and a user is using variant zh-tw,
namespace names from zh-hant are displayed because of the language
converter, but they're not accepted by MediaWiki as valid namespace names
by default because zh falls back to zh-hans.
For core namespaces, all converted namespace names are manually added as
$namespaceAliases in MessagesZh.php but it's not always done in extensions.
With this patch converted namespace names are automatically added as
namespace aliases when namespace aliases are loaded.
In some followup commit it makes sense to remove existing core namespace
aliases which were created for this reason.
Change-Id: I01873d9c64a9943afbb655d6203cec9ebd39fb72
It is possible that only explicit plural forms are specified, and
therefore, it is possible that none match. However, handling of
explicit forms came after the count( $forms ) check, so input such
as {{PLURAL:|1=}} would trigger a "PHP Notice: Undefined offset: -1".
Change-Id: I8494de8ceb9e0cfff7203c69c21f02b3731275af
Follows-Up: I50eb0c6d1c02ca936848d310de625ed1fe43d91a
- Remove check for version, that version is already enforced in phpunit.php,
so there is not point showing a warning for it is useless
- Remove call to MessageCache::destroyInstance(), there is no need for it,
since $wgMessageCacheType is set in phpunit.php before running Setup.php
- Remove includes of bootstrap.php in LanguageSrTest.php and LanguageUzTest.php
Change-Id: I4b2db6b3e6f001175e1a407c5add2972aade5e60
Check if the timestamp has a length of 14 characters and if it is numeric.
Throw an exception otherwise. Includes tests.
Bug: 47629
Change-Id: I9a4fd0af88cf20c2a6bd72fd7048743466c1600f
Add an optional timezone parameter to Language::sprintfDate, add format
characters eIOPTZ, and correct crU.
While we're at it, remove backwards-compatability code for 'N' and then
merge the existing switch cases for cr and wNzWtLoU that are basically
identical, since all those cases need to be changed anyway.
Bug: 33454
Change-Id: Iea1f78428bc0d32d6395818311dbe4b94d776c42
Also update some previous inconsistencies pointed out by Krinkle in change IDs:
* Ide20743a2e84ff68549286120e6cff9d9f396f54
* I811ca957b6588085d67606ebc0cd4033a1e53839
Change-Id: Ife33b931870d0d7e04fcb40974997436d27f528f
A recent CLDR update changed the plural rules for Hebrew
and added a "many" form. That rule has a mistake, however -
it is not supposed to include the number 10. This is reported as
http://unicode.org/cldr/trac/ticket/5828
This commit updates the plural overrides for Hebrew and makes
them closer to the latest CLDR, but with a fix for that rule.
It also updates the tests to include support for the new rule
and to make sure that the right fallbacks are used when
less than four rules are supplied, because usually that is
the case. It is thus a partial revert of the changes introduced
in I3d72e4105f6244b0695116940e62a2ddef66eb66 .
Mingle-Task: 2715
Change-Id: I1315e6900ef7a89bf246e748b786f7fc31a629c6
For example, find out which rule type should be applied for 5 items
in Arabic. The result would be 'few'.
This implementation should be non-disruptive and completely backwards
compatible (which is the main reason it isn't a lot simpler).
Change-Id: I3d72e4105f6244b0695116940e62a2ddef66eb66
* CLDR does not define plural rules for sgs.
* Port the plural rules present in LanguageSgs.php to CLDR plural
definition syntax
* Remove LanguageSgs.php
* Update the tests, reorder/rename the plural form names
Change-Id: I44658402d69a6805cdfd189fe780eadee94056c7