Split the variable assignment and the return statement in two lines for
better readability.
When there was two return statements in one method the logic was swapped
to have only one return statement.
Change-Id: Id7a01b4a2df96036435f9e1a9be5678dd124b0af
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
- Place commas correct
- Moved comments
- Add space after if/foreach/catch
- Reformat some conditions
- Removed trailing spaces/tabs
Change-Id: I40ccda72c418c4a33fcd675773cb08d971510cdb
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
Now with the introduction of page language, a site can have pages
in all languages, and different languages have different variants.
This patch allows users to set preferred variants for every page
they may see on the site.
Change-Id: Ie7e82bee0b1f8f902b38bb4a464cf0ebc4df4d89
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
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
Follows-up 97caae596d which makes HTML5 the default
and removes support for XHTML 1.0 and HTML < 5.
* <script type>
* <style type>
* <html xmlns>
* Quick-closing slash in non-XML HTML5 documents
Change-Id: I71855fa8d4095a5a448ebdc3dc36506ddab6f70c
Currently the main language code means "no conversion",
but may technically be used as a standalone variant (and
usually falls back to another variant). However for the
page title, since there can be a nice unconverted version
from real page name, it seems better to provide people who
choose "no conversion" with this unconverted version, rather
than a fallback from a variant which is always converted.
If a string targeting exactly the main language code exists
(ie. no fallbacks needed), it's still used. Because the
magic word DISPLAYTITLE cannot be used together with
language conversion syntax and people must use -{T| }- to
show a modified display title for "no conversion" version.
Change-Id: I25cf5a94f6e47f85a9d0b80cc1c9c9f957288478
After Iaaf6cceb, MessageCache::get() goes through the fallback chain,
which is unwanted for conversion tables (for example, we don't want
zh-hans table for zh, where zh means "no conversion"). Since the only
needed feature is to fetch text from MediaWiki namespace (conversion
tables in PHP are stored somewhere else), it is now changed to use
MessageCache::getMsgFromNamespace() instead to avoid fallbacks.
Change-Id: I46e0be31c9c0fe0a6e4923fc1aff0fbbadbf1d67
When conversion is run more than once, and manual title conversion is
only used in some of them, the result of title conversion is incorrectly
applied to all output after where it's really used.
In the past nothing has been broken because the converter is run for at
most one page (so at most one page title) in one request but this is not
true anymore when parser tests come.
Change-Id: Id689feaeff93acb859f7ba8d2aec0d7dbb5d1b6c
Currently, if a user with Accept-Language: zh-tw header accesses a zh site,
the page contents are served in zh-tw variant, but the interface language
is zh (falling back to zh-hans) so the user is seeing interface messages
in zh(-hans) unless a &variant= is manually set (originally variant set in
URL is checked by getDefaultVariant).
There were debates that serving different languages based on headers from
the same URL breaks cache, but currently contents are served in different
variants based on headers and it works. So I assume this is not an issue.
PS2-4: HTTP header settings shouldn't affect user preference settings of
logged-in users.
PS5-6: Move code loading variant settings for anonymous requests from
User::getDefaultOptions() to User::loadOptions() to avoid pollution of
defaults. A visual bug of this is that if I have variant set to zh and
load index.php?title=Special:Preferences&variant=zh-cn, the dropdown is
shown as zh-cn because I was using the default value and now it thinks the
default value is zh-cn instead of zh.
PS7-8: Rebase to add dependency and tweak commit summary etc.
PS9: Remove the argument added to getDefaultVariant, which was intended to
keep B/C of getDefaultVariant (not to check headers by default).
Change-Id: Ie600ab24294a1add804875e921c32febe6ed645f
Variables in classes should be declared using public $foo
instead of var $foo for various reasons. As we require PHP 5.3
we don't have to take care about that PHP4 left over, but can
get rid of it in favour of the more clear and better readable
public.
See also: http://php.net/manual/en/language.oop5.visibility.php
(Divided into several commits to keep reviewable)
Change-Id: Ic723d0347ab2e3c78bc0097345c68bbee3dc035a
convertTo() is used to replace translate() currently in use to
do conversion for some attributes of HTML tags.
Change-Id: Iee3ec2913787f15616abe6cf8880b59a883c82a0
Currently when users with Accept-Language: en accesses a zh site,
getVariantFallbacks() returns zh for it and zh is treated as their
preferred variant as header variant, making the configuration
setting $wgDefaultLanguageVariant ignored.
Per comments above getVariantFallbacks(), it returns the main
language code for an unknown variant (en in this case), so when
it's returning the main code, just ignore this fallback (when the
user is really sending Accept-Language: zh, it can be caught by
validateVariant() above and fallbacks are not consulted).
Change-Id: I187bdcd70b778883cc80ceeab005de3aca2e286a
Add Uzbek (uz) to LanguageConverter::languagesWithVariants
It has a converter since gerrit change 15690
Change-Id: Ie9511453a50eaed9ad6c03355badc4daa5b06e0a
see bug 33223. Placing this list in LanguageConverter,
so people see the list, when adding new Converters
Change-Id: I088bc1f0ea01d7d6e02c736261311919a0956a57
- More tests, test comments
(This is the same as r114049.)
Patch set 2: Squash in missed test file
Change-Id: Icaf7fdd11499c64c42b46e442c158f22309345a7
* Added $wgLanguageConverterCacheType global to control LC cache type. We can use it to enable direct apc use for language converter (to match the live hack).
* Added $wgLangConvMemc object, available via Setup.php
Change 1:
* Updated unit tests
* Minor documentation cleanup in DefaultSettings.php
Change-Id: Icd5dd28407e9759ce294c784ec41d9ca15c89616
* Added $wgLanguageConverterCacheType global to control LC cache type. We can use it to enable direct apc use for language converter (to match the live hack).
Change-Id: I04616469aa53ccd1a5ce51af50a18acca5bb8bc4
* Use Revsion::newFromTitle() to get the text instead of Article, avoids interference with "oldid" URL parameter. Also Article::getContents() (with final "s") does not exist and would throw a fatal error.
* Check if $subpage is empty before using the message cache instead of '/' in $code
* Early return if the page contains no text