views:

52

answers:

2

i.e. Multi-language messages, screen captions, currency/date formats, etc.

+1  A: 

This depends on the application.

If it's a single-user desktop application, you probably want to use locale-aware functions wherever possible and use gettext or other popular system for translations. You only initialize them at startup, then.

Things get very complicated when it's a multi-user application, such as a web application -- you need to support different locales/language per request or user session, so you probably need to pass that information around in your request object.

Radomir Dopieralski
yes, single-user app, currently in spanish. should I create separate tables for messages, captions, GLS environment variables and lookup these tables, based on a language-id column?
Frank Computer
If it's just translations, then go ahead and use gettext. Initialize it somewhere at the beginning to have the `_` function/macro defined, and use that to mark all the strings that require translation. Make sure to put values outside of them, like so: printf(_("Hello %s!"), world);Gettext has tools for extracting the strings for translation automatically and compiling them to `.mo` files, which you can ship with your application.
Radomir Dopieralski
+1  A: 

Hi Frank, I'm using nopCommerce which has a very simple configuration table that is a dictionary using language/name/value tuples here's an example:

English Account.AddBillingAddress Add billing address English Account.AddShippingAddress Add shipping address
English Account.AdminApprovalRequired Your account will be activated after approving by administrator.
English Account.Administration Administration

All stored in one table so rather than having a caption table you would have caption.myfirstpicure

The text is then retrieved by a function that gets the value for the name from a dictionary loaded in memory. I think it's simple and even elegant

MikeAinOz