Solved

How to switch language in multi-lingual app that uses bds 2006 translation manager

Posted on 2006-06-16
2
421 Views
Last Modified: 2013-12-03
Delphi 2006

I created a simple app with one button on the form, with a caption 'close'. Then I did Project->Languages->Add and added a french language. Then I used the Translation Editor to set the french equivalent of 'close'. Love it. Things couldnt be easier. Now then, in order for me to see that button in french when I run the app, I need to go to Control Panel->Regional And Language Options and switch from English to French. Thats nice too. But, what if I want that button in french to display irregardless of my current language setting. Is there a way to force it. Or better yet, can I change it at run time?
0
Comment
Question by:krupini
2 Comments
 

Author Comment

by:krupini
ID: 16923100
I want the language switching functionality to be buit-in into the app that will override the Regional And Language Options settings.
0
 
LVL 26

Accepted Solution

by:
Russell Libby earned 400 total points
ID: 16923746
From:
http://info.borland.com/techpubs/delphi/delphi5/dg/intapps.html

Hope this helps,
Russell

---

Dynamic switching of resource DLLs

In addition to locating a resource DLL at application startup, it is possible to switch resource DLLs dynamically at runtime. To add this functionality to your own applications, you need to include the ReInit unit in your uses statement. (ReInit is located in the Richedit sample in the Demos directory.) To switch languages, you should call LoadResourceModule, passing the LCID for the new language, and then call ReinitializeForms.

For example, the following code switches the interface language to French:

const

  FRENCH = (SUBLANG_FRENCH shl 10) or LANG_FRENCH;

if LoadNewResourceModule(FRENCH) <> 0 then

  ReinitializeForms;

The advantage of this technique is that the current instance of the application and all of its forms are used. It is not necessary to update the registry settings and restart the application or reacquire resources required by the application, such as logging in to database servers.

When you switch resource DLLs the properties specified in the new DLL overwrite the properties in the running instances of the forms.

Note: Any changes made to the form properties at runtime will be lost. Once the new DLL is loaded, default values are not reset. Avoid code that assumes that the form objects are reinitialized to the their startup state, apart from differences due to localization.


0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now