Solved

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

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
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…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

760 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

18 Experts available now in Live!

Get 1:1 Help Now