Modeller.localFormat


localFormat(format, [arg1], [arg2], [arg3], [arg4], [arg5], [arg6], [arg7], [arg8], [arg9], [arg10], [arg11], [arg12], [arg13], [arg14], [arg15], [arg16], [arg17], [arg18], [arg19], [arg20])

Builds compound text from a number of variables placed in a format string. The format string contains plain text and a number of numbered place holders in that text of the form %n, where n is in the range 1..20 and represents the corresponding subsequent arguments. Use %% to indicate the % character. Identifying arguments numerically is useful when multiple user interface languages must be considered, as shown in the example. The format string can also be given as a numerical string ID, in which case it will be substituted by the equivalent string loaded from Modeller's resources.

formatstring
arg1optional string
arg2optional string
arg3optional string
arg4optional string
arg5optional string
arg6optional string
arg7optional string
arg8optional string
arg9optional string
arg10optional string
arg11optional string
arg12optional string
arg13optional string
arg14optional string
arg15optional string
arg16optional string
arg17optional string
arg18optional string
arg19optional string
arg20optional string
Return valuestring

Example


 number = "10"
 if (language == "French") then
     fruit = "pommes"
     colour = "rouge"
 ' in French, adjectives come after the noun
     fmt = "J'ai %1%% des %3 %2"
 else
     fruit = "apples"
     colour = "red"
 ' in English, adjectives come before the noun
     fmt = "I have %1%% of the %2 %3"
 end if
 msgbox(localFormat(fmt, number, colour, fruit))
 
would display the string "I have 10% of the red apples" for English, and "J'ai 10% des pommes rouge" in French

 msgbox(localFormat(IDS_ELEMENT_NAME))
 
would display the string "Element", correctly translated for the current user interface language

Back to Modeller

Back to Overview