Computers can execute software in the same manner unaffected by the geographical location of their operation. For example, even if a computer ‘X’ and a software ‘Y’ running on computer ‘X’ are transported from America to a given location in Asia, the computer ‘X’ will still execute the software ‘Y’ in the same manner irrespective of the geographical location. However, users in the Asian location using the software ‘Y’ are likely to have different requirements due to regional differences, for example, users in the given Asian location would like the software ‘Y’ to communicate messages and perform user interaction using their specific Asian language or dialect. Additionally, the Asian users may want to use different formats for date, time and currency.
Software designed for international users usually offers the necessary regional features based on the region specified by the user. The capability of software to adapt to local/regional requirements is generally known as localization or internationalization. While localization is a desirable characteristic of software, it can be a challenging task for the developer and/or designer of the software to create, maintain and update source code that includes localized code and text spread throughout. Some approaches used to simplify the task of localization are discussed below.
In one conventional approach, an object-oriented class can be used to encapsulate the localization message strings and parameters. For example, the JAVA environment provides a ResourceBundle class that can encapsulate locale-specific objects. ResourceBundles for specific locales can be built in advance, and then queried to generate appropriate text messages depending upon the current locale. A drawback of using ResourceBundle for localization is that all locale-specific text is stored in the code. To effect any change to localization information will involve some recompilation, and hence a longer development cycle.
Another conventional approach involves using property files in addition to the above-described resource encapsulating class. For example, the PropertyResourceBundle class of the JAVA environment is a subclass of the above described ResourceBundle class, and uses a set of static strings stored in files to manage locale-specific information text messages and other data. While property files provide a convenient way to store locale-specific information, the PropertyResourceBundle class cannot capture complex textual messages with localizable parameters.
The PropertyResourceBundle class allows storing of complex text messages in a properties file as separate entries. But the PropertyResourceBundle class lacks the capability to store complex messages as an entry or entries in a database. Further, the property files do not store complex messages as XML strings, and hence limit the variety of uses to which the complex messages can be put.
One of the embodiments of the invention is directed to a code arrangement on a computer-readable medium or media for use in a system for processing localization information. Such a code arrangement may include a transformation module receiving at least one non-localized information unit, the transformation module converting the non-localized information unit into an intermediate format using at least one resource file.
Further areas of applicability of the present invention will become apparent from the detailed description provided hereinafter. It should be understood that the detailed description and specific examples, while indicating exemplary embodiments of the invention, are intended for purposes of illustration only and are not intended to limit the scope of the invention.
Exemplary embodiments of the present invention will become more fully understood from the detailed description and the accompanying drawings, wherein:
The following description of exemplary embodiment(s) is merely exemplary in nature and is in no way intended to limit the invention, its application, or uses.
An example embodiment of the invention is used to store event messages from a storage area manager (SAM) of a storage area network (SAN) in a database in a localized manner.
Transformation module 14 can include an XML parser (not shown). According to an embodiment of the invention, the XML parser is a SAX (Simple API for XML) parser. Transformation module 14 receives the non-localized messages 12 as input, such as the non-localized message of
The resource file 181 can include multiple property definitions. Transformation module 14 (shown in
Keys are any information units that can be localized. For example, keys can be text messages, error messages, dates, values, user prompts, etc. The transformation module 14 can persistently store the key information forming part of non-localized messages 12 and the instructions on how to translate this key information into its value(s) counterparts. This is stored in a database entry. To retrieve the text message using transformation module, a locale is specified, for example, “de_DE” in the above illustration. Transformation module 14 will load the correct <properties_file_name>_de_DE.properties file and translate the key information into its German value(s) counterpart and return the German values, which make up the localized message 20. A user of the processor does not have to deal with XML storage and retrieval because the XML processing described above is transparent to the user.
In the present example, an example of properties is shown. The exceed_event property, defined to be a text message “CAPACITY USAGE ON HOST {0} HAS EXCEEDED {1} BYTES.” The curly brackets in the resource file 181 operate as place holders for values that are replaced with actual values. At run-time, the actual message based on the exceed_event property of the resource file 181 can be expanded to “CAPACITY USAGE ON HOST dragon4 HAS EXCEEDED 2,344,344,000 BYTES”. Thus, the appropriate values for {0} and {1}, i.e., “dragon4” and “2,344,344,000” bytes, can be replaced at runtime. Though the above example has employed a property definition of the type key=value {0} and {1}, those skilled in the art will appreciate that this is merely an example and the same is not limiting in any manner. Any other type of property definition may be used in the resource file 181, provided that the transformation module 14 is adapted to recognize the format used therein.
Appropriate software modules can be constructed to store and retrieve non-localized message in the XML format. Convert-to-XML code snippet 36 is an example of code arrangements that can be used to invoke the transformation module 14 to convert the non-localizable message 121 into the XML string 38. Those skilled in the art will appreciate that the convert-to-XML code snippet 36 is merely an example and the same is not limiting in any manner.
For example, the object “rd” is a resource descriptor object type used to build the description of the XML-string. In the present example, a string key “exceed_event” is specified first, then a vector with label “values” is used to build an array (vector) of parameter values to be filled in the place-holders ({0} and {1}) of the properties specified in the resource file 181. Hence, the values “dragron4” and “2344344000” are added to the values array. Both keys and values may be fed into the resource descriptior rd. Then, the getXML( ) method of the transformation module 14 is called to generate the XML string having XML string 38 corresponding to the key's and values stored in the rd resource descriptor. The getXML( ) method returns the XML string that can be stored in the database 16 (see
The stored XML string can be accessed by applications as required. Localization code snippet 40 in
As discussed above, the localization processor 10 can be used to store non-localized messages 12 into XML representations that can be stored and accessed later. The stored XML strings can be accessed to generate localized messages in any locale-specific language or format. The localized message in the specific language and format includes the parameter based values of variables in the resource property files. In the above example, the parameter values were the host name, “dragon4,” and the {1} free space had the value “2344344000 bytes”.
Complex messages can contain multiple localizable parameters. Thus, using XML strings to store and represent non-localized complex messages with complex multiple parameters provides an easy and convenient way to generate localized messages without the need for recompiling any source-code. Complex messages can include multiple parameters of different types. For example, a complex message can be: “cost=Your cost on volume {0} is {1,number,currency}. The volume is {2,number,percent} utilized as of {3,date,long}”. This complex message includes parameters of multiple types such as number, currency, percentage, date and long. The above example basically says that parameter 0 is just a text string; parameter 1 is a number which should be formatted as a currency value; parameter 2 is a number is formatted as a percentage; and parameter 3 is a date which is long format. The localized version of this message in the English language would be:
Embodiments of the invention can store a non-localized version of such complex message with multiple and differently typed parameters in XML format as a single database entry, and then retrieve and generate localized versions as required. The user or application using an embodiment of the invention will not have to deal with XML strings, since the embodiment provides transparent access to localized versions.
Constants class 48 shows examples of different data-types that can be handled by the transformation module 14. For example, all JAVA types like LONG, INTEGER, DOUBLE, FLOAT, BIGDECIMAL, BIGINTEGER, etc., are covered. Other types, for example MSG, can be also be included in addition to the JAVA types. Those skilled in the art will appreciate that the types listed above are merely illustrations and the same do not limit the invention in any manner.
Those skilled in the art will appreciate that the above class arrangement applies to an embodiment of the invention, and other class arrangements can also be created in other embodiments of the invention.
Although the embodiments of the invention described above utilize an XML string and XML formats, any other string or format (or combination thereof) could also be utilized, as those skilled in the art would appreciate. For example, an embodiment may use a custom-designed SGML DTD (Standardized Markup Language Document Type Definition) to store the key and translation information.
Another embodiment of the invention stores locale-specific information in an updatable manner. Another embodiment of the invention allows the use of property files and the storing of portable and complex messages with multiple localizable parameters.
Another embodiment of the invention permits the re-use of the objects “rd” and “rd1” by reinitializing the objects with the setDescriptor ( ) with a new key and value, after the getXML( ) call.
Embodiments of the invention are disclosed in circumstances where the localization information is language information or data format conversion information. Other types of information could also be used as localization information, as would be known to one of ordinary skill in the art.
It is noted that the functional blocks illustrated in
The description of the invention is merely exemplary in nature and, thus, variations that do not depart from the gist of the invention are intended to be within the scope of the invention. Such variations are not to be regarded as a departure from the spirit and scope of the invention.