Skip to Content
Former Member
Jun 16, 2009 at 02:28 PM

Reading and comparing name of the files in Mimes folder


Hi All

I have an application which supports internationalization.

This application has some HTML files in different languages and are displayed in a view in HTMLContainer. All these files are placed in mimes --> Components --> Application Package folder.

Logic used to retrieve the files is as below:

1. Get the user login language. Lets take the languages as A, B, C, ............


If (language A)


Pick HTML_A file.

} else

If (language B)


Pick HTML_B file.


If (language C)


Pick HTML_C file.


Application is working fine till here.

Now,we are planning to extend the support for 20 more languages.

Addition of these many languages will create un-necessary if-else ladder. Same will be the case even if we use switch statement.

To deal with this we decided to keep the name of the file as a static string (HTML_) and to append the language key (A, B, C, ........) later at run time so as to get the full name of the file (HTML_A, HTML_B, .........).

Now, it is quite possible that the user language is different from the languages supported by the application as the name of the HTML file generated (eg. HTML_AB) may not be available and system may throw an error. We will catch this exception and will write the code to pick the HTML files for English language in the catch block of the try-catch.

But this approach does not seem to be working as system is not throwing any error.

Any idea on how to deal with this stuff will be appreciated.


Vineet Vikram