What are the pro and cons of having localization files vs hard coded variables in source code?

Posted by corgrath on Stack Overflow See other posts from Stack Overflow or by corgrath
Published on 2010-06-03T14:07:39Z Indexed on 2010/06/03 14:14 UTC
Read the original article Hit count: 255

Filed under:
|
|
|

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?

© Stack Overflow or respective owner

Related posts about java

Related posts about files