qmetrics.net

Pinyin

PHP Chinese text to Pinyin conversion library

Pinyin converts Chinese text to romanization using a dictionary-backed approach with strong handling of multi-syllable words and heteronyms. It installs as a Composer package for PHP applications.

Overview

Pinyin is a PHP library that turns Chinese characters into Pinyin strings for display, search indexing, permalinks, and name handling. It builds on the mozillazg pinyin-data dictionary and focuses on word-aware conversion rather than character-by-character guesses in phrases.

Callers can choose output styles with tone marks, numeric tones, or no tones. Helpers produce URL-safe permalink strings, abbreviation indexes, surname-aware name conversion, and passport-style rules that map ü to yu where required. Multi-character heteronyms can return all readings or context-aware single readings.

Recent versions offer memory, cache, and smart conversion strategies so the same API can suit web requests, batch jobs, or mixed workloads. A standalone command-line entry point supports conversion outside application code, and a separate Laravel integration package is referenced for framework users.

Installation is through Composer. Optional performance tuning documentation compares strategy memory use and throughput for short versus repeated text conversion.

Key features

  • Word-aware Chinese to Pinyin conversion
  • Multiple tone output formats
  • Surname and passport name rules
  • Heteronym-aware readings
  • Permalink and abbreviation helpers
  • Memory, cache, and smart strategies
  • Command-line converter
  • Composer package distribution

Use cases

  • Search indexes from Chinese content
  • URL slugs for Chinese article titles
  • Sorting or filtering by Pinyin initials
  • Correct surname pronunciation in names
  • Laravel app localization helpers

Tags

Similar software

github-chinese

Userscript localization of the GitHub web interface

GitHub 中文化插件 translates GitHub’s English UI into Chinese using a maintained dictionary and regex rules. It runs as a browser userscript with optional machine translation for repository descriptions.

  • Chinese UI translation for GitHub pages
  • Regex and per-page dictionary matching
  • Repository description machine translation
JavaScriptAndroid, Browser extensionDetails →
★ 39.9k⟳ 4 days agoGPL-3.0

i18next

JavaScript internationalization and translation framework

i18next loads and applies translation files in browser, Node.js, and Deno apps. It handles plurals, context, nesting, variables, backends, caching, and language detection.

  • Runtime and build-time translation
  • Plural and context rules
  • Backend translation loading
JavaScriptWeb, CLIDetails →
★ 8.7k⟳ todayMIT

Argos Translate

Open-source offline neural machine translation for Python

Argos Translate is a Python library for offline translation using installable language model packages.

  • Offline Python translation API
  • Installable .argosmodel language packages
  • Command-line translation interface
PythonLinux, Windows, CLIDetails →
★ 6.7k⟳ 6 days agoMIT · open core

JS Lingui

Compile-time i18n macros for JavaScript and TypeScript

Lingui is a lightweight internationalization library with compile-time macros and a CLI. It targets React, React Native, Vue, SolidJS, Astro, Svelte, and plain Node with PO catalog extraction.

  • Compile-time Trans macros for UI text
  • CLI extract and compile PO catalogs
  • React, Vue, Solid, and React Native packages
TypeScriptCLIDetails →
★ 5.9k⟳ 15 days agoMIT

Python Pinyin

Chinese hanzi to pinyin conversion library

python-pinyin (pypinyin) converts Chinese characters to phonetic pinyin for notation, sorting, and search. It handles heteronyms and multiple romanization styles.

  • Phrase-aware pinyin mapping
  • Heteronym support
  • Multiple romanization styles
PythonDetails →
★ 5.4k⟳ 1 month agoMIT

Globalize

CLDR-based JavaScript internationalization library

Globalize formats and parses numbers, dates, and messages using official Unicode CLDR JSON data. It runs in browsers and as a Node.js module with modular feature packages.

  • Unicode CLDR JSON locale data
  • Number, currency, and percent formatting
  • Date and time parsing and display
JavaScriptWebDetails →
★ 4.8k⟳ 17 days agoMIT