Setting up website to display multiple language translations
Posted on 2014-07-28
I have a multi-language website setup to work something like this:
1. Each ASP page (or HTM page running as ASP on the server) has an include file that handles the translations
2. The include file determines the language of the user based on their login ID
3. A database table holds all of the language translations, which are organized by the page displaying the text
4. The script pulls in all of the translations that are relevant to the page calling the script, and populates an ASP dictionary object
5. The page itself then displays the translations by writing the contents of the dictionary object in the appropriate place in the markup, which looks like this:
<div id="example"><% =t.item("text_placeholder") %></div>
This has worked well for several years. But one of the issues is that we are ending up translating the same things multiple times. This site has a lot of little, intricate translations positioned throughout the markup, rather than just a few large, paragraph-format translations. So common translations such as "submit now", "first name", "continue", "January", "February", "Monday", "Tuesday", etc. are a hassle for the people who are handling the translations.
When I designed the system, I wanted to populate as few Dictionary entries as possible. There are dozens of pages in the site, so I didn't want to populate 500 translations when only 12 are needed for a given page. It is my understanding that these objects are held directly in system memory on the server, so that just sounds like a waste of system resources.
Now, my client (who uses the system and handles the actual translations) thinks having it broken up into multiple pages is too cumbersome to maintain. So I could just as easily populate every translation that exists into the Dictionary object, then they would all be available, whether they are used or not.
I don't know what effect that would have on performance, on the server, etc. Perhaps none!
I am looking at how WordPress handles translations, I don't know if what they are doing would be considered Best Practices in this case or not. But as far as I know, when you call a request for a translation, it is readily available (i.e., its already been pulled from the database?). So they are populating their translation object with everything in the system ahead of time?
Since it is all text, maybe the server load issue isn't that big a deal, it just sounds like overkill to pre-load that much data that you aren't going to use at all.
Anyway, would really appreciate any advice on how best to proceed.