Package s3 :: Module s3validators :: Class IS_ISO639_2_LANGUAGE_CODE
[frames] | no frames]

Class IS_ISO639_2_LANGUAGE_CODE

source code

gluon.IS_IN_SET --+
                  |
                 IS_ISO639_2_LANGUAGE_CODE

Validate ISO639-2 Alpha-2/Alpha-3 language codes

Instance Methods
 
__init__(self, error_message="Invalid language code", multiple=False, select=DEFAULT, sort=False, translate=False, zero="")
Constructor
source code
 
options(self, zero=True)
Get the options for the selector.
source code
 
represent(self, code)
Represent a language code by language name, uses the representation from deployment_settings if available (to allow overrides).
source code
Class Methods
 
represent_local(cls, code)
Represent a language code by the name of the language in that language.
source code
Static Methods
 
language_codes()
Returns a list of tuples of ISO639-1 alpha-2 language codes, can also be used to look up the language name
source code
Method Details

__init__(self, error_message="Invalid language code", multiple=False, select=DEFAULT, sort=False, translate=False, zero="")
(Constructor)

source code 

Constructor

Parameters:
  • error_message - alternative error message
  • multiple - allow selection of multiple options
  • select - dict of options for the selector, defaults to settings.L10n.languages, set explicitly to None to allow all languages
  • sort - sort options in selector
  • translate - translate the language options into the current UI language
  • zero - use this label for the empty-option (default="")

options(self, zero=True)

source code 

Get the options for the selector. This could be only a subset of all valid options (self._select), therefore overriding superclass function here.

represent(self, code)

source code 

Represent a language code by language name, uses the representation from deployment_settings if available (to allow overrides).

Parameters:
  • code - the language code

represent_local(cls, code)
Class Method

source code 

Represent a language code by the name of the language in that language. e.g. for Use in a Language dropdown

Parameters:
  • code - the language code

language_codes()
Static Method

source code 

Returns a list of tuples of ISO639-1 alpha-2 language
codes, can also be used to look up the language name

Just the subset which are useful for Translations
- 2 letter code preferred, 3-letter code where none exists,
  no 'families' or Old