diff --git a/README-EN.md b/README-EN.md new file mode 100644 index 0000000000000000000000000000000000000000..0b7f27eda5a1b1045f6568b9ebb81e72c3cba91e --- /dev/null +++ b/README-EN.md @@ -0,0 +1,75 @@ +# pinyin4js + +## Introduction + +pinyin4js is an open-source JavaScript library that has been adapted to OpenHarmony for converting Chinese characters to Pinyin. It has the following features: + +* **Zero dependency** + +* **Flexible import and packaging of dictionaries** + + The imported dictionaries can be adjusted as needed. For details, see **src/dict**. All resource scheduling is encapsulated by **PinyinResource**, and the resources can be packaged after being modified. + +* **Accurate and comprehensive dictionaries** + + Among the 20903 Chinese characters in the Unicode range of 4E00-9FA5 and 3007, pinyin4js can convert all of the characters except 46 heterogenous characters (which do not have standard pinyin). + +* **Fast conversion** + + Test results reveal that pinyin4js takes about 110 milliseconds to convert the supported 20902 Chinese characters. + +* **Multiple output formats** + + The output can come with phonetic symbols, without phonetic symbols, phonetic symbols represented by numbers, or Pinyin initials. + +* **Common multi-sound character recognition** + + Common multi-sound characters, as in phrases, idioms, and place names, can be recognized. + +* **Simplified/Traditional Chinese conversion** + +* **Custom dictionaries** + + Custom dictionaries can be added. + +## Download and Installation +``` +ohpm install @ohos/pinyin4js +``` + +## How to Use + +```javascript + import {pinyin4js} from '@ohos/pinyin4js'; + + // more detail methods in test + // WITH_TONE_NUMBER: with a number indicating the tone; WITHOUT_TONE: without any tone marks; WITH_TONE_MARK: with a tone mark + // output: xià#mén#nǐ#hǎo#dà#shà#xià#mén + console.info("00771-" + pinyin4js.convertToPinyinString('校对', '#', pinyin4js.WITH_TONE_MARK)); + console.info("00771-" + pinyin4js.convertToPinyinString('學校', '#', pinyin4js.WITH_TONE_MARK)); + console.info("00772-" + pinyin4js.convertToPinyinString('厦门你好大厦厦门', '#', pinyin4js.WITHOUT_TONE)); + + // Initial letter style + // output: xmnhdsxm + console.info("00773-" + pinyin4js.convertToPinyinString('厦门你好大厦厦门', '', pinyin4js.FIRST_LETTER)); + // or + console.info("00774-" + pinyin4js.getShortPinyin('厦门你好大厦厦门')); + + // Convert traditional Chinese to simplified Chinese. + console.info("00775-" + pinyin4js.convertToSimplifiedChinese('歲月時光')); + // Convert simplified Chinese to traditional Chinese. + console.info("00776-" + pinyin4js.convertToTraditionalChinese('岁月时光')); + +``` + +## Constraints + +pinyin4js has been verified in the following versions: + +DevEco Studio: DevEco Studio:4.0 (4.0.3.512), SDK:API10 (4.0.10.9) + +## How to Contribute +If you find any problem when using Lottie, submit an [issue](https://gitee.com/openharmony-tpc/pinyin4js/issues) or a [PR](https://gitee.com/openharmony-tpc/pinyin4js/pulls) to us. + +## License +This project is licensed under the terms of the [MIT License](https://gitee.com/openharmony-tpc/pinyin4js/blob/master/LICENSE).