Skip to main content

multitrans

Translate multiple strings to multiple languages wrapping the Google Translate service.

Install

pip install multitrans

Format

from multitrans import translate

result = translate( strings, to_languages, from_language )

Examples

from multitrans import translate

# translate one string to one language
a = translate('en fin stol','en','sv')

# translate multiple strings to one language
b = translate(['en stol','två soffor','tre fönster'],['en'],'sv')

# translate multiple strings to multiple languages
c = translate(['stol','soffa','fönster'],['en','da'],'sv')

print(a)
# {'en': ['a nice chair']}
print(b)
# {'en': ['a chair', 'two sofas', 'three windows']}
print(c)
# {'en': ['chair', 'couch', 'window'], 'da': ['stol', 'sofa', 'vindue']}

Languages

Languages are represented by its two-char-code according to ISO 639-1
A full list of all codes can be found here: https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes

Some examples follow below:

locales = {
  'af': 'Afrikaans',
  'ar': 'Arabic',
  'az': 'Azerbaijani',
  'be': 'Belarusian',
  'bg': 'Bulgarian',
  'bn': 'Bengali',
  'bs': 'Bosnian',
  'ca': 'Catalan',
  'ceb': 'Cebuano',
  'cs': 'Czech',
  'cy': 'Welsh',
  'da': 'Danish',
  'de': 'German',
  'el': 'Greek',
  'en': 'English',
  'eo': 'Esperanto',
  'es': 'Spanish',
  'et': 'Estonian',
  'eu': 'Basque',
  'fa': 'Persian',
  'fi': 'Finnish',
  'fr': 'French',
  'ga': 'Irish',
  'gl': 'Galician',
  'gu': 'Gujarati',
  'ha': 'Hausa',
  'hi': 'Hindi',
  'hr': 'Croatian',
  'ht': 'Haitian Creole',
  'hu': 'Hungarian',
  'hy': 'Armenian',
  'id': 'Indonesian',
  'ig': 'Igbo',
  'is': 'Icelandic',
  'it': 'Italian',
  'iw': 'Hebrew',
  'ja': 'Japanese',
  'jw': 'Javanese',
  'ka': 'Georgian',
  'kk': 'Kazakh',
  'km': 'Khmer',
  'kn': 'Kannada',
  'ko': 'Korean',
  'la': 'Latin',
  'lo': 'Lao',
  'lt': 'Lithuanian',
  'lv': 'Latvian',
  'mg': 'Malagasy',
  'mi': 'Maori',
  'mk': 'Macedonian',
  'ml': 'Malayalam',
  'mn': 'Mongolian',
  'mr': 'Marathi',
  'ms': 'Malay',
  'mt': 'Maltese',
  'my': 'Myanmar (Burmese)',
  'ne': 'Nepali',
  'nl': 'Dutch',
  'no': 'Norwegian',
  'ny': 'Chichewa',
  'pa': 'Punjabi',
  'pl': 'Polish',
  'pt': 'Portuguese',
  'ro': 'Romanian',
  'ru': 'Russian',
  'si': 'Sinhala',
  'sk': 'Slovak',
  'sl': 'Slovenian',
  'so': 'Somali',
  'sq': 'Albanian',
  'sr': 'Serbian',
  'st': 'Sesotho',
  'su': 'Sundanese',
  'sv': 'Swedish',
  'sw': 'Swahili',
  'ta': 'Tamil',
  'te': 'Telugu',
  'tg': 'Tajik',
  'th': 'Thai',
  'tl': 'Filipino',
  'tr': 'Turkish',
  'uk': 'Ukrainian',
  'ur': 'Urdu',
  'uz': 'Uzbek',
  'vi': 'Vietnamese',
  'yi': 'Yiddish',
  'yo': 'Yoruba',
  'zh': 'Chinese',
  'zu': 'Zulu'
  }

Metadata

Release files for multitrans 1.0.0

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

Built distribution (wheel)

Table of built distributions (wheels) for multitrans 1.0.0
File Interpreter ABI Platform Actions
multitrans-1.0.0-py3-none-any.whl Python 3 none any Details for multitrans-1.0.0-py3-none-any.whl

Release files / multitrans-1.0.0-py3-none-any.whl

Download URL multitrans-1.0.0-py3-none-any.whl
Size 4.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3f13d261c2e9651f103a9fafed9c30ac93d8bc6cc96ff292f54f46b1db8922ca
BLAKE2b-256 checksum
How to use checksums
a5381d2dc862a29352d428168fa86d9ae72e55a280e26cc9342db548555d05d3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for multitrans 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.0 This release

1 release file No provenance

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