Lingobit Localizer - Software Localization ToolTools for software Localization DE | DA | FR | ES | IT | JA | NL | PL | PT | RU | TR | ZH
 
Software Localization
 

Lingobit Home > Lingobit Extractor
Lingobit Extractor

How to extract Java hard-coded strings from source code to resources

How to extract Java hard-coded strings to resourcesLingobit Extractor extracts hard-coded strings from Java source code to .properties files. It is most commonly used solution to store Java resources and prepare application for localization.

By default Lingobit Extractor replaces string with a call to getText function, that incapsulates loading of resource string for current locale. Extracted string is stored into .properties file.

Code replace templates

There are several replace templates for Java source code.

$(WRAPPERCLASS).getString("$(ID)")
Get string using automatically generated Resource Bundle wrapper. You can customize wrapper generation at "Resource Wrapper" page.

ResourceBundle.getBundle("$(RESNAME)").getString("$(ID)")
Loads ResourceBundle and gets string from it. Use of this template doesn't require any additional code changes.

getString("$(ID)")
Use custom-defined 'getString' method to load strings. It is recommended name for custom function.

Step by Step

Here are the steps to extract hardcoded strings from Java source code and prepare your application for localization

  1. Make getText function visible in all files you are going to modify
  2. Create Lingobit Extractor project and add you source files into it
  3. Add existing .properties file or create new one.
  4. Review and extract hard-coded strings
  5. Save the changes