Commit graph

1598 commits

Author SHA1 Message Date
Siebrand Mazeland
b98dc6ced8 Update and correct documentation in Language class
Change-Id: I1d530bded0da7133f9b5120b515f32fc87507c84
2016-03-11 15:09:47 +00:00
Siebrand Mazeland
288e1ad503 Remove deprecated Language::getLangObj()
Was deprecated since 1.24. There were no uses in Gerrit extensions

Change-Id: I7ca08416d10fbba5222cb1a1fde75b697d354b09
2016-03-08 21:44:26 +00:00
Siebrand Mazeland
67d783b50e Remove deprecated Language::specialPage()
Was deprecated since 1.24. There were no uses in Gerrit extensions

Change-Id: If67456a62cb7d9688793d876508f0f168f3bb1ff
2016-03-08 21:43:21 +00:00
Siebrand Mazeland
182e45f31a Remove deprecated Language::GetLanguageName()
Was deprecated since 1.20. Uses in Gerrit extensions have been replaced.

Change-Id: I623e82ec1d9ade4da05f2eae15afdf65aa04109b
2016-03-08 21:38:59 +00:00
Siebrand Mazeland
19cd88808c Remove deprecated Language::getTranslatedLanguageNames()
Was deprecated since 1.20. There were no uses in Gerrit extensions

Change-Id: I0b16c0f146ecbee81921b5823b32776414f6945c
2016-03-08 20:26:51 +00:00
Siebrand Mazeland
4f03894063 Remove deprecated Language::getLanguageNames()
Was deprecated since 1.20. Uses in Gerrit extensions have been replaced.

Change-Id: I2011d3e209915ddbbafdbdfff0279ea7cc5b9125
2016-03-08 20:26:34 +00:00
Matthew Flaschen
b341b63243 Use an example with working digit transformation
Change-Id: I6424774a4cf720fe85a431ff12e5d5c61c9bfcde
2016-03-07 20:14:34 -05:00
Bartosz Dziewoński
c161c46d26 Improve code suffering from PHP 5.3's lack of support for foo()[]
I searched for /\$(\S+) = (.+?\(.*?\);)\n.*?\$\1\[/, ignored
everything involving isset(), unset() or array assigments, then
skimmed through the remaining results and changed things where they
made sense. These changes were not automated, so please review them.

Change-Id: Ib37b4c66fc57648470f151ad412210b3629c2538
2016-02-28 22:49:20 +01:00
Fomafix
6b976d825a Update comments about language codes
* RFC 3066 is obsoleted by RFC 4646.
* RFC 4646 is obsoleted by RFC 5646.
* All are also known as BCP 47.
* Language codes must treated as case insensitive.
* There exist conventions for the capitalization of some of the subtags.
* Write a space between BCP and 47 in comments.
* http://www.adobe.com/devnet/xmp/pdfs/XMPSpecificationPart1.pdf is not available.
* https://wwwimages2.adobe.com/content/dam/Adobe/en/devnet/xmp/pdfs/XMP%20SDK%20Release%20cc-2014-12/XMPSpecificationPart1.pdf
  is the new position.

Change-Id: I91e305fd5754cf4dedf8fd7460f7d3375f792c89
2016-02-19 07:31:51 +00:00
Kunal Mehta
6e9b4f0e9c Convert all array() syntax to []
Per wikitech-l consensus:
 https://lists.wikimedia.org/pipermail/wikitech-l/2016-February/084821.html

Notes:
* Disabled CallTimePassByReference due to false positives (T127163)

Change-Id: I2c8ce713ce6600a0bb7bf67537c87044c7a45c4b
2016-02-17 01:33:00 -08:00
jenkins-bot
d4ecfc1a5c Merge "Don't modify $wgHooks on language object construction" 2016-02-11 04:05:56 +00:00
Tim Starling
f43e0d840f Use autoloader for PHP data files instead of include/require
Move ZhConversion.php and Names.php to languages/data and make them both
expose their data as static class variables instead of in the local
scope. This means that the autoloader can be used to load the data,
which is efficient and secure. This also makes additional request-local
caching of the arrays unnecessary.

Change-Id: Iafb96ac4165d0965fcb9a69f1d0a91139ea9790c
2016-01-30 13:08:46 +11:00
Tim Starling
059fd9a2ae Don't modify $wgHooks on language object construction
Previously various language objects would install a hook to update the
shared conversion table cache when the object was constructed. This is
not a good idea since language objects may be constructed even when they
are not the content language, but only the content language is
associated with variant conversion and the conversion cache.

Instead, have WikiPage call a method on $wgContLang directly. I put this
with message cache update since the logic is almost identical.

Change-Id: Ief9c0ef993e39645e74a6e158cb4e6e2139ce91d
2016-01-29 15:03:56 +11:00
Florian
e0ad37d49a Remove Language::armourMath() and friends
Change-Id: I0ce18bce2d9b5787221e2dabff143de9792abb3a
2016-01-07 09:21:53 -08:00
Fomafix
d680c77bf9 Simplify Language::getFallbackFor
This avoids a redundant check of the language code.

Change-Id: Ifbe23b80a9d8fd5c3aa06f6656dbf2699a318003
2015-12-16 09:51:53 +00:00
Timo Tijhof
5a9e862063 Language: Convert names cache from MapCacheLRU to HashBagOStuff
Change-Id: I3237c8ed97d23e82caa171d936ecb5745a2fe3d5
2015-11-09 23:29:20 +00:00
Timo Tijhof
f739fca055 Language: Remove logic for class file inclusion
* Remove strcspn() check in newFromCode already in isValidCode().
* Leverage the autoloader instead via class_exists instead of
  including files based on user input.
* Create fallback instance directly instead of recursing back
  into newFromCode().

* Remove method preloadLanguageClass (unused).
* Remove method getClassFileName (unused)

Change-Id: I90035ca4b07facae051b1a584e92df72b42c4a49
2015-10-29 01:39:23 +00:00
Roan Kattouw
e4d6238c00 Language::truncate(): don't chop up multibyte characters when input contains newlines
To detect whether the truncation had chopped up a multibyte
character after the first byte, a regex was used. But in this
regex, the dot (.) didn't match newlines, so it failed to
detect chopped multibyte characters (after the first byte)
if there was a newline preceding the chopped character.

Bug: T116693
Change-Id: I66e4fd451acac0a1019da7060d5a37d70963a15a
2015-10-26 20:17:37 -07:00
Amir E. Aharoni
50f546aa3e Make lines short to pass phpcs in Language.php
Bug: T102614
Change-Id: I14fd848398ce68bd646f36b196560f70352d5f49
2015-09-27 10:45:31 +03:00
jenkins-bot
827e10dc40 Merge "Use wikimedia/cldr-plural-rule-parser" 2015-09-24 23:15:56 +00:00
Niklas Laxström
4a3fd2e42a Use wikimedia/cldr-plural-rule-parser
Replaces the parser included in MediaWiki with same code in
a library.

Change-Id: I1d2675466a543269e17faf213aa68d2b7afaf78e
2015-09-24 21:41:50 +02:00
umherirrender
271da88127 Some bugzilla.wikimedia.org -> phabricator.wikimedia.org changes
Changed some old bugzilla links to new phabricator links in comments,
test data and error message. This reduces the need for redirects from
old bugzilla to new phabricator from our source code.

Change-Id: Id98278e26ce31656295a23f3cadb536859c4caa5
2015-09-24 17:17:25 +02:00
Vivek Ghaisas
d9d846b8a2 Add // @codingStandardsIgnore around very very long line in Language.php
Bug: T110238
Change-Id: Ic681d3eb4e02443b06386ae390536912a8fc4566
2015-09-07 17:13:11 +05:30
Kunal Mehta
b74003c970 Language: Fix 'pretty' fallback in getDateFormatString()
* If using 'default', still fallback to 'date' if 'pretty' is
unavailable.
* Fix instance caching of 'default', which never worked since $pref
would be changed inside the !isset() block.

Bug: T110945
Change-Id: Ic53b279f8741371fa1cb642c53e6d487cb1c6b81
2015-09-01 18:05:07 -04:00
Ori Livneh
92602fefda Micro-optimize Language::isMultiByte()
The xenon logs on performance.wikimedia.org show this function as being on-CPU
about 1% of the time, making it a candidate for optimization. The version in
this patch is about 30-50% faster in my benchmarks.

Change-Id: I26385ade7600fc11965d94468b57e41ec257de51
2015-08-25 18:22:21 -07:00
Niklas Laxström
be03b796fa Disallow qqq as interface language
Any page on translatewiki with param setlang=qqq times out. All messages
get parsed recursively until parser-template-loop-warning is reached.
uselang=qqq is already ignored, see RequestContext::sanitizeLangCode.

There is a counterpart to this patch in ULS, where it is changed
to use Language::isSupportedLanguage.

Bug: T104987
Change-Id: Ie77fe18681dfd5f9089fbaa8090dd9cc1c206da4
2015-07-22 21:06:22 +00:00
jenkins-bot
08db2b721e Merge "Hygiene: Use strtr() instead of str_replace() for character swapping" 2015-07-15 09:39:45 +00:00
Timo Tijhof
c318e3a265 Hygiene: Use strtr() instead of str_replace() for character swapping
strtr() is marginally faster as it runs through the string only
once. A better fit for one-for-one character translation.

The strtr() function also supports an associative array as second
parameter for entire string replacements. This, too, has the same
performance and predictable behaviour (starts with the longest key).
Whereas str_replace is for more aggressive needs where you want
multiple passes until there are no further matches.

The associative array form is arguably also easier to understand
and harder to mess up since the needle/replacement pairs are
explicitly connected instead of two separate arrays.

Also:
* Use getFormattedNsText instead of strtr( getNsText, .. ) which
  reduces duplication of this fact through a more semantic intent.

Change-Id: Ie23e4210a5b6908dd79eebc8a2b931d12fe31af6
2015-07-06 20:25:19 +00:00
David Chan
f5c88ef8e5 Add {{bidi:}} syntax for directionality-safe arguments
In parallel with jquery.i18n version:
https://github.com/wikimedia/jquery.i18n/pull/76

Bug: T104472
Change-Id: I25afa50ab1e0521bd0b3779cbd16b6c190d72722
2015-07-01 11:06:45 -07:00
Vivek Ghaisas
9f5b6f5aeb Fix whitespace issues around parentheses
Fix issues found by MediaWiki.WhiteSpace.SpaceyParenthesis sniff.

Bug: T102617
Change-Id: Iec7f71e64081659fba373ec20d9d2006306a98f4
2015-06-16 22:14:02 +03:00
Kunal Mehta
f6e5079a69 Use mediawiki/at-ease library for suppressing warnings
wfSuppressWarnings() and wfRestoreWarnings() were split out into a
separate library. All usages in core were replaced with the new
functions, and the wf* global functions are marked as deprecated.

Additionally, some uses of @ were replaced due to composer's autoloader
being loaded even earlier.

Ie1234f8c12693408de9b94bf6f84480a90bd4f8e adds the library to
mediawiki/vendor.

Bug: T100923
Change-Id: I5c35079a0a656180852be0ae6b1262d40f6534c4
2015-06-11 18:49:29 +00:00
Timo Tijhof
dd587fb99c language: Use item 'fallbackSequence' instead of duplicating logic
The 'fallbackSequence' is exactly generated for this purpose. It
is equal to the value of 'fallback' after splitting, trimming
and ensuring 'en' is present. See LocalisationCache::recache().

Also simplify returning of the first array index by returning it
directly instead of modifying the array first.

Due to an inconsistency between how LocalisationCache and Language classes
treat the fallback sequence differently, we have to manually fallback
to 'en' in case of unknown language codes. This is because otherwise
Language::factory() will throw an exception causing tests to fail.
We should investigate whether this is desirable or not, but keeping
existing behaviour for now and documenting it.

Change-Id: I9c1d51b59aabebf5a31f38205304bb8cc22dcd8c
2015-06-04 17:45:12 +00:00
Amir E. Aharoni
c9678525eb Rewrite Language::hebrewNumeral()
Use arrays instead of strings, to avoid using
string functions with Unicode.

Handle thousands according to how years like 1000, 2000, etc.
are named in the Hebrew Wikipedia.

Bug: T97444
Change-Id: I5334e86793d28dfcf8939a249b03a5ea85fa4e69
2015-06-02 15:10:52 +02:00
Amir E. Aharoni
f21537f8f2 Cleanup the code of Language::hebrewNumeral()
Change == to === and add empty lines for readability.

Change-Id: Ifeabbf0d6adca25d8a797bd423f1bbdc0f8223ee
2015-06-02 12:31:47 +00:00
Brian Wolff
5cef81dcc6 Move MWTimestamp::getHumanTimestamp() to Language
We're trying to remove MediaWiki dependencies from MWTimestamp so it can
be split out into a separate library. In addition to getting rid of a
dependency on RequestContext, Language, and User, it makes more logical
sense there anyways.

Bug: T100924
Change-Id: If46eaea42d8a5a808c10f0dc353e181714295a44
2015-05-31 01:53:54 -07:00
jenkins-bot
dd7df34a22 Merge "Clean up handling of 'infinity'" 2015-04-14 18:57:16 +00:00
Kunal Mehta
13975fe76a Use wikimedia/utfnormal library, add backwards-compatability layer
This drops support for the custom utf8 normal PHP extension in favor
of the intl extension.

Bug: T90825
Change-Id: Ifbaeb2ef684217cf6187ccc4fb4d303f89608300
2015-03-24 12:59:26 -07:00
Brad Jorsch
ac6f81d9ad Clean up handling of 'infinity'
There's a bunch of stuff that probably only works because the database
representation of infinity is actually 'infinity' on all databases
besides Oracle, and Oracle in general isn't maintained.

Generally, we should probably use 'infinity' everywhere except where
directly dealing with the database.

* Many extension callers of Language::formatExpiry() with $format !==
  true are assuming it'll return 'infinity', none are checking for
  $db->getInfinity().
* And Language::formatExpiry() would choke if passed 'infinity', despite
  callers doing this.
* And Language::formatExpiry() could be more useful for the API if we
  can override the string returned for infinity.
* As for core, Title is using Language::formatExpiry() with TS_MW which
  is going to be changing anyway. Extension callers mostly don't exist.
* Block already normalizes its mExpiry field (and ->getExpiry()),
  but some stuff is comparing it with $db->getInfinity() anyway. A few
  external users set mExpiry to $db->getInfinity(), but this is mostly
  because SpecialBlock::parseExpiryInput() returns $db->getInfinity()
  while most callers (including all extensions) are assuming 'infinity'.
* And for that matter, Block should use $db->decodeExpiry() instead of
  manually doing it, once we make that safe to call with 'infinity' for
  all the extensions passing $db->getInfinity() to Block's contructor.
* WikiPage::doUpdateRestrictions() and some of its callers are using
  $db->getInfinity(), when all the inserts using that value are using
  $db->encodeExpiry() which will convert 'infinity'.

This also cleans up a slave-lag issue I noticed in ApiBlock while
testing.

Bug: T92550
Change-Id: I5eb68c1fb6029da8289276ecf7c81330575029ef
2015-03-13 11:19:53 -04:00
JuneHyeon Bae
511525a136 Refactor out 'infinity' variants
Refactor out 'infinity' vartiant values which used in blocking and
protecting actions. This patchset adds GlobalFunction wfIsInfinity.

Bug: T68646
Change-Id: I60cc55a5bbd43c72916a1c2ea3807457d4e33765
2015-03-12 16:38:02 +00:00
Amir E. Aharoni
cecaef3e38 Shorten long lines in Language.php to make phpcs pass
Change-Id: Ied04ebc64cd5a6e54bd0c3de5845342ec89d4d1c
2015-03-03 17:42:35 +00:00
umherirrender
3800b2fff0 Add explicit array cast in Language::getGenderNsText
Similiar to r102414

Bug: T43194
Change-Id: I868b31b3862539d4782912d5b6e5d3ce5d9b4f60
2015-03-03 09:07:14 +00:00
Chad Horohoe
af14c36286 Remove LanguageGetMagic profile point
The hook call is already captured in profiling data and this
function is too.

Change-Id: I69ad54b9a66e24a419f492238f45c46922c112eb
2015-02-04 10:46:53 -08:00
Chad Horohoe
aa21e125a3 Remove obvious function-level profiling
Xhprof generates this data now. Custom profiling of various
sub-function units are kept.

Calls to profiler represented about 3% of page execution
time on Special:BlankPage (1.5% in/out); after this change
it's down to about 0.98% of page execution time.

Change-Id: Id9a1dc9d8f80bbd52e42226b724a1e1213d07af7
2015-01-07 11:14:24 -08:00
Evan McIntire
7fd9739c9c Moved getTitleInvalidRegex() from Title to MediaWikiTitleCodec
Deprecated it in Title, and updated all current references to use the
non-deprecated version in MediaWikiTitleCodec

Change-Id: I2b9c36992028c97f695f2b95ba027fbb11904b57
2014-12-31 11:29:36 +00:00
Niklas Laxström
b418b85c34 Fix escaping of specialList and clarify comments
Change-Id: I4bead5f5f310dd35e8dfee738f35a070e7bf869f
2014-12-29 18:55:09 +00:00
Niklas Laxström
8d71f214fb Remove over/underescaping detected in Special:UserRights
Bug: T31340
Change-Id: I99823cd56e0a6f501101cb85be832d2925ce9779
2014-12-29 16:05:40 +00:00
Marius Hoch
dc5db351a6 Sort languages by code in Language::fetchLanguageNamesUncached
This is being used in API output in ApiQuerySiteinfo so having
it sorted is nicer.

Bug: T85406
Change-Id: I796112187d17337a1cc12d6752839263b53f40e1
2014-12-28 13:00:50 +01:00
Bryan Davis
7b15208085 Guard against empty integerPart in Language::commafy
Fixes:
    Notice: Undefined index: 0 in languages/Language.php on line 3348

Change-Id: I1a00f3af95d3b9b0fd3ad3cc690358fe5b90f58f
2014-12-12 13:55:43 -07:00
Kunal Mehta
4d39b31bba Language: wfRunHooks() --> Hooks::run()
Follows up I8ee996f237fd111873a

Change-Id: I0ffc5903c96219676b9bcb46928fd72bb7133927
2014-12-10 12:29:24 -08:00
Bartosz Dziewoński
64a954da74 Language: Correct getSpecialPageAliases() documentation
Learned the hard way.

Change-Id: I72044c71f064f78a0d2d50034bdffae1e5985cde
2014-09-26 15:48:55 +02:00
Brad Jorsch
ad522beeea More sensible behavior when special page aliases conflict
Right now, SpecialPageFactory::getAliasListObject() just chooses the
last-seen alias and allows any alias to completely override the page's
"canonical" name (from SpecialPageFactory::$list or $wgSpecialPages).
Although the latter doesn't come up often since (almost?) all special pages
have their canonical name as one of their English-language aliases.

More sensible behavior is to always prefer the "canonical" name over any
conflicting aliases, and to prefer an alias that's the first alias for a
special page over one that is a fallback.

Also, when a special page's first alias winds up not actually referring
to that special page, we MUST NOT go redirecting other names for that
special page to that wrong alias.

Bug: 70686
Change-Id: I4b17ec0fdc87b4b0d7ae9d9eea7ffacb54dd6891
2014-09-25 07:57:01 +00:00
Tim Starling
0e5e02c985 Add a process cache for fetchLanguageNames
Since it is slow and is called many times when articles with lots of
interlanguage links are viewed.

Change-Id: Ib826ea6f1c105ffd43e456fb1c0c3b8aa6d8e391
2014-09-24 16:03:16 +00:00
Tim Starling
f215a7216b Profiling for Language::fetchLanguageNames
It is 16% of an enwiki Main Page parser cache hit, under HHVM.

Change-Id: Ifb2ce7592fa5b5cb9c7fb5af5949c43fecf18ca3
2014-09-24 16:02:53 +00:00
jenkins-bot
96efe0bc66 Merge "Revamp classic edit toolbar not to hardcode paths in HTML" 2014-09-16 12:51:21 +00:00
Bartosz Dziewoński
285c52039b Revamp classic edit toolbar not to hardcode paths in HTML
Also, try out a way to have per-module LESS variables defined in PHP.
This might come in handy in the future… Maybe for skin theme support?

(I recommend reviewing the file changes in the order below. :D)

includes/resourceloader/ResourceLoaderFileModule.php
  * Pass the context (ResourceLoaderContext) deeper down via
    readStyleFiles() and readStyleFile(). We need it to compile the
    .less files for the right language.
  * Extract LESS compiler creation to getLessCompiler().
  * Allow passing a LESS compiler instance to compileLessFile(), rather
    than getting one after the method is called.

  All of the changes are backwards-compatible.

includes/resourceloader/ResourceLoaderEditToolbarModule.php
  * New module to support getting the language data and passing it to
    LESS variables.

  It might be a good idea to factor out a reusable class for a LESS
  module with additional variables, but that would require more
  attention to design than I gave it.

resources/src/mediawiki.action/mediawiki.action.edit.toolbar/mediawiki.action.edit.toolbar.less
  * Glue code to use the language data defined by the module above and
    put it in final CSS.

includes/EditPage.php
  * Do not hardcode image URLs in output HTML, as they are provided in
    CSS now. This gets rid of some usage of globals.

  In fact, we should be able to finally move the inline JavaScript
  calls out of getEditToolbar(), but I'm already introducing too many
  changes for one patch. That can be done later.

languages/Language.php
  * Add getImageFiles() to complement existing getImageFile() method.
    Misleadingly named, it returns paths for images for the toolbar
    only (and no other ones at all).

skins/common/ → resources/src/mediawiki.action/mediawiki.action.edit.toolbar/
  * Moved all of the button images to new location.

  Also, boring cleanup that was harder before because we treated the
  paths as public API:
  * Placed default ones in en/ subdirectory.
  * Renamed cyrl/ to ru/.
  * Renamed ksh/button_S_italic.png → ksh/button_italic.png.

languages/messages/
  * Adjusting paths and filenames for the changes above.

resources/src/mediawiki.action/mediawiki.action.edit.css
resources/src/mediawiki.action/mediawiki.action.edit.js
  * Added styles and updated the script to make it possible to have
    non-<img> elements as toolbar buttons.
  * Consolidated styles that were already required, but defined
    somewhere else:
    * `cursor: pointer;` (from shared.css)
    * `vertical-align: middle;` (from commonElements.css)

Bug: 69277
Change-Id: I39d8ed4258c7da0fe4fe4c665cdb26c86420769c
2014-09-13 23:16:23 +02:00
jenkins-bot
5f8b925781 Merge "Language: s/error_log/wfWarn/" 2014-09-09 19:50:03 +00:00
jenkins-bot
6353df13f7 Merge "Change @return to start with type" 2014-08-22 23:20:36 +00:00
Bartosz Dziewoński
1a008d6dcd Language: s/error_log/wfWarn/
This code path gets triggered when I run unit tests locally and
produces billions of lines of output. I don't care why, I just want it
to shut up.

Change-Id: I09a5cbaea80ff9d7afc22c83f972890cfa25d127
2014-08-21 20:28:22 +00:00
umherirrender
cd80906d4a Change @return to start with type
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
2014-08-20 20:35:41 +02:00
umherirrender
4245d06271 Fix @param of Language::dateTimeObjFormat
Follow-Up: Ib26407bc55dff7969d8a3b1e2ae51751b202d8fb
Change-Id: I078ffe3ff385f4541d91b2fb8ef9564138f78393
2014-08-20 19:36:37 +02:00
jenkins-bot
60ae7c8d3d Merge "Add missing @param to function docs" 2014-08-20 06:40:11 +00:00
umherirrender
6b4c44c2db Add missing @param to function docs
Change-Id: Ib26407bc55dff7969d8a3b1e2ae51751b202d8fb
2014-08-18 16:24:59 +00:00
umherirrender
14664e1dd8 Remove wrong type from @param of Language::viewPrevNext
Change-Id: I26634c23a966a60b94a1a9fc7b35449560b34492
2014-08-15 18:33:34 +02:00
umherirrender
c2de24efcd Add missing @param to function docs
Change-Id: Ib7ac94d05a04490f25dfd40b46b27973cbab582c
2014-08-14 19:38:57 +00:00
umherirrender
21e0c1c533 Correct variable names in @param to match method declarations
Some @param have a typo in the variable name,
some @param's were in wrong order.

Change-Id: Ie25806831027112b398f6f4a909c59147ac3a5fa
2014-08-13 21:48:28 +02:00
umherirrender
ae3c883150 Cleanup some docs (languages)
- Makes beginning of @param in capital
- Removed return void

Change-Id: Ie05436c1ef886cb23c62ccde95384f253f83694c
2014-08-09 22:20:15 +02:00
umherirrender
4ee680a8b3 Fixed spacing
- Removed spaces after not operator (!)
- Removed spaces inside array index
- use tab as indent instead of spaces
- Add newline at end of file
- Removed spaces after casts

Change-Id: I9ba17c4385fcb43d38998d45f89cf42952bc791b
2014-07-24 11:53:04 +02:00
umherirrender
abfa0d7854 Standardize @todo
Always use lowercase @todo
Changed some "@FIXME" to "@todo FIXME: "

Change-Id: I016d1f9511e6f3bbd22427f0fffeccd77ab5e0db
2014-07-23 22:27:20 +02:00
Chad Horohoe
fca0d37a2c Language::isValidBuiltInCode() should not accept uppercase input
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
2014-07-16 18:20:22 +00:00
jenkins-bot
9bb1b0f626 Merge "Handle invalid language code gracefully in Language::fetchLanguageNames" 2014-07-10 18:50:25 +00:00
umherirrender
a7a9039d18 Remove Language::getFallbackLanguageCode() (deprecated since 1.19)
Change-Id: Ie3a1505763d7c7358a7b913bb2a8177b18c5c5bd
2014-07-10 19:00:13 +02:00
Brian Wolff
634905558b Handle invalid language code gracefully in Language::fetchLanguageNames
Core MW doesn't have a problem, but translate extension explodes.
Seems safer to just use 'en' if passed an invalid language code.

Bug: 60629
Change-Id: I0ede3169bb49001a1515ae5b2b6d28477704f346
2014-06-30 17:52:03 -03:00
jenkins-bot
1b8657de2a Merge "Return a TTL when formatting times" 2014-06-24 22:57:17 +00:00
Reedy
495040e614 Update Language::userAdjust() $ts parameter hint to be string
Will technically still take an int (it's parsed around anyway), but
should be passed as a string

Mostly for HipHop stuffs

Change-Id: Id940028d581e34ca2e37a0730ca5766a08fc10e2
2014-06-18 23:00:23 +01:00
Max Semenik
67a377e39e Deprecate Language::getLangObj()
Since it is unused in core and extensions, I'm marking it both
with @deprecated and wfDeprecated().

Change-Id: I3a1bf96b805339e1438fcdd6e0aeb5922e53c4e8
2014-06-03 21:16:03 +00:00
Jackmcbarn
d998c8e96c Return a TTL when formatting times
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
2014-06-01 14:10:28 -04:00
Alexandre Emsenhuber
cbdb2ce364 Remove isset() check for $wgLocalTZoffset in Language.php
Do not use isset() to check for null; furthermore this variable
can no longer be null at this point now, so the check is useless.

Also remove the initial defintion of $minDiff since this was the
only case where it could be not set afterwards and fix spacing
after the comment.

Change-Id: I6e62ce1217e6e8750acb411673903fc3bde57841
2014-05-10 13:19:58 +02:00
umherirrender
37c0297296 Add missing @return in Language.php
Change-Id: I977bc5bf21235ce0f07cf0214597a37afad2b4eb
2014-05-01 18:38:42 +00:00
aude
60e1d9996c Fix Language::parseFormattedNumber for lzh and zh-classical
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
2014-04-25 08:52:54 +02:00
Siebrand Mazeland
4547200454 Put class FakeConverter in its own file
Change-Id: I84b256d668579a76034ad08c3bb763d33e7ffe31
2014-04-22 11:08:06 +02:00
Siebrand Mazeland
835b69e59b Make languages/ pass phpcs-strict
Change-Id: I0c4a68d140fae27857cbc3684fe51d7880d92118
2014-04-22 09:02:27 +00:00
umherirrender
55e8a9abfd Fixed some @params documentation (languages)
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.

Change-Id: I7a4dec6a8de96ee21ef34e52bb755f723aa3b0e6
2014-04-17 13:32:54 +00:00
Bartosz Dziewoński
59002d8935 Consistently use '@deprecated since <version>'
Variants included 'in <version>', 'as of <version>' and just the
version number.

Some @deprecated annotations do not have the version number at all,
I want to hunt them down separately.

Change-Id: I8208c6097098f4735d4f51bc42254675f1f27f6d
2014-04-15 22:18:19 +02:00
umherirrender
23fab68274 Fix spacing after @param and friends in comments
Searched for:
\@(param|return|throws|since|deprecated|access|todo|var)[ \t]{2,}

Change-Id: Icce22ba9fe0635455691ca58d9872d618151f346
2014-04-05 20:02:29 +00:00
jenkins-bot
912f53996e Merge "Cleaning up function definitions in Language.php" 2014-04-02 18:29:40 +00:00
kaldari
4cd2d67547 Cleaning up function definitions in Language.php
Some of these were confusing or incorrect.

Change-Id: I2dd02669a7cf9d8b92e2d5c1b86ab8c5e0cbf6bd
2014-04-02 11:24:41 -07:00
Siebrand Mazeland
8e0c0a9fc9 Preparations for migrating core to use JSON based i18n
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
2014-04-01 14:22:03 -07:00
addshore
87db0625d6 Remove doc about a file that doesnt exist
Change-Id: I1bcf0a8a9a10906b6078c3f45f864359f6d32eda
2014-02-25 12:50:42 +01:00
Chad Horohoe
423c0682c5 Remove deprecated convertLinkToAllVariants()
Deprecated since 1.17, not used anywhere in core or extensions

Change-Id: Id90ee1765899ea331a65ce372744ed465686c84b
2014-01-02 12:01:42 -08:00
Brian Wolff
dcc32e8ada Make Language::fetchLanguageName lowercase its first argument.
Currently Language::fetchLanguageName( 'en-GB' ) returns false as
it expects 'en-gb'. Given that technically speaking, 'en-GB'
is the canonical form, I don't think this is a good thing.

Changed function to lowercase its argument. There's no
Language object handy, so I just used strtolower (since language
codes are always ascii, that shouldn't matter)

Change-Id: Iba1f581bf2d6d2b26a14f9f80699d8eeb5d724d6
2013-12-21 16:28:25 -07:00
Pavel Selitskas
81fc875c0b Handle explicit plural forms in custom convertPlural in language classes
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
2013-12-03 12:50:02 +00:00
umherirrender
0bc583af2c Move closing parenthesis from multi line if and function to own line
The Line continuation Coding conventions prefers the closing parenthesis
on the same line than the beginning curly braces. This is done for ifs
and functions.
Also move some boolean operator from the end of a line to the beginning
and changed some indentation to make the condition hopefully better
readable.

Change-Id: Id0437b06bde86eb5a75bc59eefa19e7edb624426
2013-12-01 21:39:00 +01:00
UltrasonicNXT
87fe16c445 Prevent space before ellipsis when truncating
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
2013-11-15 14:29:18 -04:00
Alexandre Emsenhuber
4d23088642 Correct tooltip of "Next n results" on query special pages.
Was showing "Previous n results".

Bug: 56707
Change-Id: I9f51d70f9e1fe3c314a1226950f1324ab22f4199
2013-11-08 18:45:42 +01:00
physikerwelt (Moritz Schubotz)
545b712ed4 Mark Math-specific functions in core as deprecated
The math specific functions in core are not needed
anymore and should be removed in future versions.
Math can access these settings in the same way as
all other extensions do.

Since Math 2.0 the rendered element has the property
"markerType" => 'nowiki'

Change-Id: I20d3714bed9da864146f133a08cf4ca90eda42ab
2013-11-06 17:41:31 +01:00
Brad Jorsch
db9c4cb3cf Remove linkprefix message, add $linkPrefixCharset
The existing "linkprefix" message is unlikely to be accurately
customized by message translators (as shown by the fact that, of the 10
distinct customizations prior to Iaa7eaa44 (which made them even more
complicated), 3 were broken or entirely ineffective, 1 was half
ineffective, and 2 more seem to have included the Latin-1 Supplement by
accident) or by local wiki admins. So, like linktrail before it, let's
move it out of the system messages and into a separate language
variable.

At the same time, let's make it a simple character set (like
$wgLegalTitleChars) rather than a complicated regular expression. The
complicated regex now lives in the parser.

This also adjusts the output of the API's action=query&meta=siteinfo and
adds an accessor parallel to the linkTrail accessor to Language.

Note the following changes that are not simply extracting the existing
charset from the linkprefix message for $linkPrefixCharset:
* The En message matched all non-ASCII UTF-8 characters by matching the
  component bytes (\\x80-\\xff). The new character set is equivalent.
* Various languages were identical to En and so have no $linkPrefixCharset
  set. These are: Ary Az Ce Ga Id Ka Kiu Km Ltg Mk Ms Ne Nn Ro Roa_tara Sc Si
  Sr_ec Sr_el Tl Tt_cyrl Tt_latn Ug_arab War
* Cu, Uk, and Udm are changed to match any number of „ or « in the prefix.
* Cv tried to include "«" that was redundant to the range \\x80-\\xff
  (see En comment). This was removed.
* Diq was entirely bogus, and so was removed.
* Gu included many additional UTF-8 characters that are redundant to the
  range \\x80-\\xff (see En comment). These were removed, and the
  resulting character set is equivalent to En.
* Mt has been broken since it was introduced in r37242. The charset used is
  equivalent to the broken regex.

Bug: 56031
Change-Id: I3369851b33113fc118a1bace38f3ac310cdd9725
2013-10-29 19:06:15 -04:00
Kevin Israel
725df97b1b Deprecate wfDebugDieBacktrace
Change-Id: I12336983e29524a450fc61ed9df4d840066be9b6
2013-09-27 19:57:41 -04:00
jenkins-bot
a14bcc6ebe Merge "Replace Pakaran with Punjabi" 2013-09-25 22:24:24 +00:00
Amir E. Aharoni
3d478ff654 Replace Pakaran with Punjabi
These are Punjabi digits. I couldn't find a "Pakaran" language.

This was added in 5d00cad9.

Change-Id: I94649b7e5c3c6c9666accee561b12166552d50cb
2013-09-25 15:12:54 -07:00
shirayuki
b7313c40c5 Replace single to double-quotation marks
Give grep a chance to find the usages

Change-Id: I95431f8e5cc684c322fdd7cda041388120b7c49b
2013-09-22 11:33:50 +09:00
Kevin Israel
12c61d3e7f Remove remaining calls to MWInit methods
... as well as the require_once statements in includes/WebStart.php
and maintenance/doMaintenance.php, now that the autoloader lists
MWInit (since r85807 / c68957c5e3).

Also removed code paths in maintenance/userDupes.inc that seem to be
dead (class_exists( 'Revision' ) should always be true) and useless
global/require_once statements in languages/Language.php.

Follows-up Ic3e769f1fbad4f7ad26dd819406796fee48c6b45.

Change-Id: I48fd6810fdb923b3065ae98024912eb18d394415
2013-09-15 19:04:08 +00:00
jenkins-bot
edb4ed713c Merge "No spaces after (casts)" 2013-09-04 18:14:05 +00:00
MatmaRex
df8ec1e216 No spaces after (casts)
Also removed some unnecessary ones. I think I've caught them all.

The spaceless version already appears in core ~300 times (after
accounting for false positives when grepping). Some consistency would
be nice.

Change-Id: I607655b5f4366e66dc78730d5fd2f57ed8776cae
2013-09-04 20:05:43 +02:00
jenkins-bot
522eaf5165 Merge "Add/update comments for grep" 2013-09-03 13:32:28 +00:00
jenkins-bot
b8af5d9485 Merge "Add converted namespace names as aliases to avoid confusion." 2013-09-02 17:47:46 +00:00
shirayuki
1d49f19e65 Add/update comments for grep
Change-Id: I6402a593872480cac4b76492957771529c1adeb8
2013-08-31 17:03:05 +09:00
jenkins-bot
57f156a8a1 Merge "doc: Remove repetitive "Give grep a chance" phrase from comments" 2013-08-29 20:32:38 +00:00
Timo Tijhof
90749a261c doc: Remove repetitive "Give grep a chance" phrase from comments
* Follows-up b2e2b2e016.
* Minor clean up of surrounding documentation comments.
* Fixed missing keys for messages in WebInstallerPage

Change-Id: Iaa692064262f3c0e10cfa5e4b1ec8c86e5d02362
2013-08-29 10:46:46 -07:00
jenkins-bot
b4788865c2 Merge "Make FakeConverter more realistic" 2013-08-29 15:11:22 +00:00
Liangent
ff507e09ec Make FakeConverter more realistic
Spotted by Aude in I38298ceb.

Change-Id: I5c5605770077752cd189a5a5f1233949e6eec1d8
2013-08-20 21:58:38 +00:00
shirayuki
b2e2b2e016 Give grep a chance to find the usages
Change-Id: I18846326539b814fa7fa93ca54117dac3572e4b0
2013-08-16 22:07:38 +09:00
Liangent
d0e3dc94c3 Add converted namespace names as aliases to avoid confusion.
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
2013-08-13 13:01:40 +00:00
Santhosh Thottingal
ea6e1c932e Correct the regular expression for explicit plural forms
/\d+=/ will match a12=abc. That is wrong. The plural form must
start with digits. Changing it to /^\d+=/

Also avoid Regex instance creation in mediawiki.language.js, use
literal regex.

Follow up: I82b9067 and I50eb0c6
Bug: 51284

Change-Id: I70ad3f99ad0a2600773c005d9e9cc8238e6e6d09
2013-07-23 20:38:52 +05:30
jenkins-bot
b8f9b16b84 Merge "New function Language::getParentLanguage()." 2013-06-28 15:15:04 +00:00
Kevin Israel
876bddf637 Change @since and @deprecated notes to 1.22
Using the following command line, I have found doc comments mentioning
"1.21" when they should mention "1.22" instead, which I have fixed
manually:

git diff REL1_21 | grep --color=always -C 10 -iE \
'^\+.*(since|deprecated).*1\.21(\D|$)' | aha > oldver.html

I also moved the release notes for I1987190f ("Combine JavaScript and
JSON encoding logic") from RELEASE-NOTES-1.21 to RELEASE-NOTES-1.22
because I had reverted the commit on REL1_21 only (see Id3b88102 and
bug 47431 for the rationale).

Change-Id: I11b917a371e07267dfa98b8449776d0c1cb29b15
Follows-Up: I25cf5a94f6e47f85a9d0b80cc1c9c9f957288478
Follows-Up: I3d72e4105f6244b0695116940e62a2ddef66eb66
Follows-Up: I3faa9c3e8107c6e46cdf21f8c18adda1f42890d7
Follows-Up: I6aab19c8d68bf47beddad42632b0360a7b12f251
Follows-Up: I86368821fc2cd0729df5342b8572eb470c0f77a0
Follows-Up: Id3b88102e768318e3605a19e9952121091a40915
Follows-Up: Ie667088010e24eb6cb569f9e8e8e2553005223eb
2013-06-21 05:33:22 +00:00
Niklas Laxström
a7a693f4b0 Avoid exceptions by first checking language code validity
Bug: 49423
Change-Id: I3fd98ba08393856311a48fa40769027460c72ef9
2013-06-13 09:35:32 +00:00
Liangent
396e18a8e5 New function Language::getParentLanguage().
Change-Id: Ib2109176b7dfc7ec2d0ee827c804cf93ea83b9e5
2013-06-10 18:07:49 +00:00
Antoine Musso
780ec298da Micro optimization when fetching a magic from cache
The Language::getMagic() methods would request a full copy of the magic
words array from the cache.  Instead use LocalisationCache::getSubitem()
to only fetch the magic word we are interested in.

I do not think that makes that much of a difference, but that is
certainly nicer.  Note that getSubItem() returns null on miss instead of
the previous 'false', that still works for the !is_array().

Change-Id: I02824fd313eeecb5e5b26cb79d7b5549f6648f91
2013-05-30 15:42:34 +00:00
jenkins-bot
525f157e17 Merge "Enable fallback languages when retrieving messages" 2013-05-26 14:02:27 +00:00
Tyler Romeo
86b54375de Enable fallback languages when retrieving messages
The core function behind wfMessage() (MessageCache->get()) did not
apply the language fallback chain to on-wiki messages.

This patch has changed the behavior to iterate over all possible
languages, first checking on-wiki and then checking the CDB cache,
until it finds the message. Note that fallback languages never
take precedence over the actual requested language.

This patch was taken from the following changes and then
adjusted to fix issues that caused bug 46579.

* Change-Id: Iaaf6ccebd8c40c9602748c58c3a5c73c29e7aa4d
- Author: Matthew Walker <mwalker@wikimedia.org>
- (cherry picked from commit d434bfcf3b)
* Change-Id: Ib607a446d3499a3c042dce408db5cbaf12fa9e3d
- Author: Mormegil <mormegil@centrum.cz>
- (cherry picked from commit 1b8cb8dc31)

Bug: 1495
Bug: 46579
Change-Id: I420457863eeb79824698d06abc7784032b267af2
2013-05-26 15:46:35 +02:00
Kevin Israel
d510d0c0c7 Language::convertPlural: check if matching form exists
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
2013-05-25 19:30:53 -04:00
Timo Tijhof
beb1c4a0ec phpcs: More require/include is not a function
Follows-up I1343872de7, Ia533aedf63 and I2df2f80b81.

Also updated usage in text in documentation and the
installer LocalSettingsGenerator.

Most of them were handled by this regex:
- find: (require|include|require_once|include_once)\s*\(\s*(.+?)\s*\)\s*;$
- replace: $1 $2;

Change-Id: I6b38aad9a5149c9c43ce18bd8edbab14b8ce43fa
2013-05-21 23:26:28 +02:00
Tim Starling
1fe9340bb3 Remove hphpc support and deprecate related functions
hphpc has been superseded by hhvm, so support for hphpc is no longer
needed.

* Continue to use Preprocessor_Hash under HipHop since it is still
  faster under hhvm
* Keep $wgCompiledFiles for now, so that wikihiero doesn't give an error
  before Ic9d1e795 is merged
* Migrate the run-server script and associated configuration file to
  hhvm. Enable EnableStaticContentFromDisk since it doesn't seem
  ridiculously inefficient at first glance. Run from $IP rather than
  $IP/.. since hhvm is apparently not picky about sourcing files from
  outside of the current directory.

Change-Id: Ic3e769f1fbad4f7ad26dd819406796fee48c6b45
2013-05-09 08:28:05 +10:00
lwelling
31fe5f54b7 Code style fixes in Language::isValidCode()
Fix issues from https://gerrit.wikimedia.org/r/#/c/62123

Change-Id: I97e826bb9aa9e3a14d07aab7cf02a09ef2c84ef7
2013-05-04 04:44:15 +00:00
lwelling
04a9d80e53 Cache result of Language::isValidCode() to avoid regex processing
The function can be called over 2000 times in generating a page. This way
is significantly faster even for random invalid codes.  For real use it
should avoid the regex most of the time with no change in behavior.

Change-Id: I9fcbae1770be0d3f405d3d12254c11943b0d5f46
2013-05-02 20:41:18 -04:00
jenkins-bot
9cd8ce5034 Merge "Add input checks for Language::sprintfDate()" 2013-04-29 08:50:08 +00:00
umherirrender
9f14ecf829 Added space after switch/Removed spaces after unset
While at it, added/removed some other spaces in the same files

Change-Id: I84d8001aa123a008807ad5eb76f396aed7c899a4
2013-04-26 16:42:31 +02:00
Siebrand Mazeland
35f0a66f32 Add input checks for Language::sprintfDate()
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
2013-04-26 10:05:18 +02:00
Kevin Israel
47d1060398 Remove is_numeric check from Title::checkUserBlock
This should allow the usernames of administrators such as "7"
to show correctly on permissions error pages.

I extracted the working code from UserBlockedError::__construct
into a separate method Block::getPermissionsError, called from
both places with context provided as an argument.

Additional changes to get the test suite to pass are included.

Bug: 46768
Change-Id: I49d973992a99e03b4e8de112b47b737037a85338
2013-04-24 01:05:23 +00:00
Tyler Anthony Romeo
7e3386d417 Refactor MWTimestamp::getHumanTimestamp and add hook.
Changed logic in MWTimestamp::getHumanTimestamp so that
all the message and formatting was offloaded into the
Language class, keeping only actual timestamp logic in
the MWTimestamp class.

Also added a hook so extensions can override the
human timestamp format.

Change-Id: Ie667088010e24eb6cb569f9e8e8e2553005223eb
2013-04-22 12:07:22 -07:00
jenkins-bot
4201c52ff3 Merge "Got rid of some global $wgContLang usage in SpecialAllpages" 2013-04-18 00:03:40 +00:00
Daniel Werner
751ffdb096 Got rid of some global $wgContLang usage in SpecialAllpages
Using $this->getContext()->getLanguage() instead now. In SpecialAllpages::showline
the global is still being used and a comment added. It could be argued about whether
the content language or the user language should be used in that place.

Also added some missing documentation to Language::getNamespaces.

Change-Id: If511e2d9edb0f0092f3ca0ceadabd7fdb72f6c06
2013-04-17 21:32:31 +02:00
umherirrender
3c7bcf4658 Fixed spacing in languages folder
Added spaces before if
Added some braces for one line statements

Change-Id: I980771894369499646532b13b801db6447381773
2013-04-17 21:10:02 +02:00
umherirrender
15abcf71ca Added/Removed spaces around string concatenation
And added/removed spaces around some other tokens,
like +, -, *, /, <, >, =, !

Fixed windows newline style

Change-Id: I0b9c8c408f3f6bfc0d685a074d7ec468fb848fc8
2013-04-13 13:36:24 +02:00
Brad Jorsch
e9e1b0a777 (bug 33454) Add timezone support to Language::sprintfDate
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
2013-04-09 22:49:04 +00:00
jenkins-bot
dd0cf067a3 Merge "Avoid fatal errors with uselang=s" 2013-04-08 14:36:17 +00:00
MatmaRex
a8fbbcf98d Remove the "Quickbar" feature and all things related to it
"Quickbar" was a feature of the Standard and CologneBlue skins that
allowed the sidebar to be displayed on left or right side of the page,
floated or fixed, and hidden on diff pages.

Standard was removed (Ia6d73c2d), and CologneBlue doesn't support this
anymore (bug 41246), so all things quickbar can now be safely removed.

* Removed user prefs option + interface
* Removed related messages
* Removed code for this in SkinLegacy
* Removed dead code in DifferenceEngine and Language

Change-Id: I5e6f7d48d6904a052a3a11547d3ebe6161463018
2013-04-07 04:08:05 +02:00
Niklas Laxström
022aa97b20 Avoid fatal errors with uselang=s
languages is not a subclass of Language

Force valid built-in language codes to be at least two letters long.

Bug: 46710
Change-Id: Ife8885ed4bdb3a017a54e063f5dc58468ba231d5
2013-04-05 14:04:02 +00:00
Siebrand Mazeland
9d7e9c3141 Revert changes in fallback behavior
This patch set reverts the following:
* Iaaf6ccebd8c40c9602748c58c3a5c73c29e7aa4d
* Ib607a446d3499a3c042dce408db5cbaf12fa9e3d
* Ic59fd20856eb0489d70f3469a56ebce0efb3db13 (partially)

Bug 46579 comment 17 describes a desired solution. In
If88923119179924a5ec091394ccab000ade16b3e we are working on a fix, but it is
taking longer than we anticipated. There was a deployment window planned
about now, but we didn't make it. It makes sense to revert for now, and commit
a proper solution somewhere next week.

Bug: 46579
Bug: 1495
Change-Id: Iac7ac4357dd80e8cdb238a6a207393f0712b3fe5
2013-03-28 10:32:02 +00:00
Mormegil
1b8cb8dc31 (bug 1495) Include the site language in the fallback list
In Iaaf6ccebd8c40c9602748c58c3a5c73c29e7aa4d, the behavior of MessageCache
was changed so that it iterates over all possible on-wiki fallbacks including
the site language fallbacks. However, it omitted the site language itself.
Obviously, the problem appears only when the site language is not English,
because English is included always as the fallback language of last resort.
But in other cases, we need to add it explicitly.

Bug: 1495
Change-Id: Ib607a446d3499a3c042dce408db5cbaf12fa9e3d
2013-03-25 23:50:47 +01:00
Kaldari
06b0967caa Allow the retrieval of the plural rule type for a given number
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
2013-03-20 14:34:12 +05:30
jenkins-bot
ba3b38ac95 Merge "Use gettype only for debugging text" 2013-03-18 18:44:59 +00:00
umherirrender
926d2ee143 Remove spaces between parentheses in function calls
Change-Id: If8ec665a01b566fa5189dfcc810b2d9a17f371e1
2013-03-17 16:13:22 +01:00
umherirrender
3dd97bf651 Use gettype only for debugging text
Changed some gettype == 'array', 'object' and similar to is_array,
is_object or similar

Output of gettype must not stable across versions and it is slow

Change-Id: I07bfc063b03be1200989dd6facee66b35ab51d77
2013-03-15 22:50:42 +01:00
Matthew Walker
d434bfcf3b (bug 1495) Enable on-wiki message language fallbacks
The core function behind wfMessage() (MessageCache->get()) did not
apply the language fallback chain to on-wiki messages.

This patch has changed the behavior to iterate over all possible
on-wiki fallbacks (starting with the user's language) before
using the built-in language cache (CDB files). Previously we only looked
for the existence of an on-wiki message in the users's language.

Performance wise, using the 'ab' language ('ru', 'en' fallbacks)
MessageCache::get (Averaged over runs and calls)
New Code: ~8.5% TET (110us/call)
Old Code: ~6.5% TET ( 90us/call)

TET: Total Execution Time

Change-Id: Iaaf6ccebd8c40c9602748c58c3a5c73c29e7aa4d
2013-03-06 19:54:02 +00:00
jenkins-bot
78271824d2 Merge "(Bug 44987) Allow n=form in plural syntax" 2013-02-26 15:27:31 +00:00
jenkins-bot
3fca4cbe5d Merge "(bug 35753) Allow {{FORMATNUM}} to only do digit transform" 2013-02-26 08:40:00 +00:00
Pavel Selitskas
eadd393a81 (bug 35753) Allow {{FORMATNUM}} to only do digit transform
{{formatnum:1234567.89|NOSEP}} will perform only digit transformations.

Change-Id: Ic882d5ba087665030144e85248680acece8aa901
2013-02-26 08:30:16 +00:00
Santhosh Thottingal
ff3df41363 (Bug 44987) Allow n=form in plural syntax
phpunit testcases included

Change-Id: I7be51e24a0b953dcd1f9cb21f54af9b4127a5cdb
2013-02-14 15:32:46 +05:30
Antoine Musso
7006e1df93 style: fix up commas in function arguments
Fix up spaces in our function calls, we do not want spaces before a
comma and try to avoid multiple commas whenever possible.

Errors:

* No space found after comma in function call
* Space found before comma in function call

Change-Id: I51aec02016f742422fa60b92ad35ba3f0ef59ba3
2013-02-06 19:30:39 +01:00