peterkahl/chinese-master

Chinese traditional/simplified conversion; traditional/simplified detection.

v1.0 2020-03-30 14:27 UTC

This package is auto-updated.

Last update: 2020-06-30 16:48:46 UTC


README

Downloads Downloads per Month License

Chinese traditional/simplified conversion; traditional/simplified detection.

Usage

use peterkahl\ChineseMaster\ChineseMaster;

$chm = new ChineseMaster;

/**
 * Does string include (1 or more) characters of traditional Chinese script?
 *
 */
$isTraditional = $chm->isTraditional('龙');  # false

$isTraditional = $chm->isTraditional('龍');  # true

$isTraditional = $chm->isTraditional('龙龍'); # true

/**
 * Convert text in traditional script to simplified.
 *
 */
echo $chm->trad2simp('灣龍爾'); # 湾龙尔

/**
 * Convert text in simplified script to traditional.
 *
 */
echo $chm->simp2trad('湾龙尔'); # 灣龍爾