lang

Classes that represent languages and provides language-specific information.

All classes inherit from the parent class called common.

The type of data includes:

af

This module represents the Afrikaans language.

class translate.lang.af.af

This class represents Afrikaans.

classmethod alter_length(text)

Converts the given string by adding or removing characters as an estimation of translation length (with English assumed as source language).

classmethod capsstart(text)

Modify this for the indefinite article (‘n).

classmethod character_iter(text)

Returns an iterator over the characters in text.

classmethod characters(text)

Returns a list of characters in text.

classmethod length_difference(length)

Returns an estimate to a likely change in length relative to an English string of length length.

classmethod numstart(text)

Determines whether the text starts with a numeric value.

classmethod punctranslate(text)

Converts the punctuation in a string according to the rules of the language.

classmethod sentence_iter(text, strip=True)

Returns an iterator over the sentences in text.

classmethod sentences(text, strip=True)

Returns a list of sentences in text.

classmethod word_iter(text)

Returns an iterator over the words in text.

classmethod words(text)

Returns a list of words in text.

translate.lang.af.cyr2lat = {u'\u0401': 'Jo', u'\u0429': 'Sjtsj', u'\u0411': 'B', u'\u0410': 'A', u'\u0413': 'G', u'\u0412': 'W', u'\u0415': 'Je', u'\u0414': 'D', u'\u0417': 'Z', u'\u0416': 'Zj', u'\u0419': 'J', u'\u0418': 'I', u'\u041b': 'L', u'\u041a': 'K', u'\u041d': 'N', u'\u041c': 'M', u'\u041f': 'P', u'\u041e': 'O', u'\u0421': 'S', u'\u0420': 'R', u'\u0423': 'Oe', u'\u0422': 'T', u'\u0425': 'Ch', u'\u0424': 'F', u'\u0427': 'Tj', u'\u0426': 'Ts', u'\u0414\u0416': 'Dj', u'\u0428': 'Sj', u'\u042b': 'I', u'\u042a': '', u'\u042d': 'E', u'\u042c': '', u'\u042f': 'Ja', u'\u042e': 'Joe', u'\u0431': 'b', u'\u0430': 'a', u'\u0433': 'g', u'\u0432': 'w', u'\u0435': 'je', u'\u0434': 'd', u'\u0437': 'z', u'\u0436': 'zj', u'\u0439': 'j', u'\u0438': 'i', u'\u043b': 'l', u'\u043a': 'k', u'\u043d': 'n', u'\u043c': 'm', u'\u043f': 'p', u'\u043e': 'o', u'\u0441': 's', u'\u0440': 'r', u'\u0443': 'oe', u'\u0442': 't', u'\u0445': 'ch', u'\u0444': 'f', u'\u0447': 'tj', u'\u0446': 'ts', u'\u0449': 'sjtsj', u'\u0448': 'sj', u'\u044b': 'i', u'\u044a': '', u'\u044d': 'e', u'\u044c': '', u'\u044f': 'ja', u'\u044e': 'joe', u'\u0451': 'jo', u'\u0435\u0439': 'ei', u'\u0415\u0419': 'Ei', u'\u0434\u0436': 'dj'}

Mapping of Cyrillic to Latin letters for transliteration in Afrikaans

translate.lang.af.tranliterate_cyrillic(text)

Convert Cyrillic text to Latin according to the AWS transliteration rules.

am

This module represents the Amharic language.

class translate.lang.am.am

This class represents Amharic.

classmethod alter_length(text)

Converts the given string by adding or removing characters as an estimation of translation length (with English assumed as source language).

classmethod capsstart(text)

Determines whether the text starts with a capital letter.

classmethod character_iter(text)

Returns an iterator over the characters in text.

classmethod characters(text)

Returns a list of characters in text.

classmethod length_difference(length)

Returns an estimate to a likely change in length relative to an English string of length length.

classmethod numstart(text)

Determines whether the text starts with a numeric value.

classmethod punctranslate(text)

Converts the punctuation in a string according to the rules of the language.

classmethod sentence_iter(text, strip=True)

Returns an iterator over the sentences in text.

classmethod sentences(text, strip=True)

Returns a list of sentences in text.

classmethod word_iter(text)

Returns an iterator over the words in text.

classmethod words(text)

Returns a list of words in text.

ar

This module represents the Arabic language.

class translate.lang.ar.ar

This class represents Arabic.

classmethod alter_length(text)

Converts the given string by adding or removing characters as an estimation of translation length (with English assumed as source language).

classmethod capsstart(text)

Determines whether the text starts with a capital letter.

classmethod character_iter(text)

Returns an iterator over the characters in text.

classmethod characters(text)

Returns a list of characters in text.

classmethod length_difference(length)

Returns an estimate to a likely change in length relative to an English string of length length.

classmethod numstart(text)

Determines whether the text starts with a numeric value.

classmethod sentence_iter(text, strip=True)

Returns an iterator over the sentences in text.

classmethod sentences(text, strip=True)

Returns a list of sentences in text.

classmethod word_iter(text)

Returns an iterator over the words in text.

classmethod words(text)

Returns a list of words in text.

bn

This module represents the Bengali language.

class translate.lang.bn.bn

This class represents Bengali.

classmethod alter_length(text)

Converts the given string by adding or removing characters as an estimation of translation length (with English assumed as source language).

classmethod capsstart(text)

Determines whether the text starts with a capital letter.

classmethod character_iter(text)

Returns an iterator over the characters in text.

classmethod characters(text)

Returns a list of characters in text.

classmethod length_difference(length)

Returns an estimate to a likely change in length relative to an English string of length length.

classmethod numstart(text)

Determines whether the text starts with a numeric value.

classmethod punctranslate(text)

Converts the punctuation in a string according to the rules of the language.

classmethod sentence_iter(text, strip=True)

Returns an iterator over the sentences in text.

classmethod sentences(text, strip=True)

Returns a list of sentences in text.

classmethod word_iter(text)

Returns an iterator over the words in text.

classmethod words(text)

Returns a list of words in text.

code_or

This module represents the Oriya language.

class translate.lang.code_or.code_or

This class represents Oriya.

classmethod alter_length(text)

Converts the given string by adding or removing characters as an estimation of translation length (with English assumed as source language).

classmethod capsstart(text)

Determines whether the text starts with a capital letter.

classmethod character_iter(text)

Returns an iterator over the characters in text.

classmethod characters(text)

Returns a list of characters in text.

classmethod length_difference(length)

Returns an estimate to a likely change in length relative to an English string of length length.

classmethod numstart(text)

Determines whether the text starts with a numeric value.

classmethod punctranslate(text)

Converts the punctuation in a string according to the rules of the language.

classmethod sentence_iter(text, strip=True)

Returns an iterator over the sentences in text.

classmethod sentences(text, strip=True)

Returns a list of sentences in text.

classmethod word_iter(text)

Returns an iterator over the words in text.

classmethod words(text)

Returns a list of words in text.

common

This module contains all the common features for languages.

Supported features:

  • language code (km, af)
  • language name (Khmer, Afrikaans)
  • Plurals
    • Number of plurals (nplurals)
    • Plural equation
  • pofilter tests to ignore

Segmentation:

  • characters
  • words
  • sentences

Punctuation:

  • End of sentence
  • Start of sentence
  • Middle of sentence
  • Quotes
    • single
    • double
  • Valid characters
  • Accelerator characters
  • Special characters
  • Direction (rtl or ltr)

TODOs and Ideas for possible features:

  • Language-Team information
  • Segmentation
    • phrases
class translate.lang.common.Common

This class is the common parent class for all language classes.

CJKpunc = u'\u3002\u3001\uff0c\uff1b\uff01\uff1f\u300c\u300d\u300e\u300f\u3010\u3011'

These punctuation marks are used in certain circumstances with CJK languages.

classmethod alter_length(text)

Converts the given string by adding or removing characters as an estimation of translation length (with English assumed as source language).

classmethod capsstart(text)

Determines whether the text starts with a capital letter.

classmethod character_iter(text)

Returns an iterator over the characters in text.

classmethod characters(text)

Returns a list of characters in text.

checker = None

A language specific checker (see filters.checks).

This doesn’t need to be supplied, but will be used if it exists.

code = ''

The ISO 639 language code, possibly with a country specifier or other modifier.

Examples:

km
pt_BR
sr_YU@Latn
commonpunc = u'.,;:!?-@#$%^*_()[]{}/\\\'`"<>'

These punctuation marks are common in English and most languages that use latin script.

ethiopicpunc = u'\u1362\u1364\u1363'

These punctuation marks are used by several Ethiopic languages.

fullname = ''

The full (English) name of this language.

Dialect codes should have the form of:

ignoretests = []

List of pofilter tests for this language that must be ignored.

indicpunc = u'\u0964\u0965\u0970'

These punctuation marks are used by several Indic languages.

invertedpunc = u'\xbf\xa1'

Inverted punctuation sometimes used at the beginning of sentences in Spanish, Asturian, Galician, and Catalan.

classmethod length_difference(length)

Returns an estimate to a likely change in length relative to an English string of length length.

listseperator = u', '

This string is used to separate lists of textual elements. Most languages probably can stick with the default comma, but Arabic and some Asian languages might want to override this.

miscpunc = u'\u2026\xb1\xb0\xb9\xb2\xb3\xb7\xa9\xae\xd7\xa3\xa5\u20ac'

The middle dot (·) is used by Greek and Georgian.

mozilla_pluralequation = '0'

This of languages that has different plural formula in Mozilla than the standard one in Gettext.

nplurals = 0

The number of plural forms of this language.

0 is not a valid value - it must be overridden. Any positive integer is valid (it should probably be between 1 and 6)

classmethod numstart(text)

Determines whether the text starts with a numeric value.

pluralequation = '0'

The plural equation for selection of plural forms.

This is used for PO files to fill into the header.

puncdict = {}

A dictionary of punctuation transformation rules that can be used by punctranslate().

classmethod punctranslate(text)

Converts the punctuation in a string according to the rules of the language.

punctuation = u'.,;:!?-@#$%^*_()[]{}/\\\'`"<>\u2018\u2019\u201b\u201c\u201d\u201e\u201f\u2032\u2033\u2034\u2035\u2036\u2037\u2039\u203a\xab\xbb\xbf\xa1\u060c\u061f\u061b\xf7\u3002\u3001\uff0c\uff1b\uff01\uff1f\u300c\u300d\u300e\u300f\u3010\u3011\u0964\u0965\u0970\u1362\u1364\u1363\u2026\xb1\xb0\xb9\xb2\xb3\xb7\xa9\xae\xd7\xa3\xa5\u20ac'

We include many types of punctuation here, simply since this is only meant to determine if something is punctuation. Hopefully we catch some languages which might not be represented with modules. Most languages won’t need to override this.

quotes = u'\u2018\u2019\u201b\u201c\u201d\u201e\u201f\u2032\u2033\u2034\u2035\u2036\u2037\u2039\u203a\xab\xbb'

These are different quotation marks used by various languages.

rtlpunc = u'\u060c\u061f\u061b\xf7'

These punctuation marks are used by Arabic and Persian, for example.

classmethod sentence_iter(text, strip=True)

Returns an iterator over the sentences in text.

sentenceend = u'.!?\u2026\u0589\u061f\u0964\u3002\uff01\uff1f\u1362\u06d4'

These marks can indicate a sentence end. Once again we try to account for many languages. Most langauges won’t need to override this.

classmethod sentences(text, strip=True)

Returns a list of sentences in text.

specialchars = u''

Characters used by the language that might not be easy to input with common keyboard layouts

validaccel = None

Characters that can be used as accelerators (access keys) i.e. Alt+X where X is the accelerator. These can include combining diacritics as long as they are accessible from the users keyboard in a single keystroke, but normally they would be at least precomposed characters. All characters, lower and upper, are included in the list.

validdoublewords = []

Some languages allow double words in certain cases. This is a dictionary of such words.

classmethod word_iter(text)

Returns an iterator over the words in text.

classmethod words(text)

Returns a list of words in text.

data

This module stores information and functionality that relates to plurals.

translate.lang.data.expansion_factors = {'fr': 0.28, 'ar': -0.09, 'it': 0.2, 'es': 0.21, 'af': 0.1}

Source to target string length expansion factors.

translate.lang.data.forceunicode(string)

Ensures that the string is in unicode.

Parameters:string (Unicode, String) – A text string
Returns:String converted to Unicode and normalized as needed.
Return type:Unicode
translate.lang.data.gettext_country(langcode=None)

Returns a gettext function to translate country names into the given language, or the system language if no language is specified.

translate.lang.data.gettext_lang(langcode=None)

Returns a gettext function to translate language names into the given language, or the system language if no language is specified.

translate.lang.data.iso3166 = {}

ISO 3166 country codes

translate.lang.data.iso639 = {}

ISO 639 language codes

translate.lang.data.languagematch(languagecode, otherlanguagecode)

matches a languagecode to another, ignoring regions in the second

translate.lang.data.languages = {'son': (u'Songhai languages', 2, '(n != 1)'), 'gu': (u'Gujarati', 2, '(n != 1)'), 'ff': (u'Fulah', 2, '(n != 1)'), 'nqo': (u"N'Ko", 2, '(n > 1)'), 'nso': (u'Pedi; Sepedi; Northern Sotho', 2, '(n != 1)'), 'ca': (u'Catalan; Valencian', 2, '(n != 1)'), 'sco': (u'Scots', 2, '(n != 1)'), 'gun': (u'Gun', 2, '(n > 1)'), 'ca@valencia': (u'Catalan; Valencian (Valencia)', 2, '(n != 1)'), 'gd': (u'Gaelic; Scottish Gaelic', 4, '(n==1 || n==11) ? 0 : (n==2 || n==12) ? 1 : (n > 2 && n < 20) ? 2 : 3'), 'ga': (u'Irish', 5, 'n==1 ? 0 : n==2 ? 1 : n<7 ? 2 : n<11 ? 3 : 4'), 'cs': (u'Czech', 3, '(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2'), 'gl': (u'Galician', 2, '(n != 1)'), 'mfe': (u'Morisyen', 2, '(n > 1)'), 'ps': (u'Pushto; Pashto', 2, '(n != 1)'), 'lb': (u'Luxembourgish; Letzeburgesch', 2, '(n != 1)'), 'pt': (u'Portuguese', 2, '(n != 1)'), 'ln': (u'Lingala', 2, '(n > 1)'), 'lo': (u'Lao', 1, '0'), 'tt': (u'Tatar', 1, '0'), 'pms': (u'Piemontese', 2, '(n != 1)'), 'tr': (u'Turkish', 1, '0'), 'uk': (u'Ukrainian', 3, '(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)'), 'lv': (u'Latvian', 3, '(n%10==1 && n%100!=11 ? 0 : n != 0 ? 1 : 2)'), 'lt': (u'Lithuanian', 3, '(n%10==1 && n%100!=11 ? 0 : n%10>=2 && (n%100<10 || n%100>=20) ? 1 : 2)'), 'pa': (u'Panjabi; Punjabi', 2, '(n != 1)'), 'sw': (u'Swahili', 2, '(n != 1)'), 'tg': (u'Tajik', 2, '(n != 1)'), 'th': (u'Thai', 1, '0'), 'ti': (u'Tigrinya', 2, '(n > 1)'), 'su': (u'Sundanese', 1, '0'), 'te': (u'Telugu', 2, '(n != 1)'), 'is': (u'Icelandic', 2, '(n != 1)'), 'en_GB': (u'English (United Kingdom)', 2, '(n != 1)'), 'ta': (u'Tamil', 2, '(n != 1)'), 'hy': (u'Armenian', 1, '0'), 'pt_BR': (u'Portuguese (Brazil)', 2, '(n != 1)'), 'hr': (u'Croatian', 3, '(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)'), 'de': (u'German', 2, '(n != 1)'), 'ht': (u'Haitian; Haitian Creole', 2, '(n != 1)'), 'da': (u'Danish', 2, '(n != 1)'), 'hi': (u'Hindi', 2, '(n != 1)'), 'dz': (u'Dzongkha', 1, '0'), 'st': (u'Sotho, Southern', 2, '(n != 1)'), 'ha': (u'Hausa', 2, '(n != 1)'), 'he': (u'Hebrew', 2, '(n != 1)'), 'mg': (u'Malagasy', 2, '(n > 1)'), 'fur': (u'Friulian', 2, '(n != 1)'), 'zh_CN': (u'Chinese (China)', 1, '0'), 'ml': (u'Malayalam', 2, '(n != 1)'), 'mn': (u'Mongolian', 2, '(n != 1)'), 'mi': (u'Maori', 2, '(n > 1)'), 'cy': (u'Welsh', 2, '(n==2) ? 1 : 0'), 'en_ZA': (u'English (South Africa)', 2, '(n != 1)'), 'zh_HK': (u'Chinese (Hong Kong)', 1, '0'), 'mt': (u'Maltese', 4, '(n==1 ? 0 : n==0 || ( n%100>1 && n%100<11) ? 1 : (n%100>10 && n%100<20 ) ? 2 : 3)'), 'fil': (u'Filipino; Pilipino', 2, '(n > 1)'), 'ms': (u'Malay', 1, '0'), 'mr': (u'Marathi', 2, '(n != 1)'), 'ug': (u'Uighur; Uyghur', 1, '0'), 'el': (u'Greek, Modern (1453-)', 2, '(n != 1)'), 'eo': (u'Esperanto', 2, '(n != 1)'), 'en': (u'English', 2, '(n != 1)'), 'tk': (u'Turkmen', 2, '(n != 1)'), 'af': (u'Afrikaans', 2, '(n != 1)'), 've': (u'Venda', 2, '(n != 1)'), 'oc': (u'Occitan (post 1500)', 2, '(n > 1)'), 'ak': (u'Akan', 2, 'n > 1'), 'am': (u'Amharic', 2, 'n > 1'), 'it': (u'Italian', 2, '(n != 1)'), 'an': (u'Aragonese', 2, '(n != 1)'), 'ia': (u'Interlingua (International Auxiliary Language Association)', 2, '(n != 1)'), 'ar': (u'Arabic', 6, 'n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 && n%100<=10 ? 3 : n%100>=11 ? 4 : 5'), 'mk': (u'Macedonian', 2, 'n==1 || n%10==1 ? 0 : 1'), 'zu': (u'Zulu', 2, '(n != 1)'), 'eu': (u'Basque', 2, '(n != 1)'), 'et': (u'Estonian', 2, '(n != 1)'), 'az': (u'Azerbaijani', 2, '(n != 1)'), 'id': (u'Indonesian', 1, '0'), 'arn': (u'Mapudungun; Mapuche', 2, 'n > 1'), 'bn_IN': (u'Bengali (India)', 2, '(n != 1)'), 'pap': (u'Papiamento', 2, '(n != 1)'), 'ru': (u'Russian', 3, '(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)'), 'nl': (u'Dutch; Flemish', 2, '(n != 1)'), 'yo': (u'Yoruba', 2, '(n != 1)'), 'nn': (u'Norwegian Nynorsk; Nynorsk, Norwegian', 2, '(n != 1)'), 'nah': (u'Nahuatl languages', 2, '(n != 1)'), 'ne': (u'Nepali', 2, '(n != 1)'), 'csb': (u'Kashubian', 3, 'n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2'), 'wo': (u'Wolof', 2, '(n != 1)'), 'nap': (u'Neapolitan', 2, '(n != 1)'), 'es': (u'Spanish; Castilian', 2, '(n != 1)'), 'rm': (u'Romansh', 2, '(n != 1)'), 'zh_TW': (u'Chinese (Taiwan)', 1, '0'), 'ro': (u'Romanian', 3, '(n==1 ? 0 : (n==0 || (n%100 > 0 && n%100 < 20)) ? 1 : 2);'), 'sah': (u'Yakut', 1, '0'), 'jv': (u'Javanese', 2, '(n != 1)'), 'be': (u'Belarusian', 3, 'n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2'), 'fr': (u'French', 2, '(n > 1)'), 'bg': (u'Bulgarian', 2, '(n != 1)'), 'sv': (u'Swedish', 2, '(n != 1)'), 'wa': (u'Walloon', 2, '(n > 1)'), 'ast': (u'Asturian; Bable; Leonese; Asturleonese', 2, '(n != 1)'), 'vi': (u'Vietnamese', 1, '0'), 'fy': (u'Frisian', 2, '(n != 1)'), 'bn': (u'Bengali', 2, '(n != 1)'), 'bo': (u'Tibetan', 1, '0'), 'fa': (u'Persian', 1, '0'), 'br': (u'Breton', 2, 'n > 1'), 'bs': (u'Bosnian', 3, 'n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2'), 'mai': (u'Maithili', 2, '(n != 1)'), 'fi': (u'Finnish', 2, '(n != 1)'), 'hu': (u'Hungarian', 2, '(n != 1)'), 'ja': (u'Japanese', 1, '0'), 'fo': (u'Faroese', 2, '(n != 1)'), 'ka': (u'Georgian', 1, '0'), 'so': (u'Somali', 2, '(n != 1)'), 'kk': (u'Kazakh', 1, '0'), 'sr': (u'Serbian', 3, '(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)'), 'sq': (u'Albanian', 2, '(n != 1)'), 'ko': (u'Korean', 1, '0'), 'kn': (u'Kannada', 2, '(n != 1)'), 'km': (u'Central Khmer', 1, '0'), 'or': (u'Oriya', 2, '(n != 1)'), 'sk': (u'Slovak', 3, '(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2'), 'si': (u'Sinhala; Sinhalese', 2, '(n != 1)'), 'pl': (u'Polish', 3, '(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)'), 'kw': (u'Cornish', 4, '(n==1) ? 0 : (n==2) ? 1 : (n == 3) ? 2 : 3'), 'ku': (u'Kurdish', 2, '(n != 1)'), 'sl': (u'Slovenian', 4, '(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3)'), 'ky': (u'Kirghiz; Kyrgyz', 1, '0'), 'nb': (u'Bokm\xe5l, Norwegian; Norwegian Bokm\xe5l', 2, '(n != 1)')}

Dictionary of language data. The language code is the dictionary key (which may contain country codes and modifiers). The value is a tuple: (Full name in English from iso-codes, nplurals, plural equation).

Note that the English names should not be used in user facing places - it should always be passed through the function returned from tr_lang(), or at least passed through _fix_language_name().

translate.lang.data.normalize(string, normal_form='NFC')

Return a unicode string in its normalized form

Parameters:
  • string – The string to be normalized
  • normal_form – NFC (default), NFD, NFKC, NFKD
Returns:

Normalized string

translate.lang.data.normalized_unicode(string)

Forces the string to unicode and does normalization.

translate.lang.data.simplercode(code)

This attempts to simplify the given language code by ignoring country codes, for example.

translate.lang.data.simplify_to_common(language_code, languages={'son': (u'Songhai languages', 2, '(n != 1)'), 'gu': (u'Gujarati', 2, '(n != 1)'), 'ff': (u'Fulah', 2, '(n != 1)'), 'nqo': (u"N'Ko", 2, '(n > 1)'), 'nso': (u'Pedi; Sepedi; Northern Sotho', 2, '(n != 1)'), 'ca': (u'Catalan; Valencian', 2, '(n != 1)'), 'sco': (u'Scots', 2, '(n != 1)'), 'gun': (u'Gun', 2, '(n > 1)'), 'ca@valencia': (u'Catalan; Valencian (Valencia)', 2, '(n != 1)'), 'gd': (u'Gaelic; Scottish Gaelic', 4, '(n==1 || n==11) ? 0 : (n==2 || n==12) ? 1 : (n > 2 && n < 20) ? 2 : 3'), 'ga': (u'Irish', 5, 'n==1 ? 0 : n==2 ? 1 : n<7 ? 2 : n<11 ? 3 : 4'), 'cs': (u'Czech', 3, '(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2'), 'gl': (u'Galician', 2, '(n != 1)'), 'mfe': (u'Morisyen', 2, '(n > 1)'), 'ps': (u'Pushto; Pashto', 2, '(n != 1)'), 'lb': (u'Luxembourgish; Letzeburgesch', 2, '(n != 1)'), 'pt': (u'Portuguese', 2, '(n != 1)'), 'ln': (u'Lingala', 2, '(n > 1)'), 'lo': (u'Lao', 1, '0'), 'tt': (u'Tatar', 1, '0'), 'pms': (u'Piemontese', 2, '(n != 1)'), 'tr': (u'Turkish', 1, '0'), 'uk': (u'Ukrainian', 3, '(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)'), 'lv': (u'Latvian', 3, '(n%10==1 && n%100!=11 ? 0 : n != 0 ? 1 : 2)'), 'lt': (u'Lithuanian', 3, '(n%10==1 && n%100!=11 ? 0 : n%10>=2 && (n%100<10 || n%100>=20) ? 1 : 2)'), 'pa': (u'Panjabi; Punjabi', 2, '(n != 1)'), 'sw': (u'Swahili', 2, '(n != 1)'), 'tg': (u'Tajik', 2, '(n != 1)'), 'th': (u'Thai', 1, '0'), 'ti': (u'Tigrinya', 2, '(n > 1)'), 'su': (u'Sundanese', 1, '0'), 'te': (u'Telugu', 2, '(n != 1)'), 'is': (u'Icelandic', 2, '(n != 1)'), 'en_GB': (u'English (United Kingdom)', 2, '(n != 1)'), 'ta': (u'Tamil', 2, '(n != 1)'), 'hy': (u'Armenian', 1, '0'), 'pt_BR': (u'Portuguese (Brazil)', 2, '(n != 1)'), 'hr': (u'Croatian', 3, '(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)'), 'de': (u'German', 2, '(n != 1)'), 'ht': (u'Haitian; Haitian Creole', 2, '(n != 1)'), 'da': (u'Danish', 2, '(n != 1)'), 'hi': (u'Hindi', 2, '(n != 1)'), 'dz': (u'Dzongkha', 1, '0'), 'st': (u'Sotho, Southern', 2, '(n != 1)'), 'ha': (u'Hausa', 2, '(n != 1)'), 'he': (u'Hebrew', 2, '(n != 1)'), 'mg': (u'Malagasy', 2, '(n > 1)'), 'fur': (u'Friulian', 2, '(n != 1)'), 'zh_CN': (u'Chinese (China)', 1, '0'), 'ml': (u'Malayalam', 2, '(n != 1)'), 'mn': (u'Mongolian', 2, '(n != 1)'), 'mi': (u'Maori', 2, '(n > 1)'), 'cy': (u'Welsh', 2, '(n==2) ? 1 : 0'), 'en_ZA': (u'English (South Africa)', 2, '(n != 1)'), 'zh_HK': (u'Chinese (Hong Kong)', 1, '0'), 'mt': (u'Maltese', 4, '(n==1 ? 0 : n==0 || ( n%100>1 && n%100<11) ? 1 : (n%100>10 && n%100<20 ) ? 2 : 3)'), 'fil': (u'Filipino; Pilipino', 2, '(n > 1)'), 'ms': (u'Malay', 1, '0'), 'mr': (u'Marathi', 2, '(n != 1)'), 'ug': (u'Uighur; Uyghur', 1, '0'), 'el': (u'Greek, Modern (1453-)', 2, '(n != 1)'), 'eo': (u'Esperanto', 2, '(n != 1)'), 'en': (u'English', 2, '(n != 1)'), 'tk': (u'Turkmen', 2, '(n != 1)'), 'af': (u'Afrikaans', 2, '(n != 1)'), 've': (u'Venda', 2, '(n != 1)'), 'oc': (u'Occitan (post 1500)', 2, '(n > 1)'), 'ak': (u'Akan', 2, 'n > 1'), 'am': (u'Amharic', 2, 'n > 1'), 'it': (u'Italian', 2, '(n != 1)'), 'an': (u'Aragonese', 2, '(n != 1)'), 'ia': (u'Interlingua (International Auxiliary Language Association)', 2, '(n != 1)'), 'ar': (u'Arabic', 6, 'n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 && n%100<=10 ? 3 : n%100>=11 ? 4 : 5'), 'mk': (u'Macedonian', 2, 'n==1 || n%10==1 ? 0 : 1'), 'zu': (u'Zulu', 2, '(n != 1)'), 'eu': (u'Basque', 2, '(n != 1)'), 'et': (u'Estonian', 2, '(n != 1)'), 'az': (u'Azerbaijani', 2, '(n != 1)'), 'id': (u'Indonesian', 1, '0'), 'arn': (u'Mapudungun; Mapuche', 2, 'n > 1'), 'bn_IN': (u'Bengali (India)', 2, '(n != 1)'), 'pap': (u'Papiamento', 2, '(n != 1)'), 'ru': (u'Russian', 3, '(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)'), 'nl': (u'Dutch; Flemish', 2, '(n != 1)'), 'yo': (u'Yoruba', 2, '(n != 1)'), 'nn': (u'Norwegian Nynorsk; Nynorsk, Norwegian', 2, '(n != 1)'), 'nah': (u'Nahuatl languages', 2, '(n != 1)'), 'ne': (u'Nepali', 2, '(n != 1)'), 'csb': (u'Kashubian', 3, 'n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2'), 'wo': (u'Wolof', 2, '(n != 1)'), 'nap': (u'Neapolitan', 2, '(n != 1)'), 'es': (u'Spanish; Castilian', 2, '(n != 1)'), 'rm': (u'Romansh', 2, '(n != 1)'), 'zh_TW': (u'Chinese (Taiwan)', 1, '0'), 'ro': (u'Romanian', 3, '(n==1 ? 0 : (n==0 || (n%100 > 0 && n%100 < 20)) ? 1 : 2);'), 'sah': (u'Yakut', 1, '0'), 'jv': (u'Javanese', 2, '(n != 1)'), 'be': (u'Belarusian', 3, 'n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2'), 'fr': (u'French', 2, '(n > 1)'), 'bg': (u'Bulgarian', 2, '(n != 1)'), 'sv': (u'Swedish', 2, '(n != 1)'), 'wa': (u'Walloon', 2, '(n > 1)'), 'ast': (u'Asturian; Bable; Leonese; Asturleonese', 2, '(n != 1)'), 'vi': (u'Vietnamese', 1, '0'), 'fy': (u'Frisian', 2, '(n != 1)'), 'bn': (u'Bengali', 2, '(n != 1)'), 'bo': (u'Tibetan', 1, '0'), 'fa': (u'Persian', 1, '0'), 'br': (u'Breton', 2, 'n > 1'), 'bs': (u'Bosnian', 3, 'n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2'), 'mai': (u'Maithili', 2, '(n != 1)'), 'fi': (u'Finnish', 2, '(n != 1)'), 'hu': (u'Hungarian', 2, '(n != 1)'), 'ja': (u'Japanese', 1, '0'), 'fo': (u'Faroese', 2, '(n != 1)'), 'ka': (u'Georgian', 1, '0'), 'so': (u'Somali', 2, '(n != 1)'), 'kk': (u'Kazakh', 1, '0'), 'sr': (u'Serbian', 3, '(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)'), 'sq': (u'Albanian', 2, '(n != 1)'), 'ko': (u'Korean', 1, '0'), 'kn': (u'Kannada', 2, '(n != 1)'), 'km': (u'Central Khmer', 1, '0'), 'or': (u'Oriya', 2, '(n != 1)'), 'sk': (u'Slovak', 3, '(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2'), 'si': (u'Sinhala; Sinhalese', 2, '(n != 1)'), 'pl': (u'Polish', 3, '(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)'), 'kw': (u'Cornish', 4, '(n==1) ? 0 : (n==2) ? 1 : (n == 3) ? 2 : 3'), 'ku': (u'Kurdish', 2, '(n != 1)'), 'sl': (u'Slovenian', 4, '(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3)'), 'ky': (u'Kirghiz; Kyrgyz', 1, '0'), 'nb': (u'Bokm\xe5l, Norwegian; Norwegian Bokm\xe5l', 2, '(n != 1)')})

Simplify language code to the most commonly used form for the language, stripping country information for languages that tend not to be localized differently for different countries

translate.lang.data.tr_lang(langcode=None)

Gives a function that can translate a language name, even in the form "language (country)", into the language with iso code langcode, or the system language if no language is specified.

de

This module represents the German language.

class translate.lang.de.de

This class represents German.

classmethod alter_length(text)

Converts the given string by adding or removing characters as an estimation of translation length (with English assumed as source language).

classmethod capsstart(text)

Determines whether the text starts with a capital letter.

classmethod character_iter(text)

Returns an iterator over the characters in text.

classmethod characters(text)

Returns a list of characters in text.

classmethod length_difference(length)

Returns an estimate to a likely change in length relative to an English string of length length.

classmethod numstart(text)

Determines whether the text starts with a numeric value.

classmethod punctranslate(text)

Converts the punctuation in a string according to the rules of the language.

classmethod sentence_iter(text, strip=True)

Returns an iterator over the sentences in text.

classmethod sentences(text, strip=True)

Returns a list of sentences in text.

classmethod word_iter(text)

Returns an iterator over the words in text.

classmethod words(text)

Returns a list of words in text.

el

This module represents the Greek language.

class translate.lang.el.el

This class represents Greek.

classmethod alter_length(text)

Converts the given string by adding or removing characters as an estimation of translation length (with English assumed as source language).

classmethod capsstart(text)

Determines whether the text starts with a capital letter.

classmethod character_iter(text)

Returns an iterator over the characters in text.

classmethod characters(text)

Returns a list of characters in text.

classmethod length_difference(length)

Returns an estimate to a likely change in length relative to an English string of length length.

classmethod numstart(text)

Determines whether the text starts with a numeric value.

classmethod punctranslate(text)

Converts the punctuation in a string according to the rules of the language.

classmethod sentence_iter(text, strip=True)

Returns an iterator over the sentences in text.

classmethod sentences(text, strip=True)

Returns a list of sentences in text.

classmethod word_iter(text)

Returns an iterator over the words in text.

classmethod words(text)

Returns a list of words in text.

es

This module represents the Spanish language.

Note

As it only has special case code for initial inverted punctuation, it could also be used for Asturian, Galician, or Catalan.

class translate.lang.es.es

This class represents Spanish.

classmethod alter_length(text)

Converts the given string by adding or removing characters as an estimation of translation length (with English assumed as source language).

classmethod capsstart(text)

Determines whether the text starts with a capital letter.

classmethod character_iter(text)

Returns an iterator over the characters in text.

classmethod characters(text)

Returns a list of characters in text.

classmethod length_difference(length)

Returns an estimate to a likely change in length relative to an English string of length length.

classmethod numstart(text)

Determines whether the text starts with a numeric value.

classmethod punctranslate(text)

Implement some extra features for inverted punctuation.

classmethod sentence_iter(text, strip=True)

Returns an iterator over the sentences in text.

classmethod sentences(text, strip=True)

Returns a list of sentences in text.

classmethod word_iter(text)

Returns an iterator over the words in text.

classmethod words(text)

Returns a list of words in text.

factory

This module provides a factory to instantiate language classes.

translate.lang.factory.getlanguage(code)

This returns a language class.

Parameters:code – The ISO 639 language code

fa

This module represents the Persian language.

class translate.lang.fa.fa

This class represents Persian.

classmethod alter_length(text)

Converts the given string by adding or removing characters as an estimation of translation length (with English assumed as source language).

classmethod capsstart(text)

Determines whether the text starts with a capital letter.

classmethod character_iter(text)

Returns an iterator over the characters in text.

classmethod characters(text)

Returns a list of characters in text.

classmethod length_difference(length)

Returns an estimate to a likely change in length relative to an English string of length length.

classmethod numstart(text)

Determines whether the text starts with a numeric value.

classmethod punctranslate(text)

Implement “French” quotation marks.

classmethod sentence_iter(text, strip=True)

Returns an iterator over the sentences in text.

classmethod sentences(text, strip=True)

Returns a list of sentences in text.

classmethod word_iter(text)

Returns an iterator over the words in text.

classmethod words(text)

Returns a list of words in text.

fi

This module represents the Finnish language.

class translate.lang.fi.fi

This class represents Finnish.

classmethod alter_length(text)

Converts the given string by adding or removing characters as an estimation of translation length (with English assumed as source language).

classmethod capsstart(text)

Determines whether the text starts with a capital letter.

classmethod character_iter(text)

Returns an iterator over the characters in text.

classmethod characters(text)

Returns a list of characters in text.

classmethod length_difference(length)

Returns an estimate to a likely change in length relative to an English string of length length.

classmethod numstart(text)

Determines whether the text starts with a numeric value.

classmethod punctranslate(text)

Converts the punctuation in a string according to the rules of the language.

classmethod sentence_iter(text, strip=True)

Returns an iterator over the sentences in text.

classmethod sentences(text, strip=True)

Returns a list of sentences in text.

classmethod word_iter(text)

Returns an iterator over the words in text.

classmethod words(text)

Returns a list of words in text.

fr

This module represents the French language.

class translate.lang.fr.fr

This class represents French.

classmethod alter_length(text)

Converts the given string by adding or removing characters as an estimation of translation length (with English assumed as source language).

classmethod capsstart(text)

Determines whether the text starts with a capital letter.

classmethod character_iter(text)

Returns an iterator over the characters in text.

classmethod characters(text)

Returns a list of characters in text.

classmethod length_difference(length)

Returns an estimate to a likely change in length relative to an English string of length length.

classmethod numstart(text)

Determines whether the text starts with a numeric value.

classmethod punctranslate(text)

Implement some extra features for quotation marks.

Known shortcomings:
  • % and $ are not touched yet for fear of variables
  • Double spaces might be introduced
classmethod sentence_iter(text, strip=True)

Returns an iterator over the sentences in text.

classmethod sentences(text, strip=True)

Returns a list of sentences in text.

classmethod word_iter(text)

Returns an iterator over the words in text.

classmethod words(text)

Returns a list of words in text.

gu

This module represents the Gujarati language.

class translate.lang.gu.gu

This class represents Gujarati.

classmethod alter_length(text)

Converts the given string by adding or removing characters as an estimation of translation length (with English assumed as source language).

classmethod capsstart(text)

Determines whether the text starts with a capital letter.

classmethod character_iter(text)

Returns an iterator over the characters in text.

classmethod characters(text)

Returns a list of characters in text.

classmethod length_difference(length)

Returns an estimate to a likely change in length relative to an English string of length length.

classmethod numstart(text)

Determines whether the text starts with a numeric value.

classmethod punctranslate(text)

Converts the punctuation in a string according to the rules of the language.

classmethod sentence_iter(text, strip=True)

Returns an iterator over the sentences in text.

classmethod sentences(text, strip=True)

Returns a list of sentences in text.

classmethod word_iter(text)

Returns an iterator over the words in text.

classmethod words(text)

Returns a list of words in text.

he

This module represents the Hebrew language.

class translate.lang.he.he

This class represents Hebrew.

classmethod alter_length(text)

Converts the given string by adding or removing characters as an estimation of translation length (with English assumed as source language).

classmethod capsstart(text)

Determines whether the text starts with a capital letter.

classmethod character_iter(text)

Returns an iterator over the characters in text.

classmethod characters(text)

Returns a list of characters in text.

classmethod length_difference(length)

Returns an estimate to a likely change in length relative to an English string of length length.

classmethod numstart(text)

Determines whether the text starts with a numeric value.

classmethod punctranslate(text)

Converts the punctuation in a string according to the rules of the language.

classmethod sentence_iter(text, strip=True)

Returns an iterator over the sentences in text.

classmethod sentences(text, strip=True)

Returns a list of sentences in text.

classmethod word_iter(text)

Returns an iterator over the words in text.

classmethod words(text)

Returns a list of words in text.

hi

This module represents the Hindi language.

class translate.lang.hi.hi

This class represents Hindi.

classmethod alter_length(text)

Converts the given string by adding or removing characters as an estimation of translation length (with English assumed as source language).

classmethod capsstart(text)

Determines whether the text starts with a capital letter.

classmethod character_iter(text)

Returns an iterator over the characters in text.

classmethod characters(text)

Returns a list of characters in text.

classmethod length_difference(length)

Returns an estimate to a likely change in length relative to an English string of length length.

classmethod numstart(text)

Determines whether the text starts with a numeric value.

classmethod punctranslate(text)

Converts the punctuation in a string according to the rules of the language.

classmethod sentence_iter(text, strip=True)

Returns an iterator over the sentences in text.

classmethod sentences(text, strip=True)

Returns a list of sentences in text.

classmethod word_iter(text)

Returns an iterator over the words in text.

classmethod words(text)

Returns a list of words in text.

hy

This module represents the Armenian language.

class translate.lang.hy.hy

This class represents Armenian.

classmethod alter_length(text)

Converts the given string by adding or removing characters as an estimation of translation length (with English assumed as source language).

classmethod capsstart(text)

Determines whether the text starts with a capital letter.

classmethod character_iter(text)

Returns an iterator over the characters in text.

classmethod characters(text)

Returns a list of characters in text.

classmethod length_difference(length)

Returns an estimate to a likely change in length relative to an English string of length length.

classmethod numstart(text)

Determines whether the text starts with a numeric value.

classmethod punctranslate(text)

Converts the punctuation in a string according to the rules of the language.

classmethod sentence_iter(text, strip=True)

Returns an iterator over the sentences in text.

classmethod sentences(text, strip=True)

Returns a list of sentences in text.

classmethod word_iter(text)

Returns an iterator over the words in text.

classmethod words(text)

Returns a list of words in text.

identify

This module contains functions for identifying languages based on language models.

ja

This module represents the Japanese language.

class translate.lang.ja.ja

This class represents Japanese.

classmethod alter_length(text)

Converts the given string by adding or removing characters as an estimation of translation length (with English assumed as source language).

classmethod capsstart(text)

Determines whether the text starts with a capital letter.

classmethod character_iter(text)

Returns an iterator over the characters in text.

classmethod characters(text)

Returns a list of characters in text.

classmethod length_difference(length)

Returns an estimate to a likely change in length relative to an English string of length length.

classmethod numstart(text)

Determines whether the text starts with a numeric value.

classmethod punctranslate(text)

Converts the punctuation in a string according to the rules of the language.

classmethod sentence_iter(text, strip=True)

Returns an iterator over the sentences in text.

classmethod sentences(text, strip=True)

Returns a list of sentences in text.

classmethod word_iter(text)

Returns an iterator over the words in text.

classmethod words(text)

Returns a list of words in text.

km

This module represents the Khmer language.

class translate.lang.km.km

This class represents Khmer.

classmethod alter_length(text)

Converts the given string by adding or removing characters as an estimation of translation length (with English assumed as source language).

classmethod capsstart(text)

Determines whether the text starts with a capital letter.

classmethod character_iter(text)

Returns an iterator over the characters in text.

classmethod characters(text)

Returns a list of characters in text.

khmerpunc = u'\u17d4\u17d5\u17d6\u17d8'

These marks are only used for Khmer.

classmethod length_difference(length)

Returns an estimate to a likely change in length relative to an English string of length length.

classmethod numstart(text)

Determines whether the text starts with a numeric value.

classmethod punctranslate(text)

Converts the punctuation in a string according to the rules of the language.

classmethod sentence_iter(text, strip=True)

Returns an iterator over the sentences in text.

classmethod sentences(text, strip=True)

Returns a list of sentences in text.

classmethod word_iter(text)

Returns an iterator over the words in text.

classmethod words(text)

Returns a list of words in text.

kn

This module represents the Kannada language.

class translate.lang.kn.kn

This class represents Kannada.

classmethod alter_length(text)

Converts the given string by adding or removing characters as an estimation of translation length (with English assumed as source language).

classmethod capsstart(text)

Determines whether the text starts with a capital letter.

classmethod character_iter(text)

Returns an iterator over the characters in text.

classmethod characters(text)

Returns a list of characters in text.

classmethod length_difference(length)

Returns an estimate to a likely change in length relative to an English string of length length.

classmethod numstart(text)

Determines whether the text starts with a numeric value.

classmethod punctranslate(text)

Converts the punctuation in a string according to the rules of the language.

classmethod sentence_iter(text, strip=True)

Returns an iterator over the sentences in text.

classmethod sentences(text, strip=True)

Returns a list of sentences in text.

classmethod word_iter(text)

Returns an iterator over the words in text.

classmethod words(text)

Returns a list of words in text.

ko

This module represents the Korean language.

class translate.lang.ko.ko

This class represents Korean.

classmethod alter_length(text)

Converts the given string by adding or removing characters as an estimation of translation length (with English assumed as source language).

classmethod capsstart(text)

Determines whether the text starts with a capital letter.

classmethod character_iter(text)

Returns an iterator over the characters in text.

classmethod characters(text)

Returns a list of characters in text.

classmethod length_difference(length)

Returns an estimate to a likely change in length relative to an English string of length length.

classmethod numstart(text)

Determines whether the text starts with a numeric value.

classmethod punctranslate(text)

Converts the punctuation in a string according to the rules of the language.

classmethod sentence_iter(text, strip=True)

Returns an iterator over the sentences in text.

classmethod sentences(text, strip=True)

Returns a list of sentences in text.

classmethod word_iter(text)

Returns an iterator over the words in text.

classmethod words(text)

Returns a list of words in text.

ml

This module represents the Malayalam language.

class translate.lang.ml.ml

This class represents Malayalam.

classmethod alter_length(text)

Converts the given string by adding or removing characters as an estimation of translation length (with English assumed as source language).

classmethod capsstart(text)

Determines whether the text starts with a capital letter.

classmethod character_iter(text)

Returns an iterator over the characters in text.

classmethod characters(text)

Returns a list of characters in text.

classmethod length_difference(length)

Returns an estimate to a likely change in length relative to an English string of length length.

classmethod numstart(text)

Determines whether the text starts with a numeric value.

classmethod punctranslate(text)

Converts the punctuation in a string according to the rules of the language.

classmethod sentence_iter(text, strip=True)

Returns an iterator over the sentences in text.

classmethod sentences(text, strip=True)

Returns a list of sentences in text.

classmethod word_iter(text)

Returns an iterator over the words in text.

classmethod words(text)

Returns a list of words in text.

mr

This module represents the Marathi language.

class translate.lang.mr.mr

This class represents Marathi.

classmethod alter_length(text)

Converts the given string by adding or removing characters as an estimation of translation length (with English assumed as source language).

classmethod capsstart(text)

Determines whether the text starts with a capital letter.

classmethod character_iter(text)

Returns an iterator over the characters in text.

classmethod characters(text)

Returns a list of characters in text.

classmethod length_difference(length)

Returns an estimate to a likely change in length relative to an English string of length length.

classmethod numstart(text)

Determines whether the text starts with a numeric value.

classmethod punctranslate(text)

Converts the punctuation in a string according to the rules of the language.

classmethod sentence_iter(text, strip=True)

Returns an iterator over the sentences in text.

classmethod sentences(text, strip=True)

Returns a list of sentences in text.

classmethod word_iter(text)

Returns an iterator over the words in text.

classmethod words(text)

Returns a list of words in text.

ne

This module represents the Nepali language.

class translate.lang.ne.ne

This class represents Nepali.

classmethod alter_length(text)

Converts the given string by adding or removing characters as an estimation of translation length (with English assumed as source language).

classmethod capsstart(text)

Determines whether the text starts with a capital letter.

classmethod character_iter(text)

Returns an iterator over the characters in text.

classmethod characters(text)

Returns a list of characters in text.

classmethod length_difference(length)

Returns an estimate to a likely change in length relative to an English string of length length.

classmethod numstart(text)

Determines whether the text starts with a numeric value.

classmethod punctranslate(text)

Converts the punctuation in a string according to the rules of the language.

classmethod sentence_iter(text, strip=True)

Returns an iterator over the sentences in text.

classmethod sentences(text, strip=True)

Returns a list of sentences in text.

classmethod word_iter(text)

Returns an iterator over the words in text.

classmethod words(text)

Returns a list of words in text.

ngram

Ngram models for language guessing.

pa

This module represents the Punjabi language.

class translate.lang.pa.pa

This class represents Punjabi.

classmethod alter_length(text)

Converts the given string by adding or removing characters as an estimation of translation length (with English assumed as source language).

classmethod capsstart(text)

Determines whether the text starts with a capital letter.

classmethod character_iter(text)

Returns an iterator over the characters in text.

classmethod characters(text)

Returns a list of characters in text.

classmethod length_difference(length)

Returns an estimate to a likely change in length relative to an English string of length length.

classmethod numstart(text)

Determines whether the text starts with a numeric value.

classmethod punctranslate(text)

Converts the punctuation in a string according to the rules of the language.

classmethod sentence_iter(text, strip=True)

Returns an iterator over the sentences in text.

classmethod sentences(text, strip=True)

Returns a list of sentences in text.

classmethod word_iter(text)

Returns an iterator over the words in text.

classmethod words(text)

Returns a list of words in text.

poedit

Functions to manage Poedit’s language features.

Note

The ISO 639 maps are from Poedit’s isocode.cpp (v1.4.2) to ensure that we match currently released versions of Poedit.

translate.lang.poedit.dialects = {'Portuguese': {'BRAZIL': 'pt_BR', 'None': 'pt', 'PORTUGAL': 'pt'}, 'Chinese': {'TAIWAN': 'zh_TW', 'CHINA': 'zh_CN', 'None': 'zh_CN'}, 'English': {'UNITED KINGDOM': 'en_GB', 'None': 'en', 'SOUTH AFRICA': 'en_ZA'}}

Language dialects based on ISO 3166 country names, ‘None’ is the default fallback

translate.lang.poedit.isocode(language, country=None)

Returns a language code for the given Poedit language name.

Poedit uses language and country names in the PO header entries:

  • X-Poedit-Language
  • X-Poedit-Country

This function converts the supplied language name into the required ISO 639 code. If needed, in the case of dialects, the country name is used to create an xx_YY style dialect code.

Parameters:
  • language (String) – Language name
  • country (String) – Country name
Returns:

ISO 639 language code

Return type:

String

translate.lang.poedit.lang_codes = {'vi': 'Vietnamese', 'gu': 'Gujarati', 'ch': 'Chamorro', 'co': 'Corsican', 'ca': 'Catalan', 'xh': 'Xhosa', 'ce': 'Chechen', 'ts': 'Tsonga', 'sm': 'Samoan', 'cy': 'Welsh', 'en': 'English', 'ga': 'Irish', 'cs': 'Czech', 'gn': 'Guarani', 'gl': 'Galician', 'cv': 'Chuvash', 'cu': 'Church Slavic', 'ps': 'Pashto, Pushto', 'lb': 'Letzeburgesch', 'pt': 'Portuguese', 'la': 'Latin', 'ln': 'Lingala', 'lo': 'Lao', 'tt': 'Tatar', 'tr': 'Turkish', 'tl': 'Tagalog', 'uk': 'Ukrainian', 'lv': 'Latvian', 'to': 'Tonga', 'lt': 'Lithuanian', 'pa': 'Panjabi', 'sw': 'Swahili', 'tk': 'Turkmen', 'jw': 'Javanese', 'ti': 'Tigrinya', 'tg': 'Tajik', 'pi': 'Pali', 'ia': 'Interlingua', 'pl': 'Polish', 'ta': 'Tamil', 'hz': 'Herero', 'zh': 'Chinese', 'hy': 'Armenian', 'th': 'Thai', 'yo': 'Yoruba', 'hr': 'Croatian', 'iu': 'Inuktitut', 'de': 'German', 'om': '(Afan) Oromo', 'da': 'Danish', 'za': 'Zhuang', 'hi': 'Hindi', 'dz': 'Dzongkha', 'ho': 'Hiri Motu', 'st': 'Sesotho', 'qu': 'Quechua', 'ha': 'Hausa', 'rn': 'Rundi', 'he': 'Hebrew', 'mg': 'Malagasy', 'te': 'Telugu', 'fur': 'Friulian', 'uz': 'Uzbek', 'sa': 'Sanskrit', 'ml': 'Malayalam', 'mo': 'Moldavian', 'mn': 'Mongolian', 'mi': 'Maori', 'ik': 'Inupiaq', 'mk': 'Macedonian', 'ur': 'Urdu', 'mt': 'Maltese', 'sr': 'Serbian', 'gd': 'Gaelic', 'sk': 'Slovak', 'ms': 'Malay', 'mr': 'Marathi', 'ug': 'Uighur', 'tw': 'Twi', 'my': 'Burmese', 'sq': 'Albanian', 'aa': 'Afar', 'el': 'Greek', 'eo': 'Esperanto', 'ab': 'Abkhazian', 'ae': 'Avestan', 'ss': 'Siswati', 'af': 'Afrikaans', 'tn': 'Setswana', 'oc': 'Occitan', 'is': 'Icelandic', 'am': 'Amharic', 'it': 'Italian', 'mh': 'Marshall', 'eu': 'Basque', 'as': 'Assamese', 'ar': 'Arabic', 'sg': 'Sangro', 'su': 'Sundanese', 'zu': 'Zulu', 'ay': 'Aymara', 'et': 'Estonian', 'az': 'Azerbaijani', 'ie': 'Interlingue', 'id': 'Indonesian', 'es': 'Spanish', 'ru': 'Russian', 'rw': 'Kinyarwanda', 'nl': 'Dutch', 'nn': 'Norwegian Nynorsk', 'na': 'Nauru', 'nb': 'Norwegian Bokmal', 'ne': 'Nepali', 'ng': 'Ndonga', 'ny': 'Chichewa; Nyanja', 'vo': 'Volapuk', 'rm': 'Rhaeto-Romance', 'nr': 'Ndebele, South', 'ro': 'Romanian', 'yi': 'Yiddish', 'nv': 'Navajo', 'sn': 'Shona', 'be': 'Belarusian', 'fr': 'French', 'bg': 'Bulgarian', 'sv': 'Swedish', 'ba': 'Bashkir', 'wa': 'Walloon', 'wo': 'Wolof', 'fy': 'Frisian', 'bn': 'Bengali', 'bo': 'Tibetan', 'bh': 'Bihari', 'bi': 'Bislama', 'fa': 'Persian', 'br': 'Breton', 'bs': 'Bosnian', 'fi': 'Finnish', 'fj': 'Fijian', 'hu': 'Hungarian', 'ja': 'Japanese', 'fo': 'Faroese', 'ka': 'Georgian', 'so': 'Somali', 'kk': 'Kazakh', 'kj': 'Kuanyama', 'ki': 'Kikuyu', 'ty': 'Tahitian', 'ko': 'Korean', 'kn': 'Kannada', 'km': 'Khmer', 'kl': 'Kalaallisut', 'ks': 'Kashmiri', 'si': 'Sinhalese', 'sh': 'Serbo-Croatian', 'kw': 'Cornish', 'kv': 'Komi', 'ku': 'Kurdish', 'sl': 'Slovenian', 'sc': 'Sardinian', 'ky': 'Kyrgyz', 'os': 'Ossetian; Ossetic', 'or': 'Oriya', 'se': 'Northern Sami', 'sd': 'Sindhi'}

ISO369 codes and names as used by Poedit. Mostly these are identical to ISO 639, but there are some differences.

translate.lang.poedit.lang_names = {'Estonian': 'et', 'Telugu': 'te', 'Kyrgyz': 'ky', 'Cornish': 'kw', 'Bulgarian': 'bg', 'Yoruba': 'yo', 'French': 'fr', 'Fijian': 'fj', 'Armenian': 'hy', 'Tsonga': 'ts', 'Tamil': 'ta', 'Kalaallisut': 'kl', 'Ossetian; Ossetic': 'os', 'Twi': 'tw', 'Nepali': 'ne', 'Finnish': 'fi', 'Sundanese': 'su', 'Albanian': 'sq', 'Walloon': 'wa', 'Tagalog': 'tl', 'Serbian': 'sr', 'Malayalam': 'ml', 'Church Slavic': 'cu', 'Italian': 'it', 'Navajo': 'nv', 'Chamorro': 'ch', 'Bislama': 'bi', 'Galician': 'gl', 'German': 'de', 'Slovak': 'sk', 'Yiddish': 'yi', 'Urdu': 'ur', 'Polish': 'pl', 'Occitan': 'oc', 'Xhosa': 'xh', 'Swedish': 'sv', 'Norwegian Bokmal': 'nb', 'Marathi': 'mr', 'Slovenian': 'sl', 'Uighur': 'ug', 'Azerbaijani': 'az', 'Faroese': 'fo', 'Nauru': 'na', 'Danish': 'da', 'Indonesian': 'id', 'Latin': 'la', 'Zulu': 'zu', 'Norwegian Nynorsk': 'nn', 'Georgian': 'ka', 'Zhuang': 'za', 'Tigrinya': 'ti', 'Sinhalese': 'si', 'Komi': 'kv', 'Tajik': 'tg', 'Thai': 'th', 'Afrikaans': 'af', 'Tibetan': 'bo', 'Turkmen': 'tk', 'Chichewa; Nyanja': 'ny', 'Tonga': 'to', 'Kikuyu': 'ki', 'Guarani': 'gn', '(Afan) Oromo': 'om', 'Uzbek': 'uz', 'Serbo-Croatian': 'sh', 'Herero': 'hz', 'Sangro': 'sg', 'Gaelic': 'gd', 'Burmese': 'my', 'Chuvash': 'cv', 'Latvian': 'lv', 'English': 'en', 'Croatian': 'hr', 'Chinese': 'zh', 'Greek': 'el', 'Inuktitut': 'iu', 'Tatar': 'tt', 'Pali': 'pi', 'Rhaeto-Romance': 'rm', 'Friulian': 'fur', 'Spanish': 'es', 'Arabic': 'ar', 'Breton': 'br', 'Swahili': 'sw', 'Icelandic': 'is', 'Turkish': 'tr', 'Samoan': 'sm', 'Inupiaq': 'ik', 'Gujarati': 'gu', 'Hindi': 'hi', 'Sindhi': 'sd', 'Korean': 'ko', 'Malagasy': 'mg', 'Khmer': 'km', 'Maori': 'mi', 'Hungarian': 'hu', 'Wolof': 'wo', 'Bosnian': 'bs', 'Lithuanian': 'lt', 'Malay': 'ms', 'Catalan': 'ca', 'Russian': 'ru', 'Pashto, Pushto': 'ps', 'Lingala': 'ln', 'Kazakh': 'kk', 'Bengali': 'bn', 'Kashmiri': 'ks', 'Siswati': 'ss', 'Hiri Motu': 'ho', 'Frisian': 'fy', 'Amharic': 'am', 'Panjabi': 'pa', 'Javanese': 'jw', 'Oriya': 'or', 'Afar': 'aa', 'Sesotho': 'st', 'Hausa': 'ha', 'Irish': 'ga', 'Moldavian': 'mo', 'Czech': 'cs', 'Marshall': 'mh', 'Belarusian': 'be', 'Kannada': 'kn', 'Macedonian': 'mk', 'Persian': 'fa', 'Mongolian': 'mn', 'Dzongkha': 'dz', 'Basque': 'eu', 'Aymara': 'ay', 'Northern Sami': 'se', 'Ndonga': 'ng', 'Setswana': 'tn', 'Vietnamese': 'vi', 'Romanian': 'ro', 'Shona': 'sn', 'Somali': 'so', 'Sardinian': 'sc', 'Corsican': 'co', 'Chechen': 'ce', 'Dutch': 'nl', 'Sanskrit': 'sa', 'Lao': 'lo', 'Bihari': 'bh', 'Ukrainian': 'uk', 'Welsh': 'cy', 'Tahitian': 'ty', 'Maltese': 'mt', 'Assamese': 'as', 'Ndebele, South': 'nr', 'Kurdish': 'ku', 'Bashkir': 'ba', 'Quechua': 'qu', 'Kuanyama': 'kj', 'Volapuk': 'vo', 'Letzeburgesch': 'lb', 'Rundi': 'rn', 'Portuguese': 'pt', 'Abkhazian': 'ab', 'Interlingua': 'ia', 'Japanese': 'ja', 'Kinyarwanda': 'rw', 'Interlingue': 'ie', 'Avestan': 'ae', 'Hebrew': 'he', 'Esperanto': 'eo'}

Reversed lang_codes

si

This module represents the Sinhala language.

class translate.lang.si.si

This class represents Sinhala.

classmethod alter_length(text)

Converts the given string by adding or removing characters as an estimation of translation length (with English assumed as source language).

classmethod capsstart(text)

Determines whether the text starts with a capital letter.

classmethod character_iter(text)

Returns an iterator over the characters in text.

classmethod characters(text)

Returns a list of characters in text.

classmethod length_difference(length)

Returns an estimate to a likely change in length relative to an English string of length length.

classmethod numstart(text)

Determines whether the text starts with a numeric value.

classmethod punctranslate(text)

Converts the punctuation in a string according to the rules of the language.

classmethod sentence_iter(text, strip=True)

Returns an iterator over the sentences in text.

classmethod sentences(text, strip=True)

Returns a list of sentences in text.

classmethod word_iter(text)

Returns an iterator over the words in text.

classmethod words(text)

Returns a list of words in text.

st

This module represents the Southern Sotho language.

class translate.lang.st.st

This class represents Southern Sotho.

classmethod alter_length(text)

Converts the given string by adding or removing characters as an estimation of translation length (with English assumed as source language).

classmethod capsstart(text)

Determines whether the text starts with a capital letter.

classmethod character_iter(text)

Returns an iterator over the characters in text.

classmethod characters(text)

Returns a list of characters in text.

classmethod length_difference(length)

Returns an estimate to a likely change in length relative to an English string of length length.

classmethod numstart(text)

Determines whether the text starts with a numeric value.

classmethod punctranslate(text)

Converts the punctuation in a string according to the rules of the language.

classmethod sentence_iter(text, strip=True)

Returns an iterator over the sentences in text.

classmethod sentences(text, strip=True)

Returns a list of sentences in text.

classmethod word_iter(text)

Returns an iterator over the words in text.

classmethod words(text)

Returns a list of words in text.

sv

This module represents the the Swedish language.

class translate.lang.sv.sv

This class represents Swedish.

classmethod alter_length(text)

Converts the given string by adding or removing characters as an estimation of translation length (with English assumed as source language).

classmethod capsstart(text)

Determines whether the text starts with a capital letter.

classmethod character_iter(text)

Returns an iterator over the characters in text.

classmethod characters(text)

Returns a list of characters in text.

classmethod length_difference(length)

Returns an estimate to a likely change in length relative to an English string of length length.

classmethod numstart(text)

Determines whether the text starts with a numeric value.

classmethod punctranslate(text)

Converts the punctuation in a string according to the rules of the language.

classmethod sentence_iter(text, strip=True)

Returns an iterator over the sentences in text.

classmethod sentences(text, strip=True)

Returns a list of sentences in text.

classmethod word_iter(text)

Returns an iterator over the words in text.

classmethod words(text)

Returns a list of words in text.

ta

This module represents the Tamil language.

class translate.lang.ta.ta

This class represents Tamil.

classmethod alter_length(text)

Converts the given string by adding or removing characters as an estimation of translation length (with English assumed as source language).

classmethod capsstart(text)

Determines whether the text starts with a capital letter.

classmethod character_iter(text)

Returns an iterator over the characters in text.

classmethod characters(text)

Returns a list of characters in text.

classmethod length_difference(length)

Returns an estimate to a likely change in length relative to an English string of length length.

classmethod numstart(text)

Determines whether the text starts with a numeric value.

classmethod punctranslate(text)

Converts the punctuation in a string according to the rules of the language.

classmethod sentence_iter(text, strip=True)

Returns an iterator over the sentences in text.

classmethod sentences(text, strip=True)

Returns a list of sentences in text.

classmethod word_iter(text)

Returns an iterator over the words in text.

classmethod words(text)

Returns a list of words in text.

team

Module to guess the language ISO code based on the ‘Language-Team’ entry in the header of a Gettext PO file.

translate.lang.team.LANG_TEAM_CONTACT_SNIPPETS = {'gu': ('indianoss-gujarati@lists.sourceforge.net',), 'ga': ('gaeilge-gnulinux@lists.sourceforge.net', 'gaeilge-a@listserv.heanet.ie'), 'gl': ('trasno@ceu.fi.udc.es', 'gnome@g11n.net', 'gpul-traduccion@ceu.fi.udc.es', 'proxecto@trasno.net', 'trasno@gpul.org'), 'la': ('gnome-latin-list@gnome.org',), 'tt': ('tatarish.l10n@gmail.com',), 'tr': ('debian-l10n-turkish@lists.debian.org', 'gnome-turk@gnome.org', 'gnu-tr-u12a@lists.sourceforge.net', 'turkce@pardus.org.tr'), 'li': ('li@gnome.org',), 'lv': ('lata-l10n@googlegroups.com', 'lata-i18n@groups.google.com', 'locale@laka.lv', 'll10nt@os.lv'), 'lt': ('gimp-lt@lists.akl.lt', 'gnome-lt@lists.akl.lt', 'gnome-lt@lists.gnome.org', 'komp_lt@konferencijos.lt'), 'tk': ('kakilikgroup@yahoo.com',), 'th': ('l10n@opentle.org', 'thai-l10n@googlegroup.com', 'thailang@buraphalinux.org', 'thai-l10n@googlegroups.com', 'l10n.opentle.org'), 'te': ('localisation@swecha.org', 'indlinux-telugu@lists.sourceforge.net'), 'ta': ('gnome-tamil-translation@googlegroups.com', 'tamilinix@yahoogroups.com', 'Ubuntu-l10n-tam@lists.ubuntu.com', 'tamil-DI@yahoogroups.com'), 'pt_BR': ('gnome-l10n-br@listas.cipsga.org.br', 'gnome-pt_br-list@gnome.org', 'fedora-docs-br@redhat.com', 'fedora-trans-pt-br@redhat.com', 'ldp-br@bazar.conectiva.com.br', 'pgbr-dev@postgresql.org.br', 'pgbr-dev@listas.postgresql.org.br', 'debian-l10n-portuguese@lists.debian.org'), 'de': ('gnome-de@gnome.org', 'debian-l10n-german@lists.debian.org'), 'da': ('dansk@dansk-gruppen.dk', 'dansk@klid.dk', 'sslug-locale@sslug.dk'), 'dz': ('pgeyleg@dit.gov.bt', 'pgyeleg@dit.gov.bt'), 'crh': ('tilde-birlik-tercime@lists.sourceforge.net',), 'el': ('debian-l10n-greek@lists.debian.org', 'i18ngr@lists.hellug.gr', 'i18n@hellug.gr', 'nls@tux.hellug.gr', 'team@gnome.gr', 'team@lists.gnome.gr', 'users@el.openoffice.org'), 'eo': ('eo-tradukado@lists.tuxfamily.org', 'debian-l10n-esperanto@lists.debian.org', 'ubuntu-l10n-eo@lists.launchpad.net', 'eo-tradukado.tuxfamily.org'), 'be': ('i18n@mova.org', 'i18n@tut.by', 'mozilla_byx@poczta.fm'), 'eu': ('debian-l10n-basque@lists.debian.org', 'debian-l10n-eu@lists.debian.org', 'itzulpena@euskalgnu.org', 'gnome@euskalgnu.org', 'librezale@librezale.org', 'linux-eu@chanae.alphanet.ch'), 'et': ('gnome-et@linux.ee', 'kde-et@linux.ee', 'linux-ee@lists.eenet.ee', 'linux-et@lists.eenet.ee', 'et-gnome@linux.ee', 'linux-ee@eenet.ee'), 'es': ('pgsql-es-ayuda@postgresql.org', 'debian-l10n-spanish@lists.debian.org', 'gnome-es@gnome.org', 'traductores@es.gnome.org'), 'ru': ('pgsql-rus@yahoogroups.com', 'debian-l10n-russian@lists.debian.org', 'gnupg-ru@gnupg.org'), 'ro': ('fedora-ro@googlegroups.com', 'gnomero-list@lists.sourceforge.net', 'debian-l10n-romanian@lists.debian.org'), 'en_CA': ('adamw@gnome.org', 'adamw@freebsd.org'), 'bg': ('dict@fsa-bg.org', 'dict@linux.zonebg.com'), 'uk': ('linux@linux.org.ua',), 'wa': ('linux-wa@',), 'ast': ('@softastur.org', 'launchpad.net/~ubuntu-l10n-ast', 'softast-xeneral@lists.sourceforge.net', 'Softastur'), 'bn': ('gnome-translation@bengalinux.org', 'core@bengalinux.org', 'ankur-bd-l10n@googlegroups.com', 'redhat-translation@bengalinux.org'), 'br': ('drouizig@drouizig.org', 'brenux@free.fr', 'tradgnome@softcatala.net', 'fedora@softcatala.org'), 'bs': ('lokal@linux.org.ba', 'lokal@lugbih.org'), 'ja': ('debian-doc@debian.or.jp', 'debian-japanese@lists.debian.org', 'gnome-translation@gnome.gr.jp', 'translation@gnome.gr.jp', 'jpug-doc@ml.postgresql.jp'), 'nds': ('nds-lowgerman@lists.sourceforge.net',), 'or': ('oriya-group@lists.sarovar.org', 'oriya-it@googlegroups.com'), 'xh': ('xh-translate@ubuntu.com', 'xhosa@translate.org.za', 'xhosa@ubuntu.com'), 'nso': ('sepedi@translate.org.za',), 'az_IR': ('az-ir@lists.sharif.edu',), 'ca': ('@softcatala.org',), 'cy': ('gnome-cy@lists.linux.org.uk', 'gnome-cy@pengwyn.linux.org.uk', 'gnome-cy@www.linux.org', 'gnome-cy@www.linux.org.uk', 'cy@pengwyn.linux.org.uk'), 'cs': ('fedora-cs-list@redhat.com', 'cs-users@lists.fedoraproject.org', 'debian-l10n-czech@lists.debian.org', 'kde-czech-apps@lists.sourceforge.net', 'kde-czech-apps@lists.sf.net', 'translations.cs@gnupg.cz'), 'ps': ('pathanisation@googelgroups.com',), 'pt': ('fedora-trans-pt@redhat.org', 'gnome_pt@yahoogroups.com', 'traduz@debianpt.org', 'traduz@debian.pt'), 'en@shaw': ('ubuntu-l10n-en-shaw@launchpad.net', 'ubuntu-l10n-en-shaw@lists.launchpad.net'), 'tl': ('debian-tl@banwa.upm.edu.ph',), 'pa': ('punjabi-l10n@users.sf.net', 'fedora-pa-list@redhat.com', 'punjabi-users@lists.sf.net', 'punjabi-l10n@lists.sourceforge.net', 'punlinux-i18n@lists.sourceforge.net'), 'en_GB': ('kde-en-gb@kde.me.uk',), 'hr': ('translator-shop.org', 'lokalizacija@linux.hr'), 'zh_TW': ('zh-l10n@lists.linux.org.tw', 'chinese-l10n@googlegroups.com', 'community@linuxhall.org', 'zh-l10n@linux.org.tw'), 'hu': ('debian-l10n-hungarian@lists.debian.org', 'gnome@fsf.hu', 'gnome@gnome.hu', 'magyar@lists.linux.hu'), 'hi': ('indlinux-hindi-gnome@lists.sourceforge.net', 'indlinux-hindi@lists.sourceforge.net'), 'he': ('debian-hebrew-common@lists.alioth.debian.org', 'kde-il@yahoogroups.com', 'fedora-he-list@redhat.com', 'mdk-hebrew@iglu.org.il'), 'mg': ('i18n-malagasy-gnome@gnome.org',), 'be@latin': ('translation-team-be-latin@lists', 'be-latin.open-tran.eu'), 'zh_CN': ('i18n-translation@lists.linux.net.cn', 'i18n-zh@googlegroups.com', 'translation-team-zh-cn@lists.sourceforge.net', 'i18n-zh@googlegroup.com'), 'ml': ('smc-discuss@googlegroups.com',), 'mn': ('openmn-', 'openmn.org'), 'mi': ('maori@nzlinux.org.nz',), 'mk': ('gnomk-main@lists.sourceforge.net', 'lug@lists.linux.net.mk', 'mkde-l10n@lists.sourceforge.net', 'ossm-members@hedona.on.net.mk'), 'ur': ('l10n@urduweb.org', 'urdu.scs.gift@gmail.com'), 'pl': ('gnomepl@aviary.pl', 'debian-l10n-polish@lists.debian.org', 'gnome-l10n@lists.aviary.pl', 'translators@gnomepl.org'), 'ms': ('gabai-penyumbang@lists.sourceforge.net', 'gabai-penyumbang@lists.sf.net', 'kedidiemas@yahoogroups.com'), 'ug': ('gnome-uighur@yahoogroups.com',), 've': ('venda@translate.org.za',), 'af': ('i18n@af.org.za', 'Petri Jooste'), 'vi': ('gnomevi-list@lists.sourceforge.net', 'vi-VN@googlegroups.com'), 'is': ('gnome@techattack.nu', 'kde-isl@mmedia.is', 'kde-isl@molar.is'), 'am': ('@geez.org',), 'it': ('debian-l10n-italian@lists.debian.org', 'traduzioni@itpug.org', 'fedora-trans-it@redhat.com', 'tp@lists.linux.it'), 'sv': ('debian-l10n-swedish@lists.debian.org', 'tp-sv@listor.tp-sv.se'), 'as': ('assam@mm.assam-glug.org',), 'ar': ('arabeyes.org', 'Arabeyes'), 'io': ('gnome-ido@lists.mterry.name',), 'zu': ('zulu@translate.org.za',), 'az': ('linuxaz@azerimal.net', 'gnome@azitt.com', u'gnome@az\u0259tt.com'), 'id': ('@id.gnome.org', '@gnome.linux.or.id', 'mdk-id@yahoogroups.com', 'linux.or.id', 'gnome@i15n.org'), 'bn_IN': ('anubad@lists.ankur.org.in',), 'ks': ('ks-gnome-trans-commits@lists.code.indlinux.net',), 'nl': ('debian-l10n-dutch@lists.debian.org', 'vertaling@nl.gnome.org', 'vertaling@vrijschrift.org', 'nl@vrijschrift.org', 'vertaling@nl.linux.org', 'vertaling@nl.li.org'), 'nn': ('i18n-nn@lister.ping.uio.no',), 'nb': ('i18n-nb@lister.ping.uio.no',), 'ne': ('info@mpp.org.np',), 'en_AU': ('trans@six-by-nine.com.au',), 'fr': ('debian-l10n-french@lists.debian.org', 'gnomefr@traduc.org', 'kde-francophone@kde.org', 'traduc@traduc.org', 'pgsql-fr-generale@postgresql.org', 'rpm-fr@livna.org'), 'fa': ('farsi@lists.sharif.edu', 'Farsiweb.info'), 'mai': ('maithili.sf.net',), 'fi': ('debian-l10n-finnish@lists.debian.org', 'gnome-fi-laatu@lists.sourceforge.net', 'laatu@lokalisointi.org', 'lokalisointi-laatu@linux-aktivaattori.org', 'laatu@gnome.fi', 'yast-trans-fi@kotoistaminen.novell.fi'), 'ka': ('geognome@googlegroups.com', 'Ubuntu-Georgian-Translators@googlegroups.com'), 'kk': ('kk_KZ@googlegroups.com',), 'sr': ('@prevod.org', 'serbiangnome-lista@nongnu.org'), 'sq': ('gnome-albanian-perkthyesit@lists.sourceforge.net', 'debian-l10n-albanian@lists.debian.org'), 'ko': ('gnome-kr-hackers@list.kldp.net', 'gnome-kr-hackers@lists.kldp.net', 'gnome-kr-translation@lists.kldp.net', 'pgsql-kr@postgresql.or.kr', 'hangul-hackers@lists.kldp.net', 'debian-l10n-korean@lists.debian.org', 'gnome-kr-translation@lists.sourceforge.net'), 'kn': ('debian-l10n-kannada@lists.debian.org',), 'km': ('@khmeros.info',), 'sk': ('sk-i18n@lists.linux.sk', 'kde-sk@linux.sk'), 'ku': ('gnu-ku-wergerandin@lists.sourceforge.net',), 'sl': ('gnome-si@googlegroups.com',), 'ky': ('i18n-team-ky-kyrgyz@lists.sourceforge.net', 'ky-li@mail.ru')}

Language codes with snippets of contact information that can be used to uniquely identify the language

translate.lang.team.guess_language(team_string)

Gueses the language of a PO file based on the Language-Team entry

te

This module represents the Telugu language.

class translate.lang.te.te

This class represents Telugu.

classmethod alter_length(text)

Converts the given string by adding or removing characters as an estimation of translation length (with English assumed as source language).

classmethod capsstart(text)

Determines whether the text starts with a capital letter.

classmethod character_iter(text)

Returns an iterator over the characters in text.

classmethod characters(text)

Returns a list of characters in text.

classmethod length_difference(length)

Returns an estimate to a likely change in length relative to an English string of length length.

classmethod numstart(text)

Determines whether the text starts with a numeric value.

classmethod punctranslate(text)

Converts the punctuation in a string according to the rules of the language.

classmethod sentence_iter(text, strip=True)

Returns an iterator over the sentences in text.

classmethod sentences(text, strip=True)

Returns a list of sentences in text.

classmethod word_iter(text)

Returns an iterator over the words in text.

classmethod words(text)

Returns a list of words in text.

th

This module represents the Thai language.

class translate.lang.th.th

This class represents Thai.

classmethod alter_length(text)

Converts the given string by adding or removing characters as an estimation of translation length (with English assumed as source language).

classmethod capsstart(text)

Determines whether the text starts with a capital letter.

classmethod character_iter(text)

Returns an iterator over the characters in text.

classmethod characters(text)

Returns a list of characters in text.

classmethod length_difference(length)

Returns an estimate to a likely change in length relative to an English string of length length.

classmethod numstart(text)

Determines whether the text starts with a numeric value.

classmethod punctranslate(text)

Converts the punctuation in a string according to the rules of the language.

classmethod sentence_iter(text, strip=True)

Returns an iterator over the sentences in text.

classmethod sentences(text, strip=True)

Returns a list of sentences in text.

classmethod word_iter(text)

Returns an iterator over the words in text.

classmethod words(text)

Returns a list of words in text.

ug

This module represents the Uyghur language.

class translate.lang.ug.ug

This class represents Uyghur.

classmethod alter_length(text)

Converts the given string by adding or removing characters as an estimation of translation length (with English assumed as source language).

classmethod capsstart(text)

Determines whether the text starts with a capital letter.

classmethod character_iter(text)

Returns an iterator over the characters in text.

classmethod characters(text)

Returns a list of characters in text.

classmethod length_difference(length)

Returns an estimate to a likely change in length relative to an English string of length length.

classmethod numstart(text)

Determines whether the text starts with a numeric value.

classmethod punctranslate(text)

Converts the punctuation in a string according to the rules of the language.

classmethod sentence_iter(text, strip=True)

Returns an iterator over the sentences in text.

classmethod sentences(text, strip=True)

Returns a list of sentences in text.

classmethod word_iter(text)

Returns an iterator over the words in text.

classmethod words(text)

Returns a list of words in text.

ur

This module represents the Urdu language.

class translate.lang.ur.ur

This class represents Urdu.

classmethod alter_length(text)

Converts the given string by adding or removing characters as an estimation of translation length (with English assumed as source language).

classmethod capsstart(text)

Determines whether the text starts with a capital letter.

classmethod character_iter(text)

Returns an iterator over the characters in text.

classmethod characters(text)

Returns a list of characters in text.

classmethod length_difference(length)

Returns an estimate to a likely change in length relative to an English string of length length.

classmethod numstart(text)

Determines whether the text starts with a numeric value.

classmethod punctranslate(text)

Converts the punctuation in a string according to the rules of the language.

classmethod sentence_iter(text, strip=True)

Returns an iterator over the sentences in text.

classmethod sentences(text, strip=True)

Returns a list of sentences in text.

classmethod word_iter(text)

Returns an iterator over the words in text.

classmethod words(text)

Returns a list of words in text.

vi

This module represents the Vietnamese language.

class translate.lang.vi.vi

This class represents Vietnamese.

classmethod alter_length(text)

Converts the given string by adding or removing characters as an estimation of translation length (with English assumed as source language).

classmethod capsstart(text)

Determines whether the text starts with a capital letter.

classmethod character_iter(text)

Returns an iterator over the characters in text.

classmethod characters(text)

Returns a list of characters in text.

classmethod length_difference(length)

Returns an estimate to a likely change in length relative to an English string of length length.

classmethod numstart(text)

Determines whether the text starts with a numeric value.

classmethod punctranslate(text)

Implement some extra features for quotation marks.

Known shortcomings:
  • % and $ are not touched yet for fear of variables
  • Double spaces might be introduced
classmethod sentence_iter(text, strip=True)

Returns an iterator over the sentences in text.

classmethod sentences(text, strip=True)

Returns a list of sentences in text.

classmethod word_iter(text)

Returns an iterator over the words in text.

classmethod words(text)

Returns a list of words in text.

zh

This module represents the Chinese language (Both tradisional and simplified).

class translate.lang.zh.zh

This class represents Chinese.

classmethod alter_length(text)

Converts the given string by adding or removing characters as an estimation of translation length (with English assumed as source language).

classmethod capsstart(text)

Determines whether the text starts with a capital letter.

classmethod character_iter(text)

Returns an iterator over the characters in text.

classmethod characters(text)

Returns a list of characters in text.

classmethod numstart(text)

Determines whether the text starts with a numeric value.

classmethod punctranslate(text)

Converts the punctuation in a string according to the rules of the language.

classmethod sentence_iter(text, strip=True)

Returns an iterator over the sentences in text.

classmethod sentences(text, strip=True)

Returns a list of sentences in text.

classmethod word_iter(text)

Returns an iterator over the words in text.

classmethod words(text)

Returns a list of words in text.