Index: trunk/phase3/languages/classes/LanguageEo.php |
— | — | @@ -3,11 +3,41 @@ |
4 | 4 | /** Esperanto (Esperanto) |
5 | 5 | * |
6 | 6 | * @ingroup Language |
| 7 | + * @author Brion Vibber <brion@pobox.com> |
7 | 8 | */ |
8 | 9 | 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 | + */ |
9 | 41 | function iconv( $in, $out, $string ) { |
10 | | - # Por multaj lingvoj, ĉi tiu nur voku la sisteman funkcion iconv() |
11 | | - # Ni ankaŭ konvertu X-sistemajn surogotajn |
12 | 42 | if ( strcasecmp( $in, 'x' ) == 0 && strcasecmp( $out, 'utf-8' ) == 0 ) { |
13 | 43 | return preg_replace_callback ( |
14 | 44 | '/([cghjsu]x?)((?:xx)*)(?!x)/i', |