r71055 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r71054‎ | r71055 | r71056 >
Date:23:37, 13 August 2010
Author:brion
Status:ok (Comments)
Tags:
Comment:
More explanatory (and English ;) doc comments for Esperanto surrogate conversion in LanguageEo::iconv()
Modified paths:
  • /trunk/phase3/languages/classes/LanguageEo.php (modified) (history)

Diff [purge]

Index: trunk/phase3/languages/classes/LanguageEo.php
@@ -3,11 +3,41 @@
44 /** Esperanto (Esperanto)
55 *
66 * @ingroup Language
 7+ * @author Brion Vibber <brion@pobox.com>
78 */
89 class LanguageEo extends Language {
 10+ /**
 11+ * Wrapper for charset conversions.
 12+ *
 13+ * In most languages, this calls through to standard system iconv(), but
 14+ * for Esperanto we're also adding a special pseudo-charset to convert
 15+ * accented characters to/from the ASCII-friendly "X" surrogate coding:
 16+ *
 17+ * cx = ĉ cxx = cx
 18+ * gx = ĝ gxx = gx
 19+ * hx = ĥ hxx = hx
 20+ * jx = ĵ jxx = jx
 21+ * sx = ŝ sxx = sx
 22+ * ux = ŭ uxx = ux
 23+ * xx = x
 24+ *
 25+ * http://en.wikipedia.org/wiki/Esperanto_orthography#X-system
 26+ * http://eo.wikipedia.org/wiki/X-sistemo
 27+ *
 28+ * X-conversion is applied, in either direction, between "utf-8" and "x" charsets;
 29+ * this comes into effect when input is run through $wgRequest->getText() and the
 30+ * $wgEditEncoding is set to 'x'.
 31+ *
 32+ * In the long run, this should be moved out of here and into the client-side
 33+ * editor behavior; the original server-side translation system dates to 2002-2003
 34+ * when many browsers will really bad Unicode support were still in use.
 35+ *
 36+ * @param string $in input character set
 37+ * @param string $out output character set
 38+ * @param string $string text to be converted
 39+ * @return string
 40+ */
941 function iconv( $in, $out, $string ) {
10 - # Por multaj lingvoj, ĉi tiu nur voku la sisteman funkcion iconv()
11 - # Ni ankaŭ konvertu X-sistemajn surogotajn
1242 if ( strcasecmp( $in, 'x' ) == 0 && strcasecmp( $out, 'utf-8' ) == 0 ) {
1343 return preg_replace_callback (
1444 '/([cghjsu]x?)((?:xx)*)(?!x)/i',

Comments

#Comment by Reedy (talk | contribs)   09:31, 14 August 2010

Thanks Brion =)

Status & tagging log