Package translate :: Package lang :: Module poedit

[hide private]
[frames] | no frames]

# Module poedit

source code

Functions to manage Poedit's language features.

ISO 639 maps are form Poedit's isocode.cpp 1.4.2 to ensure that we match currently released versions of Poedit.

Functions | [hide private]

String

isocode(language, country=None) Returns a language code for the given Poedit language name. | source code

Variables | [hide private]

| lang_codes = ``{``'``aa``'``:` `'``Afar``'``,` `'``ab``'``:` `'``Abkhazian``'``,` `'``ae``'``:` `'``Avestan``'``...`` ISO369 codes and names as used by Poedit.
| lang_names = ``{``'``(Afan) Oromo``'``:` `'``om``'``,` `'``Abkhazian``'``:` `'``ab``'``,` `'``Afar``'``:``...`` Reversed lang_codes
| dialects = ``{``'``Chinese``'``:` `{``'``CHINA``'``:` `'``zh_CN``'``,` `'``None``'``:` `'``zh_CN``'``,` `'``TA``...`` Language dialects based on ISO 3166 country names, 'None' is the default fallback
| key = ``'``sd``'``
| value = ``'``Sindhi``'``

Function Details | [hide private]

### isocode(language, country=None)

source code

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: String
  ISO 639 language code

Variables Details | [hide private]

### lang_codes

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

Value:

      {'aa': 'Afar',
       'ab': 'Abkhazian',
       'ae': 'Avestan',
       'af': 'Afrikaans',
       'am': 'Amharic',
       'ar': 'Arabic',
       'as': 'Assamese',
       'ay': 'Aymara',
      ...

### lang_names

Reversed lang_codes

Value:

      {'(Afan) Oromo': 'om',
       'Abkhazian': 'ab',
       'Afar': 'aa',
       'Afrikaans': 'af',
       'Albanian': 'sq',
       'Amharic': 'am',
       'Arabic': 'ar',
       'Armenian': 'hy',
      ...

### dialects

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

Value:

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