Adobe 65007312 Programming Guide - Page 147
The LOC function
UPC - 883919154398
View all Adobe 65007312 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 147 highlights
CHAPTER 7: Using ZStrings for Localization The LOC function 147 Sequence ^d ^L ^V ^# ^` ^^ ^0 - ^9 ^U+xxxx Replacement Greek capital delta backslash ("\") vertical bar ("|") command key (in Mac OS) accent grave ("`") circumflex ("^") Marks insertion point for additional LOC argument strings; see "The LOC function" on page 147. Unicode code point U+xxxx The LOC function The global LOC function takes a ZString argument, and automatically performs the table lookup to resolve the display string for the current locale. If it cannot find a matching string in a dictionary for the current locale, or if there is no dictionary for the current locale, it returns the default string provided with the ZString. You can use the LOC function anywhere you specify display strings: X In the title for your Export Service Provider X In the title for menu items that you add X In the title and value properties of UI elements Any of these properties can take a simple string or a LOC and ZString value. You are not required to use the LOC function if you do not need to localize the text of your plug-in. Here is an example of localizing the text that identifies an Export Service Provider in the Export destination section of the Export dialog: LrExportServiceProvider = { title = LOC "$$$/MyPlugin/Name=My Plug-in", file = 'MyPluginExportServiceProvider.lua', ... }, The LOC function also allows you to combine strings using placeholders in the ZString's value string, and additional string arguments to the function. The placeholders use "hat" notation with a numeric value; the first is ^1, the second ^2, and so on. You can specify up to 9 additional string arguments, which are inserted at the placeholder locations ^1 through ^9 in the localized text. For example: LOC( "$$$/Message=Could not open the file ^1 because ^2.", "myfile.jpg", "a disk error occurred" ) The placeholders are replaced by the string arguments, resulting in this string: "Could not open the file myfile.jpg because a disk error occurred."