Skip to main content

google-language-support

A Python package providing comprehensive language code support for Google services.

Installation

pip install google-language-support

Usage

from google_language_support import LanguageCodes

# Access language codes
print(LanguageCodes.ENGLISH)  # "en"
print(LanguageCodes.SPANISH)  # "es"
print(LanguageCodes.CHINESE_SIMPLIFIED)  # "zh-CN"

# Convert to human-readable names
print(LanguageCodes.ENGLISH.to_instruction())  # "English"
print(LanguageCodes.CHINESE_SIMPLIFIED.to_instruction())  # "Chinese, Simplified, China"
print(LanguageCodes.FRENCH_CA.to_instruction())  # "French, Canada"

# Convert from common language names (NEW!)
print(LanguageCodes.from_common_name("English"))  # LanguageCodes.ENGLISH
print(LanguageCodes.from_common_name("spanish"))  # LanguageCodes.SPANISH (case-insensitive)
print(LanguageCodes.from_common_name("zh-CN"))    # LanguageCodes.CHINESE_SIMPLIFIED
print(LanguageCodes.from_common_name("Mandarin")) # LanguageCodes.CHINESE_SIMPLIFIED_2
print(LanguageCodes.from_common_name("Deutsch"))  # LanguageCodes.GERMAN

# Supports various input formats:
print(LanguageCodes.from_common_name("Brazilian Portuguese"))  # LanguageCodes.PORTUGUESE_BR
print(LanguageCodes.from_common_name("Simplified Chinese"))    # LanguageCodes.CHINESE_SIMPLIFIED
print(LanguageCodes.from_common_name("Bahasa Indonesia"))      # LanguageCodes.INDONESIAN

# Fuzzy matching for typos
print(LanguageCodes.from_common_name("Englsh"))    # LanguageCodes.ENGLISH (missing 'i')
print(LanguageCodes.from_common_name("Frech"))     # LanguageCodes.FRENCH (missing 'n')

# Safe version that returns None instead of raising exception
result = LanguageCodes.from_might_common_name("Unknown Language")
print(result)  # None

Features

  • 230+ language codes - Comprehensive coverage of languages supported by Google services
  • Human-readable names - Convert language codes to readable format with to_instruction()
  • Flexible input parsing - Convert from various language name formats with from_common_name()
  • Regional variants - Support for region-specific language codes (e.g., zh-CN, fr-CA, pt-BR)
  • Multiple aliases - Some languages have multiple code representations for compatibility
  • Fuzzy matching - Handles typos and variations in language names (80% similarity threshold)
  • Case-insensitive - Works with any case combination of language names

Supported Input Formats for from_common_name()

  • Enum names: "ENGLISH", "SPANISH", "CHINESE_SIMPLIFIED"
  • Language codes: "en", "es", "zh-CN", "pt-BR"
  • ISO 639-1/639-3 codes: "en"/"eng", "es"/"spa", "fr"/"fra"
  • Common variations: "Chinese", "Tagalog", "Ganda", "Sotho"
  • Native names: "Mandarin", "Farsi", "Deutsch", "Español", "Français"
  • Casual variants: "Brazilian Portuguese", "Canadian French", "American English"
  • Cultural references: "Pinyin", "Kanji", "Hangul", "Cyrillic"
  • Instruction names: "Chinese, Simplified, China", "Filipino (Tagalog)"

Supported Languages

The package includes language codes for major world languages including:

  • European languages (English, Spanish, French, German, etc.)
  • Asian languages (Chinese, Japanese, Korean, Hindi, etc.)
  • African languages (Swahili, Yoruba, Amharic, etc.)
  • Indigenous and regional languages (Quechua, Cherokee, Hawaiian, etc.)

License

MIT License

Metadata

Release files for google-language-support 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for google-language-support 0.3.0
File Size Uploaded
google_language_support-0.3.0.tar.gz 8.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for google-language-support 0.3.0
File Interpreter ABI Platform
google_language_support-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 17.2 kB

Release files / google_language_support-0.3.0.tar.gz

Download URL google_language_support-0.3.0.tar.gz
Size 8.2 kB
Tags Source
SHA-256 checksum
How to use checksums
2147deaa403deaa2e9d158545dde1b2c157d7ff93e94f28c671d65adf96804dd
BLAKE2b-256 checksum
How to use checksums
6e5ec99912e443db2a422392d1e0c80b1aed8a4d284521f5899ffd4e4c7b2179
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.3 CPython/3.11.13 Darwin/25.0.0

Release files / google_language_support-0.3.0-py3-none-any.whl

Download URL google_language_support-0.3.0-py3-none-any.whl
Size 9.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2bfd3f3cec334c7b03122eca2112e247f953d2ef27368cb3555d65478655bade
BLAKE2b-256 checksum
How to use checksums
14ba3aed94053fb85fd499f522a0c4a2b3a4b4a33417494666bfe98ab8c9bab0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.3 CPython/3.11.13 Darwin/25.0.0

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page