Skip to content

convert between Simplified Chinese(zh-Hans) and Traditional Chinese(zh-Hant)

License

Notifications You must be signed in to change notification settings

rny/ZhConverter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ZhConverter

Build Status

ZhConverter is a simple PHP library to convert between Simplified Chinese(zh-Hans) and Traditional Chinese(zh-Hant). ZhConverter is using WikiMedia ZhConverter.php as convertion table.

For those rquire better convertion quality, the C++ project OpenCC may be considered.

Highlights

  • One line code to do the convertion
  • Composer ready, PSR-4 compatible.
  • PHPUnit tested.

Install

Install ZhConverter using Composer.

$ composer require rny/zhconverter

Usage

use Rny\ZhConverter\ZhConverter;

$text = ZhConverter::zh2hant($text);
$text = ZhConverter::zh2hans($text);
$text = ZhConverter::zh2TW($text);
$text = ZhConverter::zh2HK($text);
$text = ZhConverter::zh2CN($text);
$text = \Rny\ZhConverter\ZhConverter::zh2hant($text);
$text = \Rny\ZhConverter\ZhConverter::zh2hans($text);
$text = \Rny\ZhConverter\ZhConverter::zh2TW($text);
$text = \Rny\ZhConverter\ZhConverter::zh2HK($text);
$text = \Rny\ZhConverter\ZhConverter::zh2CN($text);

Testing

$ composer test

About

convert between Simplified Chinese(zh-Hans) and Traditional Chinese(zh-Hant)

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages