MediaWiki REL1_41
LanguageJa.php
Go to the documentation of this file.
1<?php
26class LanguageJa extends Language {
27
28 public function segmentByWord( $string ) {
29 // Strip known punctuation?
30 // $s = preg_replace( '/\xe3\x80[\x80-\xbf]/', '', $s ); # U3000-303f
31
32 // Space strings of like hiragana/katakana/kanji
33 $hiragana = '(?:\xe3(?:\x81[\x80-\xbf]|\x82[\x80-\x9f]))'; # U3040-309f
34 $katakana = '(?:\xe3(?:\x82[\xa0-\xbf]|\x83[\x80-\xbf]))'; # U30a0-30ff
35 $kanji = '(?:\xe3[\x88-\xbf][\x80-\xbf]'
36 . '|[\xe4-\xe8][\x80-\xbf]{2}'
37 . '|\xe9[\x80-\xa5][\x80-\xbf]'
38 . '|\xe9\xa6[\x80-\x99])';
39 # U3200-9999 = \xe3\x88\x80-\xe9\xa6\x99
40 $reg = "/({$hiragana}+|{$katakana}+|{$kanji}+)/";
41 return self::insertSpace( $string, $reg );
42 }
43
51 public function emphasize( $text ) {
52 return $text;
53 }
54}
Japanese (日本語)
segmentByWord( $string)
Some languages such as Chinese require word segmentation, Specify such segmentation when overridden i...
emphasize( $text)
Italic is not appropriate for Japanese script.
Base class for language-specific code.
Definition Language.php:63
static insertSpace( $string, $pattern)