Commit graph

244 commits

Author SHA1 Message Date
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
umherirrender
073abe3e12 No variable assignment on return statement
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
2014-01-02 09:43:35 +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
umherirrender
5ca5672aac Fixed spacing
- Place commas correct
- Moved comments
- Add space after if/foreach/catch
- Reformat some conditions
- Removed trailing spaces/tabs

Change-Id: I40ccda72c418c4a33fcd675773cb08d971510cdb
2013-12-01 20:58:51 +01:00
Niklas Laxström
b1ab14c26e Increase LanguageConverter cache version
It stores ReplacementArray objects, which had changes in
I1b2e3360468cbfc8.

Bug: 56911
Change-Id: Ief8f4848ab33ae3cb3356e60030f76f20f135dcb
2013-11-11 19:44:36 +00: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
Liangent
325632162c Don't match HTML entities in language conversion syntax
RegEx provided by Gabriel Wicke.

Change-Id: Idca127acc6f4cdc159ee85d5f816a5d120cbe44e
2013-09-15 18:16:54 +00:00
jenkins-bot
b8af5d9485 Merge "Add converted namespace names as aliases to avoid confusion." 2013-09-02 17:47:46 +00:00
Liangent
3a06dd9be9 Allow more than one variant set in user preferences.
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
2013-08-16 05:46:14 +00: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
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
Timo Tijhof
b7bec085ce Drop redundant attributes in hardcoded html
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
2013-05-21 01:05:12 +02:00
Timo Tijhof
4bd5471ca3 docs: Remove odd colons after @todo
Most were this way already:
https://doc.wikimedia.org/mediawiki-core/master/php/html/todo.html

Ran a find/replace on the odd ones. Also made them all
lower case.

Change-Id: I70c6a69344ddebc603e9a1c1d87e3cc4f4f4c560
2013-05-15 06:23:40 +00:00
Liangent
8d882c8ec1 Fix I25cf5a94: It should be @since 1.21 now.
That patch was created before 1.20 release and has stayed there for a
long time...

Change-Id: Icd28f749d55dd820e142ba094c848b713d9548ab
2013-05-07 05:10:46 +00:00
Liangent
9e9ee49c54 Partly disable title conversion if variant == main language code
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
2013-05-03 06:16:19 +00:00
umherirrender
bfb75bc8e2 Fixed spacing around parenthesis in languages/tests/maintenance
Change-Id: Idd4299d17f1fcf98ab1d635484cb4e880f35ee24
2013-04-28 15:57:34 +00: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
Liangent
080a017fd9 Use MessageCache::getMsgFromNamespace() to fetch conversion tables.
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
2013-03-28 13:47:56 +08:00
Liangent
27950be750 Use proper function recursiveConvertTopLevel() in recursive conversion
so that conversion of alt and title attrs doesn't clear converter state.

Change-Id: Icb6e5e1fa71768ac306c9ac4bca9f58845a3e457
2012-12-21 17:55:57 +08:00
jenkins-bot
2b69c9525b Merge "Reset $mConvRuleTitle before every language conversion run" 2012-12-07 16:16:40 +00:00
Liangent
02829164cd Reset $mConvRuleTitle before every language conversion run
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
2012-12-07 23:48:33 +08:00
umherirrender
82375631c2 Fix tabs inside/between statements/text
This tabs are strange and a space there is better

Change-Id: I0885dff575ee2fcd0668d08fef3226e132c5b319
2012-10-26 18:18:59 +02:00
Siebrand Mazeland
4b62b0339c Prefix new ContentHandler hooks in WikiPage with Page instead of Article
Covers 3 hooks:
* ArticleContentInsertComplete -> PageContentInsertComplete
* ArticleContentSave -> PageContentSave
* ArticleContentSaveComplete -> PageContentSaveComplete

Change-Id: I186669a5941d8982725ed364b481215d291b2043
2012-10-11 18:22:52 +02:00
Siebrand
ba25ed9ee0 Merge "Convert -{}- markups in title="" and alt=""." 2012-10-10 07:46:26 +00:00
Liangent
b9f7fe0bcf Display converted namespace names in Html::namespaceSelector().
By the way, the code to get converted titles and namespaces
has been cleaned up.

Change-Id: Ifcbd56c989d83b9d32dfa99e0b2f06d01e17a2bd
2012-10-10 16:53:17 +11:00
Liangent
e4bae8bca4 Check headers for default variant when initializing default user options.
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
2012-10-10 04:31:59 +00:00
daniel
a138706729 Fix usage of deprecated ArticleSaveComplete hook in core
Change-Id: Ic01fd95d50a909470d6f0ffd93c972322789d49a
2012-10-08 14:13:59 +02:00
daniel
c546fae8ed merge latest master into Wikidata branch
Change-Id: Id4e0f40c03679c13d8934a6add99b5cd86d0437d
2012-10-08 13:58:54 +02:00
Marius Hoch
652c4be7c2 Clean up: Declare variables with public instead of var
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
2012-09-14 21:00:00 +02:00
Liangent
21ffa7a078 Convert -{}- markups in title="" and alt="".
convertTo() is used to replace translate() currently in use to
do conversion for some attributes of HTML tags.

Change-Id: Iee3ec2913787f15616abe6cf8880b59a883c82a0
2012-09-01 02:46:15 +08:00
daniel
9994968774 merged master
Change-Id: Ib2b879c4daa17401eeeb50767c0e5a54254855c3
2012-08-29 15:20:15 +02:00
Daniel Kinzler
392af46809 Revert "merged master"
This reverts commit 67bfdc7a68
2012-08-29 13:14:49 +00:00
daniel
67bfdc7a68 merged master
Change-Id: Ib2b879c4daa17401eeeb50767c0e5a54254855c3
2012-08-29 12:06:38 +02:00
Liangent
a6d845f5c2 Check fallbacks correctly in getHeaderVariant().
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
2012-08-24 03:21:01 +08:00
daniel
29719f846b merging latest master
Change-Id: I36b7f2f63ab8c08f8412d521dc68ea45c8b67711
2012-08-20 16:55:28 +02:00
Alex Monk
2fabea7eea Use wfMessage instead of deprecated wfMsg*
Or $this->msg in special pages.

Change-Id: I774a89d646615053c8424050e42ad95601f92543
2012-08-18 14:11:05 +02:00
IAlex
3bd225272c Merge "(bug 24521) Move hard coded "code error!" to messages" 2012-08-08 18:35:28 +00:00
robin
fd138d9e35 Update languagesWithVariants
Add Uzbek (uz) to LanguageConverter::languagesWithVariants
It has a converter since gerrit change 15690

Change-Id: Ie9511453a50eaed9ad6c03355badc4daa5b06e0a
2012-08-02 12:17:58 +02:00
daniel
c0b50eb47d merged master
Change-Id: I6afafe971afb3f38fc8f1e66ba409283b8a698f8
2012-08-02 11:01:22 +02:00
Liangent
8743c3a467 (bug 24521) Move hard coded "code error!" to messages
Change-Id: I43f064ce577da9918fea7430e5bda0853af236e3
2012-08-02 00:52:16 +08:00
umherirrender
e913e285a8 make list of 'Languages that support variant conversion' dynamic
see bug 33223. Placing this list in LanguageConverter,
so people see the list, when adding new Converters

Change-Id: I088bc1f0ea01d7d6e02c736261311919a0956a57
2012-07-19 20:49:55 +02:00
daniel
2ce15203a6 getting rid of getRawText() 2012-06-08 08:34:38 +02:00
Nikola Smolenski
598d96d24c - Fix bug 35076
- More tests, test comments

(This is the same as r114049.)

Patch set 2: Squash in missed test file

Change-Id: Icaf7fdd11499c64c42b46e442c158f22309345a7
2012-04-10 13:39:46 -04:00
Aaron Schulz
10f49bd065 [LanguageConverter] Added some cache code based on the problems in r97512.
* 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
2012-04-06 13:26:17 -07:00
Brion VIBBER
9994758337 Revert "[LanguageConverter] Added some cache code based on the problems in r97512."
This reverts commit 3b8dbbd502 -- merged prematurely, needs add'l discussion
2012-04-06 18:41:27 +00:00
Aaron Schulz
3b8dbbd502 [LanguageConverter] Added some cache code based on the problems in r97512.
* 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
2012-04-06 11:01:47 -07:00
Sam Reed
dedc5a1613 Add to documentation
Add a couple of braces

Update code calling Language related deprecated code
2012-03-05 19:17:55 +00:00
Sam Reed
6488754dad More documentation improvements 2012-02-09 21:17:18 +00:00
Daniel Friesen
42e8b0a8e7 Replace get{Local,Full,Link,Canonical}URL's $variant argument with a secondary $query argument and treat variant paths like we do action paths. 2011-12-12 19:19:23 +00:00
Alexandre Emsenhuber
eedc9712a9 Fixes for LanguageConverter::parseCachedTable() (seems really broken for subpages at the moment):
* 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
2011-11-26 15:12:23 +00:00