Skip to main content

Google language support

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

google_language_support-0.3.0.tar.gz (8.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

google_language_support-0.3.0-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

Details for the file google_language_support-0.3.0.tar.gz.

File metadata

  • Download URL: google_language_support-0.3.0.tar.gz
  • Upload date:
  • Size: 8.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.11.13 Darwin/25.0.0

File hashes

Hashes for google_language_support-0.3.0.tar.gz
Algorithm Hash digest
SHA256 2147deaa403deaa2e9d158545dde1b2c157d7ff93e94f28c671d65adf96804dd
MD5 fb1ab102ac9761d17944cf6975030f9f
BLAKE2b-256 6e5ec99912e443db2a422392d1e0c80b1aed8a4d284521f5899ffd4e4c7b2179

See more details on using hashes here.

File details

Details for the file google_language_support-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for google_language_support-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2bfd3f3cec334c7b03122eca2112e247f953d2ef27368cb3555d65478655bade
MD5 aaeba053f152fbd0cc4dae9e77ab89f9
BLAKE2b-256 14ba3aed94053fb85fd499f522a0c4a2b3a4b4a33417494666bfe98ab8c9bab0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page