MediaWiki  master
LanguageJa.php
Go to the documentation of this file.
1 <?php
26 class LanguageJa extends Language {
27 
32  public function segmentByWord( $string ) {
33  // Strip known punctuation ?
34  // $s = preg_replace( '/\xe3\x80[\x80-\xbf]/', '', $s ); # U3000-303f
35 
36  // Space strings of like hiragana/katakana/kanji
37  $hiragana = '(?:\xe3(?:\x81[\x80-\xbf]|\x82[\x80-\x9f]))'; # U3040-309f
38  $katakana = '(?:\xe3(?:\x82[\xa0-\xbf]|\x83[\x80-\xbf]))'; # U30a0-30ff
39  $kanji = '(?:\xe3[\x88-\xbf][\x80-\xbf]'
40  . '|[\xe4-\xe8][\x80-\xbf]{2}'
41  . '|\xe9[\x80-\xa5][\x80-\xbf]'
42  . '|\xe9\xa6[\x80-\x99])';
43  # U3200-9999 = \xe3\x88\x80-\xe9\xa6\x99
44  $reg = "/({$hiragana}+|{$katakana}+|{$kanji}+)/";
45  $s = self::insertSpace( $string, $reg );
46  return $s;
47  }
48 
56  public function emphasize( $text ) {
57  return $text;
58  }
59 }
Japanese (日本語)
Definition: LanguageJa.php:26
segmentByWord( $string)
Definition: LanguageJa.php:32
emphasize( $text)
Italic is not appropriate for Japanese script Unfortunately most browsers do not recognise this,...
Definition: LanguageJa.php:56
Base class for language-specific code.
Definition: Language.php:56
static insertSpace( $string, $pattern)
Definition: Language.php:2880
foreach( $mmfl['setupFiles'] as $fileName) if( $queue) if(empty( $mmfl['quiet'])) $s