My project should support different languages for the GUI (spanish, english, german, etc). I'm using CodeIgniter, so I haven't got any problem with PHP views using Language Class. I can load some previously defined vars on PHP to create views in different languages.
The problem comes here:
Some features (a lot of them actually) use Javascript: personalized context menu for some items, differents DIVs created dynamically, etc. The most of this features are created dynamically, so I can't know the language selected (I can create a lot of duplicated code, one for each language, but this is too redundant).
I need to find a way to translate this content into the new language previously selected by user.
For example:
The user right-click and the context menu have the following options (created dynamically using Javascript):
- Hi
- Goodbye
When the user change the page language to 'Spanish', the context menu should show:
- Hola
- Adios
Is there any way to save some variables with all the names in different languages, and then load to create the menus?
Sorry for the big post. I hope everyone can help me or bring me a little tip.