peterkahl/chinese-master

This package is abandoned and no longer maintained. No replacement package was suggested.

Chinese traditional/simplified conversion; traditional/simplified detection.

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

This package is auto-updated.

Last update: 2021-01-02 17:57:08 UTC


README

Downloads Downloads per Month License If this project has business value for you then don't hesitate to support me with a small donation. 多謝!

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.
 * CAUTION: You will encouter errors as the size of the simplified
 * array is maller that that of the traditional.
 */
echo $chm->simp2trad('湾龙尔'); # 灣龍爾