MediaWiki  master
LanguageJa.php
Go to the documentation of this file.
1 <?php
29 class LanguageJa extends Language {
30 
35  public function segmentByWord( $string ) {
36  // Strip known punctuation ?
37  // $s = preg_replace( '/\xe3\x80[\x80-\xbf]/', '', $s ); # U3000-303f
38 
39  // Space strings of like hiragana/katakana/kanji
40  $hiragana = '(?:\xe3(?:\x81[\x80-\xbf]|\x82[\x80-\x9f]))'; # U3040-309f
41  $katakana = '(?:\xe3(?:\x82[\xa0-\xbf]|\x83[\x80-\xbf]))'; # U30a0-30ff
42  $kanji = '(?:\xe3[\x88-\xbf][\x80-\xbf]'
43  . '|[\xe4-\xe8][\x80-\xbf]{2}'
44  . '|\xe9[\x80-\xa5][\x80-\xbf]'
45  . '|\xe9\xa6[\x80-\x99])';
46  # U3200-9999 = \xe3\x88\x80-\xe9\xa6\x99
47  $reg = "/({$hiragana}+|{$katakana}+|{$kanji}+)/";
48  $s = self::insertSpace( $string, $reg );
49  return $s;
50  }
51 
59  public function emphasize( $text ) {
60  return $text;
61  }
62 }
$s
$s
Definition: mergeMessageFileList.php:185
LanguageJa\segmentByWord
segmentByWord( $string)
Definition: LanguageJa.php:35
LanguageJa
Japanese (日本語)
Definition: LanguageJa.php:29
LanguageJa\emphasize
emphasize( $text)
Italic is not appropriate for Japanese script Unfortunately most browsers do not recognise this,...
Definition: LanguageJa.php:59
Language\insertSpace
static insertSpace( $string, $pattern)
Definition: Language.php:2910
Language
Internationalisation code See https://www.mediawiki.org/wiki/Special:MyLanguage/Localisation for more...
Definition: Language.php:39