What are the pro and cons of having localization files vs hard coded variables in source code?
- by corgrath
Definitions:
Files:
Having the localization phrases stored in a physical file that gets read at application start-up and the phrases are stored in the memory to be accessed via util-methods. The phrases are stored in key-value format. One file per language.
Variables:
The localization texts are stored as hard code variables in the application's source code. The variables are complex data types and depending on the current language, the appropriate phrase is returned.
Background:
The application is a Java Servlet and the developers use Eclipse as their primary IDE.
Some brief pro and cons:
Since Eclipse is use, tracking and finding unused localizations are easier when they are saved as variables, compared to having them in a file. However the application's source code becomes bigger and bloated.
What are the pro and cons of having localization text in files versus hard coded varibles in source code? What do you do and why?