[Overview][Classes][Procedures and functions][Index] | Reference for unit 'LCLTranslator' (#lcl)

# TranslateLCLResourceStrings

Translates resource strings in LCLStrConsts.pas using localization files for the specified language.

## Declaration

Source position: lcltranslator.pas line 81

`function TranslateLCLResourceStrings(`
`Lang: string;`
`Dir: string`
`):string;`

## Arguments

`Lang` |  | Language identifier for the translated constants.
`Dir` |  | Path to the .po or .mo file used for the translation.

## Function result

Language code used for the translation, or an empty string ('') when a translation is not available or an error has occurred.

## Description

TranslateLCLResourceStrings is a String function used to translate resource strings in the LCLStrConsts.pas unit to the language identifier specified in the Lang argument. Lang can contain a value as defined in ISO 639, at:

ISO 639 - Codes for the Representation of Names of Languages .

For example: 'de' or 'ru'. An empty string ('') causes the default language for the system to be used.

Dir is the optional path where .po or .mo files with the translated values for string constants are located. An empty string ('') causes the predefined directories, like 'languages' or 'locale', to be used. This is the location where the lclstrconsts.<Lang>.po or lclstrconsts.<Lang>.mo localization file for the lclstrconsts.pas unit is stored.

TranslateLCLResourceStrings calls the TranslateUnitResourceStringsEx routine using the specified parameter values as arguments, and 'lclstrconsts' as the base unit name for the translation. TranslateUnitResourceStringsEx resolves the path, language identifier, and file extension needed for the platform or operating system and applies the translated values.

The return value contains the language identifier or locale code used in the translation. It may contain an empty string ('') if a localization file is not found for the language or an error occurs.

## See also

TranslateUnitResourceStringsEx |  | Translates string constants in a unit using the localization file for the specified language and path.
TranslateUnitResourceStrings