From a performance and memory point of view, what is the best practice regarding localization properties files?
A few large files or many small files?
Use properties files or compiled property class files?
Example scenario:
I have an application with about 150 .jsp files.
Each jsp files uses between 5 and 50 keys.
The total number of keys is 1500.
Each key is translated into 25 languages.
I imagine four solutions:
1) Use a few but large properties files (e.g. files like: 'Bundle_da.properties')
have 25 properties files with 1500 keys in each.
All the 150 .jsp files includes the same properties file.
In this way, all .jsp files will include all 1500 keys of which it may only use 5 to 50 keys.
2) Use a few but large properties class files (e.g. 'public class Bundle_da extends ListResourceBundle...')
have 25 classes with 1500 keys in each.
All the 150 .jsp files includes the same class.
In this way, all .jsp files will include all 1500 keys of which it may only use 5 to 50 keys.
3) Use many but small properties files
Each .jsp files will only includes the keys needed for that specific file.
The number of properties files will be 150 x 25 = 3750
In this way, all .jsp files will only include the key that are actualy used. (i.e. 5 to 50 keys).
4) Use .jsp specific properties clases.
Each .jsp specific bundle class will only includes the keys needed for that specific .jsp file.
The number of properties clases will be 150 x 25 = 3750
In this way, all .jsp files will only include the key that are actualy used. (i.e. 5 to 50 keys).
Two questions:
From a performance perspective, which of the 4 solutions is the prefered solution?
From a memory perspective, which of the 4 solutions allocates less memory on the web server?
Thank you in advance
Allan
We have a largish desktop application. Any text messages that are designed for end user consumption are wrapped in some markup within the code. A perl script scans all the *.C files and extracts the marked strings to generate the .po files, it also extracts strings from the rsc file. We end up with two .po files, one for the .C strings and another for the .rsc strings. In all there are some 16,000 strings, the .po files are converted to .mo files for each language, and each .mo file is about 600K so 1.2Mb per language.
Your situation maybe different but we've never had cause for concern over file sizes. My concern would be to reduce the complexity of the localisation subsystem. For example in our case I'd rather have our translators to fill in the blanks in two .po files than the 100s of files that might contain end user text messages.
NOTE the .po files are about 400K each.