Skip to content

Language Code Incompatibility with WhisperLiveKit #2

@Pactortester

Description

@Pactortester

Bug Report: Language Code Incompatibility with WhisperLiveKit

Summary

NLLW does not recognize zh as a valid language code for Chinese, causing integration issues with WhisperLiveKit.

Environment

  • NLLW version: 0.1.4
  • WhisperLiveKit: latest
  • Python: 3.10+

Steps to Reproduce

  1. Install WhisperLiveKit and NLLW:

    pip install whisperlivekit nllw
  2. Run the translation server:

    python -m whisperlivekit.basic_server --lan zh --target-language eng_Latn
  3. Observe the error.

Expected Behavior

The server should start successfully and translate Chinese speech to English.

Actual Behavior

ValueError: Unknown language identifier: zh

Root Cause

WhisperLiveKit passes the --lan parameter to both Whisper and NLLW:

  • Whisper expects zh for Chinese
  • NLLW only accepts zh-CN for Chinese

This creates a conflict where no single value works for both systems:

Parameter Whisper NLLW
--lan zh ✅ Works ❌ Error
--lan zh-CN ❌ Error ✅ Works

Proposed Solution

Support multiple language codes per entry by allowing language_code to be a list:

# Before
{"name": "Chinese (Simplified)", "nllb": "zho_Hans", "language_code": "zh-CN"}

# After
{"name": "Chinese (Simplified)", "nllb": "zho_Hans", "language_code": ["zh-CN", "zh"]}

This approach:

  • Maintains backward compatibility (zh-CN still works)
  • Adds support for Whisper's zh code
  • Avoids duplicate entries in the language list
  • Is extensible for other languages with similar issues

Workaround

Currently, there is no workaround when using NLLW translation mode with WhisperLiveKit for Chinese.

Users can only use Whisper's direct English translation mode:

python -m whisperlivekit.basic_server --lan zh --direct-english-translation

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions