Reduced some master queries by adding flags to Revision functions.
[lhc/web/wiklou.git] / languages / classes / LanguageJa.php
1 <?php
2
3 /**
4 * Japanese (日本語)
5 *
6 * @ingroup Language
7 */
8 class LanguageJa extends Language {
9
10 /**
11 * @param $string string
12 * @return string
13 */
14 function segmentByWord( $string ) {
15 // Strip known punctuation ?
16 // $s = preg_replace( '/\xe3\x80[\x80-\xbf]/', '', $s ); # U3000-303f
17
18 // Space strings of like hiragana/katakana/kanji
19 $hiragana = '(?:\xe3(?:\x81[\x80-\xbf]|\x82[\x80-\x9f]))'; # U3040-309f
20 $katakana = '(?:\xe3(?:\x82[\xa0-\xbf]|\x83[\x80-\xbf]))'; # U30a0-30ff
21 $kanji = '(?:\xe3[\x88-\xbf][\x80-\xbf]'
22 . '|[\xe4-\xe8][\x80-\xbf]{2}'
23 . '|\xe9[\x80-\xa5][\x80-\xbf]'
24 . '|\xe9\xa6[\x80-\x99])';
25 # U3200-9999 = \xe3\x88\x80-\xe9\xa6\x99
26 $reg = "/({$hiragana}+|{$katakana}+|{$kanji}+)/";
27 $s = self::insertSpace( $string, $reg );
28 return $s;
29 }
30
31 /**
32 * Italic is not appropriate for Japanese script
33 * Unfortunately most browsers do not recognise this, and render <em> as italic
34 *
35 * @param $text string
36 * @return string
37 */
38 function emphasize( $text ) {
39 return $text;
40 }
41 }