Localization support API
The following classes provide protocols that directly support the internationalization and localization of software.
• NlsMessageCatalog
• RCConverter
NlsMessageCatalog class methods
on:
Answers a new, initialized instance of the receiver on the file specified by the absolute or relative path aPathName (String).
NlsMessageCatalog instance methods
allMessageIdentifiers
Determines which locales are supported by localized messages stored in the file specified by the receiver's path. Answers a collection of all locale names for which the catalog file specified by path has mappings including locale names starting with the "$" character whose names are not returned by the messageIdentifiers protocol. Answers nil if an error occurs.
compatibilities
Answers an array of compatibility arrays, nil if no compatibility arrays can be located. Each compatibility array has the following form:
#(
<primary local triple> "Triple for which messages are
actually stored."
<compatible pattern> "Triple for locale compatible with primary."
...
(compatible pattern> "Triple for local compatible with primary."
)
compatibilities:
Unloads anArrayOfcompatibilityArrays into the file represented by the receiver. The format of the argument anArrayOfcompatibilityArrays is described in the compatibilities method comment. Answers true on success, otherwise answers false.
compressMinimal:
Compresses the file represented by the receiver removing any dead areas. If compressToMinimumSize is true, the file is made its smallest possible size. If compressToMinimumSize is false, padding is included in the new file so that future writes might not need to grow the file. Answers true if successful, otherwise answers false
currentError
Answers the integer error code describing the last error that occurred. Answers 0 if no errors have occurred.
currentErrorObject
Answers the object(s) that caused the last error that occurred. This can be a single object or an array of objects. Refer to
List of error codes.
currentErrorString
Answers a string of the last error that occurred. This string offers an explanation of the last error, and appends extended error information from the Swapper, if appropriate.
declareKeysFor:language:territory:characterSet:
Loads the localized messages stored in the receiver at the key specified by the language, territory, and character set (strings). Declares keys in the specified pool dictionary if they are missing. The values of newly declared keys are the same as the key to allow identification of missing translations. Answers true on success, otherwise answers false.
deleteDictionaryLanguage:territory:characterSet:
Deletes the external message dictionary for the locale specified by the language, territory, and character set (strings) from the catalog file specified by the receiver's file name. Answers true if the external dictionary message is successfully removed, otherwise answers false.
deleteIndexLanguage:territory:characterSet:
Deletes the indexed message specified by the index for the locale specified by the language, territory, and character set (strings) from the catalog file specified by the receiver's file name. Answers true if the localized message was successfully removed, otherwise answers false.
deleteLanguage:territory:characterSet:
Deletes all messages for the locale specified by the language, territory, and character set (strings) from the catalog file specified by the receiver's file name. Answers true if the messages are successfully removed, otherwise answers false.
fileName
Answers a String that is the fileName of the message catalog file represented by the receiver. The fileName is the string passed as an parameter to the on: method.
fileName:
Sets the fileName of the message catalog file represented by the receiver to the specified string.
hasErrorOccurred
Answers true if an error has occurred in the receiver, otherwise answers false.
hiddenMessageIdentifiers
Determines which locales are supported by localized messages stored in the file specified by the receiver's path. Answers a collection of the supported locale names, in which the locale names start with a "$" character. These names are not returned by the messageIdentifiers protocol. Answers nil if an error occurs.
indexesForLanguage:territory:characterSet:
Determines which indexed message identifiers are available for the locale specified by the language, territory, and character set (strings). Answers a collection of indexed message identifiers (positive integers) for which the message catalog file specified by the receiver's file name has mappings. Answers nil if an error occurs.
loadLanguage:territory:characterSet:
Answers the dictionary of localized messages specified by the language, territory, and character set stored in the file specified by the receiver's path. Answers the dictionary of retrieved messages if successful, otherwise answers nil.
loadLanguage:territory:characterSet:index:
Answers the indexed message specified by the positive integer index for the locale and character set specified by language, territory, and character set, contained in the file specified by path. Answers the localized message retrieved from disk if successful, answers nil otherwise.
loadLanguage:territory:characterSet:intoDictionary:
Localizes the specified EsPoolDictionary using message for the locale specified by the language, territory, and character set (strings). Modifies the association in the pool dictionary with localized messages contained in the file specified by path. Answers true if successful, otherwise answers false.
Note:
Only keys already in the pool have their values set.
localeCompatibleWithLanguage:territory:characterSet:
Retrieves and examines the receiver's compatibilities array and determines which message identifier best matches the language, territory, and character set.
If the message catalog file contains messages for the specified language, territory, and character set, the compatibilities are not examined and an array containing the specified the language, territory, and character set is returned. Otherwise the matching process examines each line of the compatibilities array (whose format is described in the compatibilities method comment). Within a line of the compatibilities, array patterns are examined from left to right. If no match is found on a given line, the search continues to the following lines until a match is found or no more lines are available. A match occurs if the three elements of the pattern array match language, territory, and character set.
Answers a three-element array consisting of strings that identify the language, territory, and character set. Answers nil if an error occurs or if no compatibility matches the supplied arguments.
messageIdentifiers
Determines which locales are supported by localized messages stored in the file specified by the receiver's path. Answers a collection of the locale names for which the message catalog file specified by path has mappings. Answers nil if an error occurs.
objectPlatform
Answers the object platform from which the message catalog file specified by the receiver's path was dumped. Answers a string indicating the object platform, or nil if an error occurs.
pathName
Answers a string that contains the full path name of the message catalog file represented by the receiver (nil if the full path has not yet been computed).
supportsLanguage:territory:characterSet:
Determines whether the specified file contains localized messages for the locale specified by the string's language, territory, and character set. Answers true if the locale is supported, false if unsupported, or nil if an error occurs.
unload:language:territory:characterSet:
Stores the localized messages contained in the specified pool dictionary for the locale defined by the language, territory, and character set in the file specified by the receiver's fileName. Answers true if successful, otherwise answers false.
unload:language:territory:characterSet:index:
Stores the given localized message as an indexed message in a file specified by the receiver's fileName, for the locale defined by the language, territory, and character set, and the positive integer index. Answers true if successful, otherwise answers false.
RCConverter class methods
new
Answers a new, initialized instance of the receiver.
RCConverter class methods instance methods
convertMessages:comments:toResourceFile:
Creates a file resourcePath that can be used as input to the Windows resource compiler. This method converts the contents of the specified pool dictionary into numbered messages in the input file, storing the mapping as a series of define statements, and annotates this input file with comments contained in the specified comment dictionary. Answers true if successful, otherwise answers false.
convertMessages:toResourceFile:
Creates a file resourcePath that can be used as input to the Windows resource compiler. This method converts the contents of the specified pool dictionary into numbered messages in the input file storing the mapping as a series of define statements. Answers true if successful, otherwise answers false.
indexFrom:
Parses the specified input file of the Windows resource compiler and answers a dictionary that contains the pool key-numeric mappings stored in the define statements of the input file. Answers nil if an error occurs.
messagesFromDLL:index:
Answers the dictionary rebuilt from the specified dynamic link library using the mapping between dictionary keys and numeric identifiers contained in the index. Answers the rebuilt dictionary if successful, nil if an error occurs.