Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
DSDP/MTJ/Localization
Contents
JSR 238
Short description:
Priority:
Owner:
Status: Proposed, Outlined
- Proposed:|Accepted: date_here
- Identified|Described|Outlined|Detailed
Community Review: review_date_here
Use Case Description
JSR238 provides API that offers solution to localization issues on CLDC environment. JSR238 declares binary format and folder structure for localization data on limited environment.
When API is present MTJ offers JSR238 editor that can transform localization data to human readable format and back to binary format. MTJ project contains information whether this option is enabled.
Basic Flow
- B1: The user chooses to use MTJ JSR238 format in projects localization.
- B2: The user gets to use JSR238 editor that can be used to manage localization data.
- B3: The user applies data changes.
- B4: Data is packed in JSR238 format on projects work area.
- B5: The user builds application and localization “.res” files are packed to produced JAR file.
Alternate Flows
- Importing localization data from JAR file
- A1: The user defines JAR file that contains JSR238 data.
- A2: Localization data is imported to MTJ projects workspace.
Preconditions
MTJ Project is created.
Used SDK contains JSR238 API.
Postconditions
Project contains generated resource files.
Build project JAR file contains resource files in correct folder structure.
Midlet using JSR238 API can retrieve packed data.
Extension Points
Special Requirements
Additional Information
Comments:
Localize
Priority:
Owner:
Status: Proposed, Outlined
- Proposed:|Accepted: date_here
- Identified|Described|Outlined|Detailed
Community Review: review_date_here
Use Case Description
ResourceBundle class is not available on CLDC configuration. To support String localization we provide MTJ class wizard that generates ResourceBundle like class that offers basic String localization functionalities to CLDC environment. Localization data is stored to properties files.
Properties files naming has special meaning to ResourceHandler class. The format is <basename>_<locale extension>. properties. Locale extension is a string that should match setLocale string ID. First ResourceHandler is searching resources from properties file where locale extension matches with entered locale ID. If there is no such properties file base properties are used.
Basic set of properties files that contain localized strings for base properties, Finnish and English locales:
- Messages.properties
- Messages_fi.properties
- Messages_en.properties
Generated ResourceHandler classes most important methods are
- Public static String getResource(“key”) // returns localized string
- Public static void setLocale(“fi”) // sets used locale
Basic Flow
- B1: The user chooses to use MTJ localization class wizard.
- B2: On wizard the user defines class name, package and base name.
- B3: ResourceHandler class is generated to projects src folder.
- B4: The user creates required property files and enters key value pairs to them.
- B5: The user replaces hard coded Strings with ResourceHandler.getResource(“key”) call.