[kdecore Index] [kdecore Hierarchy] [Headers]
class for supporting locale settings and national language More...
#include <klocale.h>
KLocale provides support for country specific stuff like the national language. Currently it supports only translating, but it's planned to add here methods for getting the currency sign and other things too.
[public]
Create a KLocale with the given catalogue name. If no catalogue is given, the application name is used. The constructor looks for an entry Locale/Language in the configuration file. If nothing is set there, it looks for the environment variable $LANG. The format for LANG is de:fr:.., if de (german) is your prefered language and fr (french) is your second prefered language. You can add as many languages as you want. If none of them can be find, the default (C) will be used.
catalogue | the name of the language file |
[public]
Destructor.
[public]
Translate the string into the corresponding string in the national language, if available. If not, returns the string itself. There is a KDE wide message file, that contains the most often used phrases, so we can avoid to duplicate the translation of this phrases. If a phrase is not found in the catalogue given to the constructor, it will search in the system catalogue. This makes it possible to override some phrases for your needs.
index | the lookup text and default text, if not found |
[public]
Creates an alias for the string text. It will be translated and stored under the integer constant index. This can help you to avoid repeated translation. Be aware, that this is only needed in cases, where you want to translate it in loops or something like that. In every other case, the translate methods is fast enough.
[public]
Returns an alias, that you have set before or 0, if not set. This method uses QIntDict
[public]
Returns the language used by this object. The domain AND the library translation must be available in this language. 'C' is default, if no other available.
[public]
Returns the languages selected by user.
[public]
Returns the languages selected by user.
[public]
Returns the charset name used by selected locale. Special file with charset name must be available "us-ascii" is default
[public]
Returns the base directory, where you can find the language specific things like messages. Please note, that this function is unused currently and may not work.
[public]
adds anther catalogue to search for translation lookup. This function is useful for extern libraries and/or code, that provides it's own messages.
If the catalogue does not exist for the chosen language, it will be ignored and C will be used.
[public]
The category argument tells the setlocale() function which attributes to set. The choices are:
LC_COLLATE Changes the behavior of the strcoll() and strxfrm() functions. LC_CTYPE Changes the behavior of the character-handling functions: isalpha(), islower(), isupper(), isprint(), ... LC_MESSAGES Changes the language in which messages are displayed. LC_MONETARY Changes the information returned by localeconv(). LC_NUMERIC Changes the radix character for numeric conversions. LC_TIME Changes the behavior of the strftime() function. LC_ALL Changes all of the above.
[public static]
returns the parts of the parameter str understood as language setting the format is language_country.charset
[public static]
does the same as the above, just reverse
[public]
if the application can handle localized numeric values, it should call this function.
By default, this is disabled
[public]
returns, if the radix character for numeric conversions is set to locale settings or to the POSIX standards.
| Kdoc |