safe.utilities.i18n module

InaSAFE Disaster risk assessment tool by AusAid -Internationalisation utilities.

The module provides utilities function to convert between unicode and byte string for Python 2.x. When we move to Python 3, this module and its usage should be removed as string in Python 3 is already stored in unicode.

Contact : ole.moller.nielsen@gmail.com

Note

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

safe.utilities.i18n.locale()[source]

Get the name of the currently active locale.

Returns:Name of hte locale e.g. ‘id’
Return type:stre
safe.utilities.i18n.tr(text)[source]

We define a tr() alias here since the utilities implementation below is not a class and does not inherit from QObject.

Parameters:text (str, unicode) – String to be translated
Returns:Translated version of the given string if available, otherwise the original string.
Return type:str, unicode