Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F1427698
LanguageJa.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
LanguageJa.php
View Options
<?php
/**
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* http://www.gnu.org/copyleft/gpl.html
*
* @file
*/
use
MediaWiki\Language\Language
;
/**
* Japanese (日本語)
*
* @ingroup Languages
*/
class
LanguageJa
extends
Language
{
/** Space string for hiragana - unicode range U3040-309f */
private
const
WORD_SEG_HIRAGANA
=
'(?:
\x
e3(?:
\x
81[
\x
80-
\x
bf]|
\x
82[
\x
80-
\x
9f]))'
;
/** Space string for katakana - unicode range U30a0-30ff */
private
const
WORD_SEG_KATAKANA
=
'(?:
\x
e3(?:
\x
82[
\x
a0-
\x
bf]|
\x
83[
\x
80-
\x
bf]))'
;
/** Space string for kanji - unicode range U3200-9999 = \xe3\x88\x80-\xe9\xa6\x99 */
private
const
WORD_SEG_KANJI
=
'(?:
\x
e3[
\x
88-
\x
bf][
\x
80-
\x
bf]|[
\x
e4-
\x
e8][
\x
80-
\x
bf]{2}|
\x
e9[
\x
80-
\x
a5][
\x
80-
\x
bf]|
\x
e9
\x
a6[
\x
80-
\x
99])'
;
private
const
WORD_SEGMENTATION_REGEX
=
'/('
.
self
::
WORD_SEG_HIRAGANA
.
'+|'
.
self
::
WORD_SEG_KATAKANA
.
'+|'
.
self
::
WORD_SEG_KANJI
.
'+)/'
;
public
function
segmentByWord
(
$string
)
{
return
self
::
insertSpace
(
$string
,
self
::
WORD_SEGMENTATION_REGEX
);
}
/**
* Italic is not appropriate for Japanese script.
* Unfortunately, most browsers do not recognise this, and render `<em>` as italic.
*
* @param string $text
* @return string
*/
public
function
emphasize
(
$text
)
{
return
$text
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, May 16, 14:58 (1 d, 7 m)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
69/02/97a5e0ea230cf933ce41c616534a
Default Alt Text
LanguageJa.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment