FutureBasic Logo

<<    Index    >> FutureBasic 5

stringlist   statement



Syntax:
stringlist on
stringlist off
stringlist


Description:
Controls the localizability of string literals (step 1 below). The default state is off. When source code is compiled, FutureBasic needs to know where to store quoted strings. Quoted strings are those that appear in the source code like "Hello". The strings are placed in the appropriate *.lproj folder in the app's internal folder hierarchy. A string literal will be localized if:

[1] it is encountered while stringlist is on.
[2] a Localizable.strings file is present in the appropriate *.lproj folder of the app's internal folder hierarchy.
[3] the file contains a key that matches the original string literal.
[4] the value corresponding to the key has been edited to be localized.
otherwise the original unlocalized string is used.

A localizable string takes up more memory than a non-localizable one, and access to it is much slower. Recommended practice is to place each string (or group of strings) that you want localizable between 'stringlist on' and 'stringlist' directives:
stringlist on         // turn localizability on
print "Hello, world!" // localizable
stringlist            // revert to previous state
plusSign$ = "+"       // not localizable
FBtoC's menu command 'File > Generate Localizable.strings' creates a file in the built_temp folder, with an entry for each localizable string. An entry consists of a comment (file: line) to assist the translator, followed by "key = "value";
/* HelloWorld.bas: 4 */
"Hello, world!" = "Hello, world!";
After editing the value for French.lproj:
"Hello, world!" = "Bonjour, le monde!";
Note:
stringlist statements are not nestable.
stringlist statements don't apply for string constants.

Reference:
Internationalization Programming Topics