{"id":24866,"library":"zhconv","title":"zhconv","description":"A simple implementation of Simplified-Traditional Chinese conversion. Supports zh-Hans, zh-Hant, and regional variants like zh-tw, zh-cn, etc. Based on MediaWiki conversion tables. Current version: 1.4.3. Release cadence is low; maintained as needed.","status":"active","version":"1.4.3","language":"python","source_language":"en","source_url":"https://github.com/gumblex/zhconv","tags":["chinese","simplified","traditional","conversion","zh-cn","zh-tw","zh-hans","zh-hant"],"install":[{"cmd":"pip install zhconv","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"note":"Direct module import does not expose convert; must import the function explicitly.","wrong":"import zhconv","symbol":"convert","correct":"from zhconv import convert"}],"quickstart":{"code":"from zhconv import convert\n\n# Convert simplified Chinese to traditional\nresult = convert('我爱编程', 'zh-tw')\nprint(result)  # 我愛編程\n\n# Convert traditional to simplified\nresult2 = convert('我愛編程', 'zh-cn')\nprint(result2)  # 我爱编程","lang":"python","description":"Basic usage: convert(text, target_variant). Variants include 'zh-hans', 'zh-hant', 'zh-cn', 'zh-tw', 'zh-hk', 'zh-sg', 'zh-mo', etc."},"warnings":[{"fix":"Always specify target variant explicitly, e.g., 'zh-cn' when converting to simplified Chinese.","message":"The library does not auto-detect the source variant; you must specify the target variant. If you want to detect the source, use other libraries like opencc or langid.","severity":"gotcha","affected_versions":"all"},{"fix":"Call convert(text, 'zh-cn') then convert(result, 'zh-tw') for bidirectional conversion.","message":"Conversion is one-way per call; to convert 'back' you need to call convert again with the opposite target. The library does not maintain state.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use 'from zhconv import convert' instead of 'import zhconv'.","cause":"Using import zhconv and then zhconv.convert, but the function is not a module-level attribute when imported as a module.","error":"ImportError: cannot import name 'convert' from 'zhconv'"},{"fix":"Provide target variant: convert('text', 'zh-tw')","cause":"Calling convert() without providing the target variant string.","error":"TypeError: convert() missing 1 required positional argument: 'target'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}