aboutsummaryrefslogtreecommitdiffstats
path: root/languages/classes/LanguageZh.php
Commit message (Collapse)AuthorAgeFilesLines
* Move Language subclasses to includes/Timo Tijhof2021-08-041-78/+0
| | | | | | | | | | | | | | | | Depending on which namespace we want these classes to have after T166010 they could either stay in includes/languages/ (plural) in their own MediaWiki\Languages\-namespace dedicated to Language subclasses, or they could go in into a subdirectory like `includes/language/languages/` if we want to keep them in the same top-level namespace as other Language classes and services, but in a more nested namespace. For now, I've made the smaller change and kept the Language subclasses in their own directory directly under includes/, not nested further. Bug: T225756 Change-Id: I01015424707b442853879fd50c97f00215e5c2fa
* languages: Move Converter and tests to respective filesPeter Ovchyn2020-02-031-104/+1
| | | | | Bug: T226833, T243760 Change-Id: I6fc7f267098d663fbefd0e78457726c343c9b3e4
* languages: Introduce LanguageConverterFactoryPeter Ovchyn2020-02-031-53/+35
| | | | | | | | | | | | | | | | | | | Done: * Replace LanguageConverter::newConverter by LanguageConverterFactory::getLanguageConverter * Remove LanguageConverter::newConverter from all subclasses * Add LanguageConverterFactory integration tests which covers all languages by their code. * Caching of LanguageConverters in factory * Make all tests running (hope that's would be enough) * Uncomment the deprecated functions. * Rename FakeConverter to TrivialLanguageConverter * Create ILanguageConverter to have shared ancestor * Make the LanguageConverter class abstract. * Create table with mapping between lang code and converter instead of using name convention * ILanguageConverter @internal * Clean up code Change-Id: I0e4d77de0f44e18c19956a1ffd69d30e63cf51bf Bug: T226833, T243332
* Set method visibility on languages classesUmherirrender2019-12-091-2/+2
| | | | Change-Id: I5db62d8243ce3abd7c442de10d6143de6dd1aad3
* Set method visibility on languages classesUmherirrender2019-11-171-5/+5
| | | | Change-Id: I9dd10bbf81d277865301eccde73da17418df1238
* Add public visibility to some language functionUmherirrender2019-10-311-1/+1
| | | | | | | | This only adds public for some function used outside of languages classes. This does not fixed all functions, just one first shot Change-Id: I5c0ee93a0867c847b084d2ce459dbad9cddaf9fb
* LanguageFactory to replace Language::factory()Aryeh Gregor2019-10-231-4/+2
| | | | | | | | | Languages with variants no longer can override the parent's constructor (which is now used for injecting services). Instead, they need to override Language::newConverter(). Bug: T201405 Change-Id: I923400d61763cf1db88cb0c3f684c9c10e58032d
* Fix param type of search terms in search related classesUmherirrender2019-06-141-2/+2
| | | | Change-Id: I036434268f1e7992f7f9f23d2c1c0fcd399823c8
* Fix indenting and newlinesFomafix2018-11-071-11/+14
| | | | | | Like suggested in https://www.mediawiki.org/wiki/Manual:Coding_conventions#Line_continuation Change-Id: I86db3c24ffc69737c6917cfc68300ff4695961cd
* Add type hint Language where possibleFomafix2018-08-121-1/+1
| | | | | | Also use ?? instead of ?: to check for null. Change-Id: I058b61d7e06cdefecdafa82f60109cc386e2a809
* Remove empty lines at end of functionsumherirrender2016-11-051-2/+0
| | | | | | | | It looks like there is something missing after the last statement Also remove some other empty lines at begin of functions, ifs or loops while at these files Change-Id: Ib00b5cfd31ca4dcd0c32ce33754d3c80bae70641
* Convert all array() syntax to []Kunal Mehta2016-02-171-24/+24
| | | | | | | | | | 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
* Merge "Don't modify $wgHooks on language object construction"jenkins-bot2016-02-111-4/+0
|\
| * Don't modify $wgHooks on language object constructionTim Starling2016-01-291-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Use autoloader for PHP data files instead of include/requireTim Starling2016-01-301-9/+8
| | | | | | | | | | | | | | | | | | | | 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
* | Remove require_once for language classesTim Starling2016-01-291-3/+0
|/ | | | | | | | Remove require_once for LanguageConverter and base classes. These are in the autoloader now, so an explicit require is no longer necessary. Change-Id: Ie34ffc58fd9ec89fb57cf077dd5ac1746c35c48e
* Update the Chinese conversion table for Chinese WikiProjectsChiefwei2015-03-061-2/+2
| | | | | | | | | | | | | | The Chinese conversion table is substantially updated to fix a lot of bugs reported in recent years, and the script generating conversion table (LanguageZh.php) is also modified to facilitate the maintenance. Zh-sg and zh-my is set to fallback to zh-cn to improve reading experience, since there is only trivial difference among them, just like zh-hk and zh-mo. Further optimization for zh-sg and zh-my will be performed in local conversion table of Chinese WikiProjects. Bug: T91620 Change-Id: I1bb0315d6d7a2c9653905654d933942e362bcc42
* Merge "Change loading order of Chinese conversion tables"jenkins-bot2015-01-081-12/+24
|\
| * Change loading order of Chinese conversion tablesLiangent2015-01-081-12/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Apply the conversion variants from specific zones before zh-hans and zh-hant, to allow fitting specific linguistic habits before falling back to the generic ones. The actual rules will be added in a followup patch. Previously, the zh-cn table was composed by: (1) Load zh2Hans as zh-hans table (2) Load zh2CN + zh2Hans as zh-cn table (3) Load Conversiontable/zh-hans + zh-hans as zh-hans table (4) Load Conversiontable/zh-cn + zh-cn as zh-cn table (5) Load zh-hans + zh-cn as the final zh-cn table The new loading order is: (1) Load zh2Hans as zh-hans table (2) Load zh2CN as zh-cn table (3) Load Conversiontable/zh-hans + zh-hans as zh-hans table (4) Load Conversiontable/zh-cn + zh-cn as zh-cn table (5) Load zh-cn + zh-hans as the final zh-cn table Change-Id: Ie9d08b85d4911618946fa7efd23eb898412449e5
* | Remove obvious function-level profilingChad Horohoe2015-01-071-2/+0
| | | | | | | | | | | | | | | | | | | | | | 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
* | Cleanup some docs (languages)umherirrender2014-08-091-1/+1
|/ | | | | | | - Makes beginning of @param in capital - Removed return void Change-Id: Ie05436c1ef886cb23c62ccde95384f253f83694c
* Make languages/classes pass phpcs-strictSiebrand Mazeland2014-04-221-4/+12
| | | | Change-Id: I0985f3c7e4b36338c68a4a63cfba4eaa4af567c0
* Fixed some @params documentation (languages)umherirrender2014-04-171-14/+14
| | | | | | | | 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
* phpcs: More require/include is not a functionTimo Tijhof2013-05-211-3/+3
| | | | | | | | | | | | | 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
* Fixed spacing in languages folderumherirrender2013-04-171-22/+22
| | | | | | | Added spaces before if Added some braces for one line statements Change-Id: I980771894369499646532b13b801db6447381773
* Get rid of preg_replace( '/.../e', ... )Kevin Israel2013-04-091-6/+2
| | | | | | | | | This is deprecated as of PHP 5.5, and the remaining uses are quite silly. Tim said I should remove his easter egg from Special:Version, as it already was broken, and a new one can be added in a separate commit. Change-Id: I0f09f4efc7afe5933c8317462026a475530a5324
* Clean up Language::markNoConversion().Liangent2012-11-181-14/+0
| | | | | | | | | | | | | | | * IRIs are getting more and more widely used these days so Chinese characters are also needed to be prevented from being converted in text of external links. * So now all markNoConversion() functions in languages with variants do the same thing. Merge them into a single function in the Language class and drop implementations in individual languages. * By the way rephrase phpdoc of that function, and (bug 24798) fix the link detection regex to use wfUrlProtocolsWithoutProtRel(). Protocol-relative regex is excluded to avoid false positives. * Add parser test for it. Change-Id: I2ec0ac2b9b11221584adb72555168498de209d57
* Prefix new ContentHandler hooks in WikiPage with Page instead of ArticleSiebrand Mazeland2012-10-111-1/+1
| | | | | | | | | Covers 3 hooks: * ArticleContentInsertComplete -> PageContentInsertComplete * ArticleContentSave -> PageContentSave * ArticleContentSaveComplete -> PageContentSaveComplete Change-Id: I186669a5941d8982725ed364b481215d291b2043
* Fix usage of deprecated ArticleSaveComplete hook in coredaniel2012-10-081-1/+1
| | | | Change-Id: Ic01fd95d50a909470d6f0ffd93c972322789d49a
* merged masterdaniel2012-08-291-3/+3
| | | | Change-Id: Ib2b879c4daa17401eeeb50767c0e5a54254855c3
* Revert "merged master"Daniel Kinzler2012-08-291-3/+3
| | | This reverts commit 67bfdc7a68940d901e585eadd984a2074bf0216a
* merged masterdaniel2012-08-291-3/+3
| | | | Change-Id: Ib2b879c4daa17401eeeb50767c0e5a54254855c3
* Added missing GPLv2 headers in some places.Alexandre Emsenhuber2012-06-101-0/+21
| | | | | | Also made file/class documentation more consistent. Change-Id: I162f57c994765189681ac3fb30f889e648c6c6a1
* More documentation!Sam Reed2011-05-291-4/+35
| | | | Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/89118
* Stylize languages/*, languages/classes/*, but not languages/messages/*Sam Reed2010-07-291-32/+32
| | | | Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/70131
* 1. Fix the underline bug in the title(namespace) conversion, which displayed ↵Philip Tzou2010-07-061-47/+0
| | | | | | | | | title like "User_talk:Example". 2. Improve the function of namespace conversion. Allow admins to custom namespace conversion in MediaWiki's messages([[MediaWiki:conversion-nsX]]). Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/69081
* Follow up r61856, no need.Philip Tzou2010-02-021-9/+0
| | | | Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/61859
* Follow up r60742, r60743, r60764, r60766, r61214, r61390. Split ↵Philip Tzou2010-02-021-4/+19
| | | | | | | stripForSearch into wordSegmentation and normalizeForSearch. So the wordSegmentation could be called by search engines separately. Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/61856
* In LanguageConverter:Tim Starling2010-01-191-3/+1
| | | | | | | | | | | | | | | | | | | | * Rewrote convertArray() as an RD parser (with inline tokenizer) as suggested on CR r60986. Fixes unclosed rule issue (with parser test). Fixes O(N^2) timing. * Removed $this->mMarkup abstraction. Life is complicated enough as it is. * Replaced a couple of instances of explode() with StringUtils::explode(), limited element count in a couple more. In ConverterRule: * Removed mConvTable initialisation from the constructor, unnecessary * Optimised the "-{xxx}-" tight loop by replacing function calls such as count() and in_array() with language constructs such as isset(). Reduced execution time from 356us to 275us. * Cached $varsep_pattern for further reduction to 243us. * A couple more parseFlags() hacks brings it back to 230us. * Split out $this->mVariantFlags from $this->mFlags. Rearranged flag detection into a foreach/switch to avoid unnecessary isset() calls. 189us. * Added a special-case optimisation to generateConvTable() for the case where there are no tables defined inline in the article. 116us. * Fixed bug from r37499: "!R || !N" is always true since they are mutually exclusive, "!R && !N" was intended (with parser test). * Fixed E_NOTICE from "-{N|foo}-" Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/61233
* follow-up r60743.Philip Tzou2010-01-071-3/+5
| | | | | | | | 1. Changed the conditions, not only for LuceneSearch, but also more commonly to others. 2. Reduced code duplication. Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/60764
* 1. Add conditions to stripForSearch for LuceneSearch / MWSearch.Philip Tzou2010-01-061-8/+7
| | | | | | | 2. Add double-width roman characters conversion support to zh, gan, and yue. Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/60743
* Fix E_NOTICE in r55415 breaking Zh variantsAndrew Garrett2009-09-161-2/+1
| | | | Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/56459
* Partial revert of r55415, calling wfMsg in Language object constructor ↵Andrew Garrett2009-09-161-8/+0
| | | | | | | causes unstub loops Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/56458
* 1. Revert my revision r55371. Since it may override logged user's settings.Philip Tzou2009-08-211-1/+11
| | | | | | | 2. Patch for situations that some wikis like zhwikisource may disabled some language variants. We should treat these disabled variants unacceptable in LanguageConverter. Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/55415
* * (bug 8445) Multiple-character search terms are now handled properly for ↵Brion Vibber2009-06-241-8/+1
| | | | | | | | | | | | | | | Chinese Big fixup for Chinese word breaks and variant conversions in the MySQL search backend... - removed redunant variant terms for Chinese, which forces all search indexing to canonical zh-hans - added parens to properly group variants for languages such as Serbian which do need them at search time - added quotes to properly group multi-word terms coming out of stripForSearch, as for Chinese where we segment up the characters. This is based on Language::hasWordBreaks() check. - also cleaned up LanguageZh_hans::stripForSearch() to just do segmentation and pass on the Unicode stripping to the base Language implementation, avoiding scary code duplication. Segmentation was already pulled up to LanguageZh, but was being run again at the second level. :P - made a fix to Chinese word segmentation to handle the case where a Han character is followed by a Latin char or numeral; a space is now added after as well. Spaces are then normalized for prettiness. Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/52338
* New function to convert content text to specified language (only applies on ↵Philip Tzou2009-03-041-1/+1
| | | | | | | | | wiki with LanguageConverter class) Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/48015
* 1. Namespace translation for Chinese Language.Philip Tzou2009-02-061-0/+47
| | | | | | | 2. New function to convert namespace text for display. (only applies on wiki with LanguageConverter class) Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/46913
* Revert r46523, r46525. Spewing errors. See below. Behaviour observed on ↵Siebrand Mazeland2009-01-291-1/+1
| | | | | | | | | | | | http://translatewiki.net. PHP Notice: Undefined property: FakeConverter::$mMainLanguageCode in /var/www/w/languages/Language.php on line 2230 PHP Notice: Undefined property: FakeConverter::$mVariants in /var/www/w/languages/Language.php on line 2233 PHP Warning: in_array() [<a href='function.in-array'>function.in-array</a>]: Wrong datatype for second argument in /var/www/w/languages/Language.php on line 2233 PHP Notice: Undefined property: FakeConverter::$mMainLanguageCode in /var/www/w/languages/Language.php on line 2234 Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/46526
* Move method 'getPreferredVariant' to Language class, patched by Fdcn.Philip Tzou2009-01-291-1/+1
| | | | Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/46523
* Revert "Follow up on r43982. Reduce dirname(__FILE__) calls in core and ↵Andrew Garrett2008-11-301-3/+2
| | | | | | | | | | | | extensions." Uses $dir in extension files, and assumes that it remains unchanged in require_once( 'maintenance/commandLine.inc' ). In fact, it is likely that '$dir' will be set when setting up command-line, as some extensions will use the same var. Recommended fix: Use $CentralAuth_dir, $EmailPage_dir, etc. Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/44056