Solved

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

Posted on 2006-06-16
2
422 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
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…

815 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

12 Experts available now in Live!

Get 1:1 Help Now