Localization Component
Fnd_Loc_GetString
Fnd_Loc_GetString (module; lookup code{; param 1{; param 2...}}) -> Text
Parameters
| Parameter | Type | Description |
|---|---|---|
| module | Text | The module name |
| lookup code | Text | The lookup code |
| param 1..param 2 | Text | Replacement parameters (optional) |
| Function Result | Text | The localized string |
Description
This routine returns a localized string based on the internal string or label. Foundation’s Language Code is used to determine which language string to return. See the Fnd_Loc_LanguageCode method for more information. Foundation stores localization strings as 4D lists. These lists can be edited directly in the 4D List Editor, or using Foundation’s Localization Editor. See the detailed description at the beginning of this chapter. To use this method, pass it the module name and the lookup code:
$localized_t:=Fnd_Loc_GetString ("MyModule";"ProductNameLable")
You can optionally pass additional text parameters to insert into the string. For example, you may want to localize a string like “You have 10 days remaining” where the number of days is calculated, rather than fixed. To do this, create a localized string with “<<1>>” in it. This will be replaced by the first optional parameter to this call. In this example, imagine we have a localized string named “DaysRemaining” with this content: “You have <<1>> days remaining.” Just pass the number of days (as a string) as the third parameter to Fnd_Loc_GetString:
$days:=String(vDays)
$localized_t:=Fnd_Loc_GetString ("MyModule";"DaysRemaining";$days)
You can do this replacement for any number of optional parameters. For the second optional parameter use “<<2>>,” then “<<3>>” for the third, etc.
Extracted source text
Fnd_Loc_GetString (module; lookup code{; param 1{; param 2...}}) ➜ Text
Parameter Type Description
module Text The module name
lookup code Text The lookup code
param 1..param 2 Text Replacement parameters (optional)
Function Result Text The localized string
This routine returns a localized string based on the internal string or label. Foundation’s Language Code
is used to determine which language string to return. See the Fnd_Loc_LanguageCode method for
more information.
Foundation stores localization strings as 4D lists. These lists can be edited directly in the 4D List Editor, or
using Foundation’s Localization Editor. See the detailed description at the beginning of this chapter.
To use this method, pass it the module name and the lookup code:
$localized_t:=Fnd_Loc_GetString ("MyModule";"ProductNameLable")
You can optionally pass additional text parameters to insert into the string. For example, you may want
to localize a string like “You have 10 days remaining” where the number of days is calculated, rather than
fixed. To do this, create a localized string with “<<1>>” in it. This will be replaced by the first optional
parameter to this call.
In this example, imagine we have a localized string named “DaysRemaining” with this content:
“You have <<1>> days remaining.”
Just pass the number of days (as a string) as the third parameter to Fnd_Loc_GetString:
$days:=String(vDays)
$localized_t:=Fnd_Loc_GetString ("MyModule";"DaysRemaining";$days)
You can do this replacement for any number of optional parameters. For the second optional parameter
use “<<2>>,” then “<<3>>” for the third, etc.