---
name: "localemgr"
section: "3"
platform: "linux"
package: "libsword-dev"
version: "1.5.3-3woody2"
release: "Debian 3.0 (Woody)"
platforms: ["linux"]
url: "https://new.carta.tech/localemgr"
---

# localemgr(3)

The LocaleMgr class handles all the different locales of Sword.

## NAME

LocaleMgr - The LocaleMgr class handles all the different locales of Sword.

## SYNOPSIS

`#include <localemgr.h>`

### Public Methods

**LocaleMgr** (const char \*iConfigPath=0)\
 *Default constructor of LocaleMgr You do normally not need this constructor, use* **LocaleMgr::systemLocaleMgr** instead. virtual **~LocaleMgr** ()\
 *Default destructor of LocaleMgr.* virtual **SWLocale**\* **getLocale** (const char \*name)\
 *Get the locale connected with the name* *name"."* virtual list\< string \> **getAvailableLocales** ()\
 *Get the list of available locales.* virtual const char\* **translate** (const char \*name, const char \*text)\
 *Returns translated text.* virtual const char\* **getDefaultLocaleName** ()\
 *Get the default locale name.* virtual void **setDefaultLocaleName** (const char \*name)\
 *Set the new standard locale of Sword.*

### Static Public Attributes

LocaleMgr **systemLocaleMgr**\
 *The LocaleMgr object used globally in the Sword world.*

### Protected Methods

virtual void **loadConfigDir** (const char \*ipath)\

### Protected Attributes

LocaleMap **locales**\

### Private Methods

void **deleteLocales** ()\

### Private Attributes

char\* **defaultLocaleName**\

## DETAILED DESCRIPTION

The LocaleMgr class handles all the different locales of Sword.

It provides functions to get a list of all available locales, to get the default locale name and to get it. The other functions are not interesting for frontend programmers.

To get the default locale name use

**See also:**  **getDefaultLocaleName** To set the default locale name use , **setDefaultLocaleName** To get the locale for a language name use , **getLocale** To get a list of availble locales use , **getAvailableLocales**

Definition at line 49 of file localemgr.h.

## MEMBER FUNCTION DOCUMENTATION

### list\< string \> LocaleMgr::getAvailableLocales ()` [virtual]`

Get the list of available locales.

@ret Returns a list of strings, which contains the names of the available locales.

### const char \* LocaleMgr::getDefaultLocaleName ()` [virtual]`

Get the default locale name.

To set it use

**See also:**  **setDefaultLocaleName**

@ret Returns the default locale name

### SWLocale \* LocaleMgr::getLocale (const char \* name)` [virtual]`

Get the locale connected with the name "name".

**Parameters:**

- *name*

  The name of the locale you want to have. For example use getLocale("de") to get the locale for the German language.

**Returns:**  Returns the locale object if the locale with the name given as parameter was found. If it wasn't found return NULL.

### void LocaleMgr::setDefaultLocaleName (const char \* name)` [virtual]`

Set the new standard locale of Sword.

**Parameters:**

- *name*

  The name of the new default locale

### const char \* LocaleMgr::translate (const char \* name, const char \* text)` [virtual]`

Returns translated text.

This function uses both parameters to return the translated version of the given text.

**Parameters:**

- *name*

  The name of the locale Sword should use

**an The text to translate into the language given by the first parameter.** **Returns:**  Returns the translated text.

## MEMBER DATA DOCUMENTATION

### LocaleMgr LocaleMgr::systemLocaleMgr` [static]`

The LocaleMgr object used globally in the Sword world.

Do not create your own LocaleMgr, use this static object instead.

Definition at line 107 of file localemgr.h.

## AUTHOR

Generated automatically by Doxygen for The Sword Project from the source code.
