MediaWiki master
LanguageJa.php
Go to the documentation of this file.
1<?php
7namespace MediaWiki\Languages;
8
10
16class LanguageJa extends Language {
17
19 private const WORD_SEG_HIRAGANA = '(?:\xe3(?:\x81[\x80-\xbf]|\x82[\x80-\x9f]))';
20
22 private const WORD_SEG_KATAKANA = '(?:\xe3(?:\x82[\xa0-\xbf]|\x83[\x80-\xbf]))';
23
25 private const WORD_SEG_KANJI =
26 '(?:\xe3[\x88-\xbf][\x80-\xbf]|[\xe4-\xe8][\x80-\xbf]{2}|\xe9[\x80-\xa5][\x80-\xbf]|\xe9\xa6[\x80-\x99])';
27
28 private const WORD_SEGMENTATION_REGEX =
29 '/(' . self::WORD_SEG_HIRAGANA . '+|' . self::WORD_SEG_KATAKANA . '+|' . self::WORD_SEG_KANJI . '+)/';
30
32 public function segmentByWord( $string ) {
33 return self::insertSpace( $string, self::WORD_SEGMENTATION_REGEX );
34 }
35
44 public function emphasize( $text ) {
45 wfDeprecated( __METHOD__, '1.46' );
46 return $text;
47 }
48}
49
51class_alias( LanguageJa::class, 'LanguageJa' );
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Logs a warning that a deprecated feature was used.
Base class for language-specific code.
Definition Language.php:68
static insertSpace( $string, $pattern)
emphasize( $text)
Italic is not appropriate for Japanese script.
segmentByWord( $string)
Some languages such as Chinese require word segmentation, Specify such segmentation when overridden i...