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.

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).

character_iter(text)

Returns an iterator over the characters in text.

characters(text)

Returns a list of characters in text.

length_difference(length)

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

numbertranslate(text)

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

numstart(text)

Determines whether the text starts with a numeric value.

punctranslate(text)

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

sentence_iter(text, strip=True)

Returns an iterator over the sentences in text.

sentences(text, strip=True)

Returns a list of sentences in text.

word_iter(text)

Returns an iterator over the words in text.

words(text)

Returns a list of words in text.

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

alter_length(text)

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

capsstart(text)

Determines whether the text starts with a capital letter.

character_iter(text)

Returns an iterator over the characters in text.

characters(text)

Returns a list of characters in text.

length_difference(length)

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

numbertranslate(text)

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

numstart(text)

Determines whether the text starts with a numeric value.

punctranslate(text)

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

sentence_iter(text, strip=True)

Returns an iterator over the sentences in text.

sentences(text, strip=True)

Returns a list of sentences in text.

word_iter(text)

Returns an iterator over the words in text.

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.

alter_length(text)

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

capsstart(text)

Determines whether the text starts with a capital letter.

character_iter(text)

Returns an iterator over the characters in text.

characters(text)

Returns a list of characters in text.

length_difference(length)

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

numbertranslate(text)

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

numstart(text)

Determines whether the text starts with a numeric value.

sentence_iter(text, strip=True)

Returns an iterator over the sentences in text.

sentences(text, strip=True)

Returns a list of sentences in text.

word_iter(text)

Returns an iterator over the words in text.

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.

alter_length(text)

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

capsstart(text)

Determines whether the text starts with a capital letter.

character_iter(text)

Returns an iterator over the characters in text.

characters(text)

Returns a list of characters in text.

length_difference(length)

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

numbertranslate(text)

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

numstart(text)

Determines whether the text starts with a numeric value.

punctranslate(text)

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

sentence_iter(text, strip=True)

Returns an iterator over the sentences in text.

sentences(text, strip=True)

Returns a list of sentences in text.

word_iter(text)

Returns an iterator over the words in text.

words(text)

Returns a list of words in text.

code_or

This module represents the Odia language.

class translate.lang.code_or.code_or

This class represents Odia.

alter_length(text)

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

capsstart(text)

Determines whether the text starts with a capital letter.

character_iter(text)

Returns an iterator over the characters in text.

characters(text)

Returns a list of characters in text.

length_difference(length)

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

numbertranslate(text)

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

numstart(text)

Determines whether the text starts with a numeric value.

punctranslate(text)

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

sentence_iter(text, strip=True)

Returns an iterator over the sentences in text.

sentences(text, strip=True)

Returns a list of sentences in text.

word_iter(text)

Returns an iterator over the words in text.

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 instance (see filters.checks).

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

code = u''

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 = u''

The full (English) name of this language.

Dialect codes should have the form of:

ignoretests = {}

Dictionary of tests to ignore in some or all checkers.

Keys are checker names and values are list of names for the ignored tests in the checker. A special ‘all’ checker name can be used to tell that the tests must be ignored in all the checkers.

Listed checkers to ignore tests on must be lowercase strings for the checker name, for example “mozilla” for MozillaChecker or “libreoffice” for LibreOfficeChecker.

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 = u'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 numbertranslate(text)

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

numbertuple = ()

A tuple of number transformation rules that can be used by numbertranslate().

classmethod numstart(text)

Determines whether the text starts with a numeric value.

pluralequation = u'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.cldr_plural_categories = [u'zero', u'one', u'two', u'few', u'many', u'other']

List of plural tags generated from CLDR 32.0.1 using https://github.com/WeblateOrg/language-data

translate.lang.data.expansion_factors = {u'fr': 0.28, u'ar': -0.09, u'it': 0.2, u'es': 0.21, u'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.get_country_iso_name(country_code)

Return country ISO name.

translate.lang.data.get_language_iso_fullname(language_code)

Return language ISO fullname.

If language code is not a simple ISO 639 code, then we try to split into a two part language code (ISO 639 and ISO 3166).

translate.lang.data.get_language_iso_name(language_code)

Return language ISO name.

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_domain(langcode, domain, localedir=None)

Returns a gettext function for given iso domain

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.languagematch(languagecode, otherlanguagecode)

matches a languagecode to another, ignoring regions in the second

translate.lang.data.languages = {u'son': (u'Songhai languages', 1, u'0'), u'gu': (u'Gujarati', 2, u'(n != 1)'), u'sat': (u'Santali', 2, u'(n != 1)'), u'ff': (u'Fulah', 2, u'(n != 1)'), u'nqo': (u"N'Ko", 2, u'(n > 1)'), u'brx': (u'Bodo', 2, u'(n != 1)'), u'ca': (u'Catalan; Valencian', 2, u'(n != 1)'), u'sco': (u'Scots', 2, u'(n != 1)'), u'gun': (u'Gun', 2, u'(n > 1)'), u'mni': (u'Meithei (Manipuri)', 2, u'(n != 1)'), u'ca@valencia': (u'Catalan; Valencian (Valencia)', 2, u'(n != 1)'), u'gd': (u'Gaelic; Scottish Gaelic', 4, u'(n==1 || n==11) ? 0 : (n==2 || n==12) ? 1 : (n > 2 && n < 20) ? 2 : 3'), u'ga': (u'Irish', 5, u'n==1 ? 0 : n==2 ? 1 : (n>2 && n<7) ? 2 :(n>6 && n<11) ? 3 : 4'), u'cs': (u'Czech', 3, u'(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2'), u'gl': (u'Galician', 2, u'(n != 1)'), u'pms': (u'Piemontese', 2, u'(n != 1)'), u'mfe': (u'Morisyen', 2, u'(n > 1)'), u'ps': (u'Pushto; Pashto', 2, u'(n != 1)'), u'kok': (u'Konkani', 2, u'(n != 1)'), u'or': (u'Odia', 2, u'(n != 1)'), u'lb': (u'Luxembourgish; Letzeburgesch', 2, u'(n != 1)'), u'szl': (u'Silesian', 3, u'(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)'), u'pt': (u'Portuguese', 2, u'(n != 1)'), u'ln': (u'Lingala', 2, u'(n > 1)'), u'lo': (u'Lao', 1, u'0'), u'tt': (u'Tatar', 1, u'0'), u'nso': (u'Pedi; Sepedi; Northern Sotho', 2, u'(n != 1)'), u'tr': (u'Turkish', 2, u'(n != 1)'), u'uk': (u'Ukrainian', 3, u'(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)'), u'lv': (u'Latvian', 3, u'(n%10==1 && n%100!=11 ? 0 : n != 0 ? 1 : 2)'), u'lt': (u'Lithuanian', 3, u'(n%10==1 && n%100!=11 ? 0 : n%10>=2 && (n%100<10 || n%100>=20) ? 1 : 2)'), u'pa': (u'Panjabi; Punjabi', 2, u'(n != 1)'), u'sw': (u'Swahili', 2, u'(n != 1)'), u'tg': (u'Tajik', 1, u'0'), u'th': (u'Thai', 1, u'0'), u'es_AR': (u'Argentinean Spanish', 2, u'(n != 1)'), u'su': (u'Sundanese', 1, u'0'), u'te': (u'Telugu', 2, u'(n != 1)'), u'ia': (u'Interlingua (International Auxiliary Language Association)', 2, u'(n != 1)'), u'is': (u'Icelandic', 2, u'(n != 1)'), u'en_GB': (u'English (United Kingdom)', 2, u'(n != 1)'), u'ta': (u'Tamil', 2, u'(n != 1)'), u'kab': (u'Kabyle', 2, u'(n != 1)'), u'hy': (u'Armenian', 1, u'0'), u'pt_BR': (u'Portuguese (Brazil)', 2, u'(n > 1)'), u'hr': (u'Croatian', 3, u'(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)'), u'de': (u'German', 2, u'(n != 1)'), u'ht': (u'Haitian; Haitian Creole', 2, u'(n != 1)'), u'da': (u'Danish', 2, u'(n != 1)'), u'hi': (u'Hindi', 2, u'(n != 1)'), u'dz': (u'Dzongkha', 1, u'0'), u'st': (u'Sotho, Southern', 2, u'(n != 1)'), u'ha': (u'Hausa', 2, u'(n != 1)'), u'he': (u'Hebrew', 2, u'(n != 1)'), u'me': (u'Montenegrin', 3, u'n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2'), u'so': (u'Somali', 2, u'(n != 1)'), u'mg': (u'Malagasy', 2, u'(n > 1)'), u'fur': (u'Friulian', 2, u'(n != 1)'), u'uz': (u'Uzbek', 2, u'(n > 1)'), u'sa': (u'Sanskrit', 3, u'(n==1 ? 0 : n==2 ? 1 : 2)'), u'ml': (u'Malayalam', 2, u'(n != 1)'), u'mn': (u'Mongolian', 2, u'(n != 1)'), u'mi': (u'Maori', 2, u'(n > 1)'), u'cy': (u'Welsh', 2, u'(n==2) ? 1 : 0'), u'en_ZA': (u'English (South Africa)', 2, u'(n != 1)'), u'ur': (u'Urdu', 2, u'(n != 1)'), u'zh_HK': (u'Chinese (Hong Kong)', 1, u'0'), u'mt': (u'Maltese', 4, u'(n==1 ? 0 : n==0 || ( n%100>1 && n%100<11) ? 1 : (n%100>10 && n%100<20 ) ? 2 : 3)'), u'mnk': (u'Mandinka', 3, u'(n==0 ? 0 : n==1 ? 1 : 2)'), u'fil': (u'Filipino; Pilipino', 2, u'(n > 1)'), u'ms': (u'Malay', 1, u'0'), u'mr': (u'Marathi', 2, u'(n != 1)'), u'ug': (u'Uighur; Uyghur', 1, u'0'), u'my': (u'Burmese', 1, u'0'), u'el': (u'Greek, Modern (1453-)', 2, u'(n != 1)'), u'eo': (u'Esperanto', 2, u'(n != 1)'), u'en': (u'English', 2, u'(n != 1)'), u'tk': (u'Turkmen', 2, u'(n != 1)'), u'af': (u'Afrikaans', 2, u'(n != 1)'), u've': (u'Venda', 2, u'(n != 1)'), u'oc': (u'Occitan (post 1500)', 2, u'(n > 1)'), u'ak': (u'Akan', 2, u'n > 1'), u'am': (u'Amharic', 2, u'n > 1'), u'it': (u'Italian', 2, u'(n != 1)'), u'an': (u'Aragonese', 2, u'(n != 1)'), u'eu': (u'Basque', 2, u'(n != 1)'), u'as': (u'Assamese', 2, u'(n != 1)'), u'ar': (u'Arabic', 6, u'n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 && n%100<=10 ? 3 : n%100>=11 ? 4 : 5'), u'anp': (u'Angika', 2, u'(n != 1)'), u'mk': (u'Macedonian', 2, u'(n==1 || n%10==1 ? 0 : 1)'), u'zu': (u'Zulu', 2, u'(n != 1)'), u'ay': (u'Aymar\xe1', 1, u'0'), u'et': (u'Estonian', 2, u'(n != 1)'), u'az': (u'Azerbaijani', 2, u'(n != 1)'), u'id': (u'Indonesian', 1, u'0'), u'arn': (u'Mapudungun; Mapuche', 2, u'n > 1'), u'bn_IN': (u'Bengali (India)', 2, u'(n != 1)'), u'pap': (u'Papiamento', 2, u'(n != 1)'), u'ru': (u'Russian', 3, u'(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)'), u'rw': (u'Kinyarwanda', 2, u'(n != 1)'), u'nl': (u'Dutch; Flemish', 2, u'(n != 1)'), u'yo': (u'Yoruba', 2, u'(n != 1)'), u'nn': (u'Norwegian Nynorsk; Nynorsk, Norwegian', 2, u'(n != 1)'), u'nah': (u'Nahuatl languages', 2, u'(n != 1)'), u'ne': (u'Nepali', 2, u'(n != 1)'), u'zh_CN': (u'Chinese (China)', 1, u'0'), u'csb': (u'Kashubian', 3, u'n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2'), u'wo': (u'Wolof', 2, u'(n != 1)'), u'nap': (u'Neapolitan', 2, u'(n != 1)'), u'es': (u'Spanish; Castilian', 2, u'(n != 1)'), u'sk': (u'Slovak', 3, u'(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2'), u'rm': (u'Romansh', 2, u'(n != 1)'), u'zh_TW': (u'Chinese (Taiwan)', 1, u'0'), u'ro': (u'Romanian', 3, u'(n==1 ? 0 : (n==0 || (n%100 > 0 && n%100 < 20)) ? 1 : 2);'), u'sah': (u'Yakut', 1, u'0'), u'jv': (u'Javanese', 2, u'(n != 1)'), u'be': (u'Belarusian', 3, u'n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2'), u'fr': (u'French', 2, u'(n > 1)'), u'bg': (u'Bulgarian', 2, u'(n != 1)'), u'bn_BD': (u'Bengali (Bangladesh)', 2, u'(n != 1)'), u'sv': (u'Swedish', 2, u'(n != 1)'), u'wa': (u'Walloon', 2, u'(n > 1)'), u'ast': (u'Asturian; Bable; Leonese; Asturleonese', 2, u'(n != 1)'), u'vi': (u'Vietnamese', 1, u'0'), u'fy': (u'Frisian', 2, u'(n != 1)'), u'bn': (u'Bengali', 2, u'(n != 1)'), u'bo': (u'Tibetan', 1, u'0'), u'cgg': (u'Chiga', 1, u'0'), u'fa': (u'Persian', 2, u'n > 1'), u'br': (u'Breton', 2, u'n > 1'), u'bs': (u'Bosnian', 3, u'n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2'), u'mai': (u'Maithili', 2, u'(n != 1)'), u'fi': (u'Finnish', 2, u'(n != 1)'), u'hu': (u'Hungarian', 2, u'(n != 1)'), u'ja': (u'Japanese', 1, u'0'), u'fo': (u'Faroese', 2, u'(n != 1)'), u'ka': (u'Georgian', 1, u'0'), u'doi': (u'Dogri', 2, u'(n != 1)'), u'hne': (u'Chhattisgarhi', 2, u'(n != 1)'), u'kk': (u'Kazakh', 2, u'n != 1'), u'sr': (u'Serbian', 3, u'(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)'), u'sq': (u'Albanian', 2, u'(n != 1)'), u'ach': (u'Acholi', 2, u'n > 1'), u'ko': (u'Korean', 1, u'0'), u'kn': (u'Kannada', 2, u'(n != 1)'), u'km': (u'Central Khmer', 1, u'0'), u'kl': (u'Greenlandic', 2, u'(n != 1)'), u'ks': (u'Kashmiri', 2, u'(n != 1)'), u'si': (u'Sinhala; Sinhalese', 2, u'(n != 1)'), u'pl': (u'Polish', 3, u'(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)'), u'kw': (u'Cornish', 4, u'(n==1) ? 0 : (n==2) ? 1 : (n == 3) ? 2 : 3'), u'ku': (u'Kurdish', 2, u'(n != 1)'), u'sl': (u'Slovenian', 4, u'(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3)'), u'jbo': (u'Lojban', 1, u'0'), u'ti': (u'Tigrinya', 2, u'(n > 1)'), u'ky': (u'Kirghiz; Kyrgyz', 2, u'n != 1'), u'yue': (u'Yue', 1, u'0'), u'nb': (u'Bokm\xe5l, Norwegian; Norwegian Bokm\xe5l', 2, u'(n != 1)'), u'se': (u'Northern Sami', 2, u'(n != 1)'), u'sd': (u'Sindhi', 2, u'(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=u'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.scripts = {u'Deva': [u'anp', u'bho', u'brx', u'doi', u'hi', u'kfy', u'kok', u'mai', u'mr', u'sa', u'sat'], u'Taml': [u'ta'], u'Orya': [u'or'], u'Laoo': [u'lo'], u'Mymr': [u'my', u'shn'], u'Khmr': [u'km'], u'assamese': [u'as'], u'perso-arabic': [u'ks'], u'Mlym': [u'ml'], u'chinese': [u'yue'], u'Tibt': [u'bo'], u'Gujr': [u'gu'], u'Beng': [u'bn', u'mni'], u'Sind': [u'sd'], u'Knda': [u'kn']}

Dictionary of scripts data. The dictionary keys are ISO 15924 script codes, and script names where scripts are missing from standard. The value is a list of codes for languages using that script.

This is mainly used to alter the behavior of some checks (the accelerators one for example).

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

alter_length(text)

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

capsstart(text)

Determines whether the text starts with a capital letter.

character_iter(text)

Returns an iterator over the characters in text.

characters(text)

Returns a list of characters in text.

length_difference(length)

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

numbertranslate(text)

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

numstart(text)

Determines whether the text starts with a numeric value.

punctranslate(text)

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

sentence_iter(text, strip=True)

Returns an iterator over the sentences in text.

sentences(text, strip=True)

Returns a list of sentences in text.

word_iter(text)

Returns an iterator over the words in text.

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.

alter_length(text)

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

capsstart(text)

Determines whether the text starts with a capital letter.

character_iter(text)

Returns an iterator over the characters in text.

characters(text)

Returns a list of characters in text.

length_difference(length)

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

numbertranslate(text)

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

numstart(text)

Determines whether the text starts with a numeric value.

punctranslate(text)

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

sentence_iter(text, strip=True)

Returns an iterator over the sentences in text.

sentences(text, strip=True)

Returns a list of sentences in text.

word_iter(text)

Returns an iterator over the words in text.

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.

alter_length(text)

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

capsstart(text)

Determines whether the text starts with a capital letter.

character_iter(text)

Returns an iterator over the characters in text.

characters(text)

Returns a list of characters in text.

length_difference(length)

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

numbertranslate(text)

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

numstart(text)

Determines whether the text starts with a numeric value.

classmethod punctranslate(text)

Implement some extra features for inverted punctuation.

sentence_iter(text, strip=True)

Returns an iterator over the sentences in text.

sentences(text, strip=True)

Returns a list of sentences in text.

word_iter(text)

Returns an iterator over the words in text.

words(text)

Returns a list of words in text.

factory

This module provides a factory to instantiate language classes.

translate.lang.factory.get_all_languages()

Return all 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.

alter_length(text)

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

capsstart(text)

Determines whether the text starts with a capital letter.

character_iter(text)

Returns an iterator over the characters in text.

characters(text)

Returns a list of characters in text.

length_difference(length)

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

numbertranslate(text)

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

numstart(text)

Determines whether the text starts with a numeric value.

classmethod punctranslate(text)

Implement “French” quotation marks.

sentence_iter(text, strip=True)

Returns an iterator over the sentences in text.

sentences(text, strip=True)

Returns a list of sentences in text.

word_iter(text)

Returns an iterator over the words in text.

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.

alter_length(text)

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

capsstart(text)

Determines whether the text starts with a capital letter.

character_iter(text)

Returns an iterator over the characters in text.

characters(text)

Returns a list of characters in text.

length_difference(length)

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

numbertranslate(text)

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

numstart(text)

Determines whether the text starts with a numeric value.

punctranslate(text)

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

sentence_iter(text, strip=True)

Returns an iterator over the sentences in text.

sentences(text, strip=True)

Returns a list of sentences in text.

word_iter(text)

Returns an iterator over the words in text.

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.

alter_length(text)

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

capsstart(text)

Determines whether the text starts with a capital letter.

character_iter(text)

Returns an iterator over the characters in text.

characters(text)

Returns a list of characters in text.

length_difference(length)

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

numbertranslate(text)

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

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
sentence_iter(text, strip=True)

Returns an iterator over the sentences in text.

sentences(text, strip=True)

Returns a list of sentences in text.

word_iter(text)

Returns an iterator over the words in text.

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.

alter_length(text)

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

capsstart(text)

Determines whether the text starts with a capital letter.

character_iter(text)

Returns an iterator over the characters in text.

characters(text)

Returns a list of characters in text.

length_difference(length)

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

numbertranslate(text)

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

numstart(text)

Determines whether the text starts with a numeric value.

punctranslate(text)

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

sentence_iter(text, strip=True)

Returns an iterator over the sentences in text.

sentences(text, strip=True)

Returns a list of sentences in text.

word_iter(text)

Returns an iterator over the words in text.

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.

alter_length(text)

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

capsstart(text)

Determines whether the text starts with a capital letter.

character_iter(text)

Returns an iterator over the characters in text.

characters(text)

Returns a list of characters in text.

length_difference(length)

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

numbertranslate(text)

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

numstart(text)

Determines whether the text starts with a numeric value.

punctranslate(text)

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

sentence_iter(text, strip=True)

Returns an iterator over the sentences in text.

sentences(text, strip=True)

Returns a list of sentences in text.

word_iter(text)

Returns an iterator over the words in text.

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.

alter_length(text)

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

capsstart(text)

Determines whether the text starts with a capital letter.

character_iter(text)

Returns an iterator over the characters in text.

characters(text)

Returns a list of characters in text.

length_difference(length)

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

numbertranslate(text)

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

numstart(text)

Determines whether the text starts with a numeric value.

punctranslate(text)

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

sentence_iter(text, strip=True)

Returns an iterator over the sentences in text.

sentences(text, strip=True)

Returns a list of sentences in text.

word_iter(text)

Returns an iterator over the words in text.

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.

alter_length(text)

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

capsstart(text)

Determines whether the text starts with a capital letter.

character_iter(text)

Returns an iterator over the characters in text.

characters(text)

Returns a list of characters in text.

length_difference(length)

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

numbertranslate(text)

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

numstart(text)

Determines whether the text starts with a numeric value.

punctranslate(text)

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

sentence_iter(text, strip=True)

Returns an iterator over the sentences in text.

sentences(text, strip=True)

Returns a list of sentences in text.

word_iter(text)

Returns an iterator over the words in text.

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.

alter_length(text)

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

capsstart(text)

Determines whether the text starts with a capital letter.

character_iter(text)

Returns an iterator over the characters in text.

characters(text)

Returns a list of characters in text.

length_difference(length)

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

numbertranslate(text)

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

numstart(text)

Determines whether the text starts with a numeric value.

punctranslate(text)

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

sentence_iter(text, strip=True)

Returns an iterator over the sentences in text.

sentences(text, strip=True)

Returns a list of sentences in text.

word_iter(text)

Returns an iterator over the words in text.

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.

alter_length(text)

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

capsstart(text)

Determines whether the text starts with a capital letter.

character_iter(text)

Returns an iterator over the characters in text.

characters(text)

Returns a list of characters in text.

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

These marks are only used for Khmer.

length_difference(length)

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

numbertranslate(text)

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

numstart(text)

Determines whether the text starts with a numeric value.

punctranslate(text)

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

sentence_iter(text, strip=True)

Returns an iterator over the sentences in text.

sentences(text, strip=True)

Returns a list of sentences in text.

word_iter(text)

Returns an iterator over the words in text.

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.

alter_length(text)

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

capsstart(text)

Determines whether the text starts with a capital letter.

character_iter(text)

Returns an iterator over the characters in text.

characters(text)

Returns a list of characters in text.

length_difference(length)

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

numbertranslate(text)

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

numstart(text)

Determines whether the text starts with a numeric value.

punctranslate(text)

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

sentence_iter(text, strip=True)

Returns an iterator over the sentences in text.

sentences(text, strip=True)

Returns a list of sentences in text.

word_iter(text)

Returns an iterator over the words in text.

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.

alter_length(text)

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

capsstart(text)

Determines whether the text starts with a capital letter.

character_iter(text)

Returns an iterator over the characters in text.

characters(text)

Returns a list of characters in text.

length_difference(length)

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

numbertranslate(text)

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

numstart(text)

Determines whether the text starts with a numeric value.

punctranslate(text)

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

sentence_iter(text, strip=True)

Returns an iterator over the sentences in text.

sentences(text, strip=True)

Returns a list of sentences in text.

word_iter(text)

Returns an iterator over the words in text.

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.

alter_length(text)

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

capsstart(text)

Determines whether the text starts with a capital letter.

character_iter(text)

Returns an iterator over the characters in text.

characters(text)

Returns a list of characters in text.

length_difference(length)

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

numbertranslate(text)

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

numstart(text)

Determines whether the text starts with a numeric value.

punctranslate(text)

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

sentence_iter(text, strip=True)

Returns an iterator over the sentences in text.

sentences(text, strip=True)

Returns a list of sentences in text.

word_iter(text)

Returns an iterator over the words in text.

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.

alter_length(text)

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

capsstart(text)

Determines whether the text starts with a capital letter.

character_iter(text)

Returns an iterator over the characters in text.

characters(text)

Returns a list of characters in text.

length_difference(length)

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

numbertranslate(text)

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

numstart(text)

Determines whether the text starts with a numeric value.

punctranslate(text)

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

sentence_iter(text, strip=True)

Returns an iterator over the sentences in text.

sentences(text, strip=True)

Returns a list of sentences in text.

word_iter(text)

Returns an iterator over the words in text.

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.

alter_length(text)

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

capsstart(text)

Determines whether the text starts with a capital letter.

character_iter(text)

Returns an iterator over the characters in text.

characters(text)

Returns a list of characters in text.

length_difference(length)

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

numbertranslate(text)

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

numstart(text)

Determines whether the text starts with a numeric value.

punctranslate(text)

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

sentence_iter(text, strip=True)

Returns an iterator over the sentences in text.

sentences(text, strip=True)

Returns a list of sentences in text.

word_iter(text)

Returns an iterator over the words in text.

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.

alter_length(text)

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

capsstart(text)

Determines whether the text starts with a capital letter.

character_iter(text)

Returns an iterator over the characters in text.

characters(text)

Returns a list of characters in text.

length_difference(length)

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

numbertranslate(text)

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

numstart(text)

Determines whether the text starts with a numeric value.

punctranslate(text)

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

sentence_iter(text, strip=True)

Returns an iterator over the sentences in text.

sentences(text, strip=True)

Returns a list of sentences in text.

word_iter(text)

Returns an iterator over the words in text.

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

Reversed lang_codes

si

This module represents the Sinhala language.

class translate.lang.si.si

This class represents Sinhala.

alter_length(text)

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

capsstart(text)

Determines whether the text starts with a capital letter.

character_iter(text)

Returns an iterator over the characters in text.

characters(text)

Returns a list of characters in text.

length_difference(length)

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

numbertranslate(text)

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

numstart(text)

Determines whether the text starts with a numeric value.

punctranslate(text)

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

sentence_iter(text, strip=True)

Returns an iterator over the sentences in text.

sentences(text, strip=True)

Returns a list of sentences in text.

word_iter(text)

Returns an iterator over the words in text.

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.

alter_length(text)

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

capsstart(text)

Determines whether the text starts with a capital letter.

character_iter(text)

Returns an iterator over the characters in text.

characters(text)

Returns a list of characters in text.

length_difference(length)

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

numbertranslate(text)

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

numstart(text)

Determines whether the text starts with a numeric value.

punctranslate(text)

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

sentence_iter(text, strip=True)

Returns an iterator over the sentences in text.

sentences(text, strip=True)

Returns a list of sentences in text.

word_iter(text)

Returns an iterator over the words in text.

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.

alter_length(text)

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

capsstart(text)

Determines whether the text starts with a capital letter.

character_iter(text)

Returns an iterator over the characters in text.

characters(text)

Returns a list of characters in text.

length_difference(length)

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

numbertranslate(text)

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

numstart(text)

Determines whether the text starts with a numeric value.

punctranslate(text)

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

sentence_iter(text, strip=True)

Returns an iterator over the sentences in text.

sentences(text, strip=True)

Returns a list of sentences in text.

word_iter(text)

Returns an iterator over the words in text.

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.

alter_length(text)

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

capsstart(text)

Determines whether the text starts with a capital letter.

character_iter(text)

Returns an iterator over the characters in text.

characters(text)

Returns a list of characters in text.

length_difference(length)

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

numbertranslate(text)

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

numstart(text)

Determines whether the text starts with a numeric value.

punctranslate(text)

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

sentence_iter(text, strip=True)

Returns an iterator over the sentences in text.

sentences(text, strip=True)

Returns a list of sentences in text.

word_iter(text)

Returns an iterator over the words in text.

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

alter_length(text)

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

capsstart(text)

Determines whether the text starts with a capital letter.

character_iter(text)

Returns an iterator over the characters in text.

characters(text)

Returns a list of characters in text.

length_difference(length)

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

numbertranslate(text)

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

numstart(text)

Determines whether the text starts with a numeric value.

punctranslate(text)

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

sentence_iter(text, strip=True)

Returns an iterator over the sentences in text.

sentences(text, strip=True)

Returns a list of sentences in text.

word_iter(text)

Returns an iterator over the words in text.

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.

alter_length(text)

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

capsstart(text)

Determines whether the text starts with a capital letter.

character_iter(text)

Returns an iterator over the characters in text.

characters(text)

Returns a list of characters in text.

length_difference(length)

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

numbertranslate(text)

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

numstart(text)

Determines whether the text starts with a numeric value.

punctranslate(text)

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

sentence_iter(text, strip=True)

Returns an iterator over the sentences in text.

sentences(text, strip=True)

Returns a list of sentences in text.

word_iter(text)

Returns an iterator over the words in text.

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.

alter_length(text)

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

capsstart(text)

Determines whether the text starts with a capital letter.

character_iter(text)

Returns an iterator over the characters in text.

characters(text)

Returns a list of characters in text.

length_difference(length)

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

numbertranslate(text)

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

numstart(text)

Determines whether the text starts with a numeric value.

punctranslate(text)

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

sentence_iter(text, strip=True)

Returns an iterator over the sentences in text.

sentences(text, strip=True)

Returns a list of sentences in text.

word_iter(text)

Returns an iterator over the words in text.

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.

alter_length(text)

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

capsstart(text)

Determines whether the text starts with a capital letter.

character_iter(text)

Returns an iterator over the characters in text.

characters(text)

Returns a list of characters in text.

length_difference(length)

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

numbertranslate(text)

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

numstart(text)

Determines whether the text starts with a numeric value.

punctranslate(text)

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

sentence_iter(text, strip=True)

Returns an iterator over the sentences in text.

sentences(text, strip=True)

Returns a list of sentences in text.

word_iter(text)

Returns an iterator over the words in text.

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.

alter_length(text)

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

capsstart(text)

Determines whether the text starts with a capital letter.

character_iter(text)

Returns an iterator over the characters in text.

characters(text)

Returns a list of characters in text.

length_difference(length)

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

numbertranslate(text)

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

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
sentence_iter(text, strip=True)

Returns an iterator over the sentences in text.

sentences(text, strip=True)

Returns a list of sentences in text.

word_iter(text)

Returns an iterator over the words in text.

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.

alter_length(text)

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

capsstart(text)

Determines whether the text starts with a capital letter.

character_iter(text)

Returns an iterator over the characters in text.

characters(text)

Returns a list of characters in text.

numbertranslate(text)

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

numstart(text)

Determines whether the text starts with a numeric value.

punctranslate(text)

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

sentence_iter(text, strip=True)

Returns an iterator over the sentences in text.

sentences(text, strip=True)

Returns a list of sentences in text.

word_iter(text)

Returns an iterator over the words in text.

words(text)

Returns a list of words in text.