MediaWiki r35055 - Code Review

Jump to: navigation, search
Repository:MediaWiki
Revision:r35054‎ | r35055 (on ViewVC)‎ | r35056 >
Date:20:20, 19 May 2008
Author:brion
Status:old
Tags:
Comment:
* (bug 1701) Korean Hangul syllables now broken down properly in Category lists even if the wiki's overall content language is not Korean

Nothing else left in LanguageKo class, so ditching it.
Modified paths:

Diff [purge]

Index: trunk/phase3/languages/Language.php
@@ -1464,7 +1464,47 @@
14651465 preg_match( '/^([\x00-\x7f]|[\xc0-\xdf][\x80-\xbf]|' .
14661466 '[\xe0-\xef][\x80-\xbf]{2}|[\xf0-\xf7][\x80-\xbf]{3})/', $s, $matches);
14671467
1468 - return isset( $matches[1] ) ? $matches[1] : "";
 1468+ if ( isset( $matches[1] ) ) {
 1469+ if ( strlen( $matches[1] ) != 3 ) {
 1470+ return $matches[1];
 1471+ }
 1472+
 1473+ // Break down Hangul syllables to grab the first jamo
 1474+ $code = utf8ToCodepoint( $matches[1] );
 1475+ if ( $code < 0xac00 || 0xd7a4 <= $code) {
 1476+ return $matches[1];
 1477+ } elseif ( $code < 0xb098 ) {
 1478+ return "\xe3\x84\xb1";
 1479+ } elseif ( $code < 0xb2e4 ) {
 1480+ return "\xe3\x84\xb4";
 1481+ } elseif ( $code < 0xb77c ) {
 1482+ return "\xe3\x84\xb7";
 1483+ } elseif ( $code < 0xb9c8 ) {
 1484+ return "\xe3\x84\xb9";
 1485+ } elseif ( $code < 0xbc14 ) {
 1486+ return "\xe3\x85\x81";
 1487+ } elseif ( $code < 0xc0ac ) {
 1488+ return "\xe3\x85\x82";
 1489+ } elseif ( $code < 0xc544 ) {
 1490+ return "\xe3\x85\x85";
 1491+ } elseif ( $code < 0xc790 ) {
 1492+ return "\xe3\x85\x87";
 1493+ } elseif ( $code < 0xcc28 ) {
 1494+ return "\xe3\x85\x88";
 1495+ } elseif ( $code < 0xce74 ) {
 1496+ return "\xe3\x85\x8a";
 1497+ } elseif ( $code < 0xd0c0 ) {
 1498+ return "\xe3\x85\x8b";
 1499+ } elseif ( $code < 0xd30c ) {
 1500+ return "\xe3\x85\x8c";
 1501+ } elseif ( $code < 0xd558 ) {
 1502+ return "\xe3\x85\x8d";
 1503+ } else {
 1504+ return "\xe3\x85\x8e";
 1505+ }
 1506+ } else {
 1507+ return "";
 1508+ }
14691509 }
14701510
14711511 function initEncoding() {
Index: trunk/phase3/languages/classes/LanguageKo.php
@@ -1,55 +0,0 @@
2 -<?php
3 -/** Korean (한국어)
4 - *
5 - * @addtogroup Language
6 - */
7 -
8 -class LanguageKo extends Language {
9 - function firstChar( $s ) {
10 - $matches = array();
11 - preg_match( '/^([\x00-\x7f]|[\xc0-\xdf][\x80-\xbf]|' .
12 - '[\xe0-\xef][\x80-\xbf]{2}|[\xf0-\xf7][\x80-\xbf]{3})/', $s, $matches);
13 -
14 - if ( isset( $matches[1] ) ) {
15 - if ( strlen( $matches[1] ) != 3 ) {
16 - return $matches[1];
17 - }
18 - $code = (ord($matches[1]{0}) & 0x0f) << 12;
19 - $code |= (ord($matches[1]{1}) & 0x3f) << 6;
20 - $code |= (ord($matches[1]{2}) & 0x3f);
21 - if ( $code < 0xac00 || 0xd7a4 <= $code) {
22 - return $matches[1];
23 - } elseif ( $code < 0xb098 ) {
24 - return "\xe3\x84\xb1";
25 - } elseif ( $code < 0xb2e4 ) {
26 - return "\xe3\x84\xb4";
27 - } elseif ( $code < 0xb77c ) {
28 - return "\xe3\x84\xb7";
29 - } elseif ( $code < 0xb9c8 ) {
30 - return "\xe3\x84\xb9";
31 - } elseif ( $code < 0xbc14 ) {
32 - return "\xe3\x85\x81";
33 - } elseif ( $code < 0xc0ac ) {
34 - return "\xe3\x85\x82";
35 - } elseif ( $code < 0xc544 ) {
36 - return "\xe3\x85\x85";
37 - } elseif ( $code < 0xc790 ) {
38 - return "\xe3\x85\x87";
39 - } elseif ( $code < 0xcc28 ) {
40 - return "\xe3\x85\x88";
41 - } elseif ( $code < 0xce74 ) {
42 - return "\xe3\x85\x8a";
43 - } elseif ( $code < 0xd0c0 ) {
44 - return "\xe3\x85\x8b";
45 - } elseif ( $code < 0xd30c ) {
46 - return "\xe3\x85\x8c";
47 - } elseif ( $code < 0xd558 ) {
48 - return "\xe3\x85\x8d";
49 - } else {
50 - return "\xe3\x85\x8e";
51 - }
52 - } else {
53 - return "";
54 - }
55 - }
56 -}
Index: trunk/phase3/RELEASE-NOTES
@@ -280,8 +280,9 @@
281281 * (bug 14111) Similar filename warning links now lead to correct page
282282 * (bug 14082) Fix for complex text input vs AJAX suggestions on some browsers
283283 * (bug 13693) Categories sometimes claim to have a negative number of members
 284+* (bug 1701) Korean Hangul syllables now broken down properly in Category lists
 285+ even if the wiki's overall content language is not Korean
284286
285 -
286287 === API changes in 1.13 ===
287288
288289 * Fixing main page display in meta=siteinfo

Past revisions this follows-up on

Rev.Commit summaryAuthorDate
r8653* (bug 1701, bug 1984) firstChar() now returns the initial consonant of the...avar04:06, 27 April 2005
r8654* (bug 1701, bug 1984) firstChar() now returns the initial consonant of the...avar04:07, 27 April 2005

Status & tagging log

  • 15:27, 12 September 2011 Meno25 (talk | contribs) changed the status of r35055 [removed: ok added: old]