Package gnue :: Package common :: Package base :: Module i18n
[show private | hide private]

Module gnue.common.base.i18n

Internationalization support.
Function Summary
  get_encoding()
Returns the encoding of the currently active locale.
  get_language()
Returns the language of the currently active locale.
  get_user_locale()
Try to find out which locale the user is using.
  outconv(message)
Encodes a message to encoding (the current locale's encoding).
  set_current_locale(new_locale)
Set the current locale.
  translate(message)
Translates a message and returns an 8 bit string, encoded with encoding (the current locale's encoding).
  utranslate(message)
Translates a message and returns a unicode string.

Variable Summary
str encoding: Encoding of the current locale
str language: Language of the current locale

Function Details

get_encoding()

Returns the encoding of the currently active locale. This can be changed with set_current_locale.
Returns:
encoding of the current locale.

get_language()

Returns the language of the currently active locale. This can be changed with set_current_locale.
Returns:
language of the current locale.

get_user_locale()

Try to find out which locale the user is using. This is always the locale of the user running the program and is not touched by set_current_locale.
Returns:
localestring of the user's locale, i.e. de_AT@euro.

outconv(message)

Encodes a message to encoding (the current locale's encoding). This function is available as the builtin function "o()".

set_current_locale(new_locale)

Set the current locale.

If it fails it tries to succeed using a more general form of the requested locale, i.e. if 'de_AT@euro' fails, 'de_AT' will be tried next. If that fails too, 'de' will be tried.
Parameters:
new_locale - string of the locale to be set, e.g. de_AT.ISO88591@euro (full blown) or 'de_AT' or 'en_AU'

translate(message)

Translates a message and returns an 8 bit string, encoded with encoding (the current locale's encoding). This function is available as the builtin function "_()".

utranslate(message)

Translates a message and returns a unicode string. This function is available as the builtin function "u_()".

Variable Details

encoding

Encoding of the current locale
Type:
str
Value:
'ISO8859-1'                                                            

language

Language of the current locale
Type:
str
Value:
'en_US'                                                                


GNUe Home

Public API

Developer's Corner