Ñò OÓˆUc@sdZddkTdS(s¹g11nsvc is a library of convenience routines for dealing with locales available in a Solaris system or contained in a media (or any arbitrary location) or from any external source. The library is divided into 2 distinct classes and include APIs for doing operations on them. Classes are G11NSvcLocalePopulate class and G11NSvcLocaleOperations class. First is a G11NSvcLocalePopulate class, which depending on input parameter can read a list of locales installed in a Solaris system or a list of locales available for installation from IPS package repositories or from an installation media or from any system path. For example import g11nsvc locale_populate = g11nsvc.G11NSvcLocalePopulate() locale_list = locale_populate.get_valid_locales() will give a list of locales installed in the system in locale_list. G11NSvcLocalePopulate class takes in these optional parameters, with following defaults: locale_search_path='/usr/lib/locale', setlocale_check=True This class uses libnlsadm to get a list of valid locales. If setlocale_check is True the list will contain only locales installed on the system, if setlocale_check is False the list will include not only installed locales but also locales available for installation from IPS package repositories. Default values of locale_search_path='/usr/lib/locale' and setlocale_check=True work well on an installed Solaris system. If this is called from an image rooted at a diferent location than the default locale_search_path value, then locale_search_path should point to the path of the image rooted where the locale directories are found. If specified, the locale_search_path should end with '/usr/lib/locale' (e.g. '/root_image/usr/lib/locale'). If this is called from an installation media such as a CD-ROM setlocale_check should be set to False. G11NSvcLocalePopulate has a method get_valid_locales which returns a list of locales provided by libnlsadm. The second class is G11NSvcLocaleOperations class, which does operations of the list of locales obtained. If we already have a list of locales to do operations at hand, we can bypass G11NSvcLocalePopulate class. Default arguments for G11NSvcLocaleOperations class are valid_locales=[], init_file='/etc/default/init' Valid_locales is the list of valid locales. The init_file parameter is obsolete and should not be used. This parameter is present only to keep compatibility with older code but it is not longer necessary and will be ignored. Following are the available functions in G11NSvcLocaleOperations class: setlocale(self, localename=None): Sets the given locale for a system in the LC_ALL locale environment. Returns the name of the locale set or None if the locale is not supported. :param localename str: locale name getlocale(self, category=locale.LC_CTYPE): Gets the currently set locale for a system. By default, the LC_CTYPE locale environment is used. :param category str: locale category defined in locale.py get_language_code(self, localename=None): Gets the language code from a locale. A language code is in most cases an ISO 639 two-letter code. If localename is None, the default locale is used. :param localename str: locale name get_territory_code(self, localename=None): Gets the territory code from locale name. A territory code is in most cases an ISO 3166 two-letter code. If localename is None, the default locale is used. :param localename str: locale name get_encoding(self, localename=None): Gets the codeset of the localename. If localename is None, the default locale is used. :param localename str: locale name get_variant(self, localename=None): Get the variant of the localename. If localename is None, the default locale is used. :param localename str: locale name get_language_desc(self, localename=None, desc_locale=None): Gets the language description from locale name. Returns description in desc_locale if available (return value is 'None' if language description is not available in desc_locale). If the codeset of desc_locale is not supported by python codecs, output will be in UTF-8. If the value of localename or desc_locale is None, the default locale is used. :param localename str: locale name :param desc_locale str : locale for language description output get_territory_desc(self, localename=None, desc_locale=None): Gets the territory description from locale name. Returns description in desc_locale if available (return value is 'None' if territory description is not available in desc_locale). If the codeset of desc_locale is not supported by python codecs, output will be in UTF-8. If the value of localename or desc_locale is None, the default locale is used. :param localename str: locale name :param desc_locale str: locale for territory description output get_locale_desc(self, localename=None, desc_locale=None): Gets territory and language description from locale name. Returns description in desc_locale if available (return value is 'None' if locale description is not available in desc_locale). If the codeset of desc_locale is not supported by python codecs, output will be in UTF-8. If the value of localename or desc_locale is None, the default locale is used. :param localename str: locale name :param desc_locale str: locale for locale description output get_locales_with_language_code(self, lang_code=None): Gets a list of all locales with lang_code. :param lang_code str - language code def get_locales_with_territory_code(self, territory_code=None): Gets a list of all locales with territory_code. :param territory_code str: territory code get_locales_with_encoding(self, encoding=None): Gets a list of all locales with encoding. :param encoding str: codeset get_locales_with_variant(self, variant=None): Gets a list of all locales with variant. :param variant str: variant code get_locales(self, lang_code=None, territory_code=None, encoding=None, variant=None): Calls component functions to return a list of locales obeying language/territory/encoding and variant constraints. If for a parameter None is passed then the component function returns all the valid locales. This enables us to pass the needed params we are interested in and output the intersection of results for the components. :param lang_code str: language code :param territory str: territory code :param encoding str: codeset :param variant str: variant get_utf8_locales(self, lang_code=None): Gets a list of all UTF-8 locales with lang_code. :param lang_code str: language code get_legacy_locales(self, lang_code=None): Gets a list of all legacy locales with lang_code. :param lang_code str: language code get_utf8_locales_desc(self, desc_locale=None): Gets the description of all UTF-8 locales in desc_locale. If desc_locale is None, the default locale is used. :param desc_locale str: locale for locale description output get_timezones_for_territory(self, territory_code=None): Returns a list of timezones for territory_code. If territory_code is None, the territory code for the current locale is used. :param territory_code str: Region code get_localename_from_timezone(self, timezone=None, lang_code=None, check_locale=True, encoding=None): Returns a list of locales for a timezone, a lang_code and an encoding. If check_locale is False, the list will include not only installed locales but also locales available for installation from IPS package repositories. :param timezone str: Timezone :param lang_code str: Language Code :param locale_check bool: Boolean value indicating if the resultant localename needs to be verified. :param encoding str: Encoding of the locale to be returned get_default_system_locale(self): Gets the value of the default system locale that is managed through the service management facility SMF under the service identifier: svc:/system/environment:init iÿÿÿÿ(t*N(t__doc__tg11nsvc(((sp/scratch/g11nbld/nightly.26.2/g11n-oso/proto/i386/fileroot/usr/lib/python2.6/vendor-packages/g11nsvc/__init__.pytns