| | Hi guys, what is the best option for delphi if I want to change languages on fly in my applications? thx Wojta |
| Nov 23, 2009 |
Ummm if you mean like the language your'e button captions etc are in I would suggest using simple text files with all the text for your application that you load on application start and can simply change in a function if users want to load another language for the interface. Let's say English is the default and in your Languages directory you have a file called English.txt, if you have an option available to use say Chinese you would simply have a file called Chinese.txt that your program reads in and changes all the button captions etc to reflect this. Remember well though that this could pose a problem if text in English already takes up most of a controls width space as some words in other languages are fairly larger. As for the text file structure for the languages you could either have everything in certain order or just have identification such as: MyButton1=Exit MyButton2=Open etc... When reading in would simply check the left N characters of the line and check to see if it's for example MyButton1= so you know exactly what it is for if it does find it, then use the AnsiMidStr function to grab the text from = onwards. Hope this helps. P.S. Additionally you could visit www.delphipages.com/threads and make a post there, there is tons of experts who could help you with this and i'm sure could recomment some nice components that could make this easier for you if that's what you want.
Isn't there any pre-defined class in Delphi that defines the CurrentLocale and CurrentCulture ?? If you have them - then surely the tools to switch language are built in too.
In any case, you'd have to create a text file as Chesso pointed out - similar copy of the same file for each language you wish to include in your package. Thing is - if those classes are prebuilt - then you don't need to look for MyButton= manually.. rather the word MyButton in the textfile will act as a variable and the compiler will do the job of finding it in the text file for you. You simply call it as MyButton and the associated text will be returned. The same can be done in .NET - I'd written an article on this quite sometime back.. It can be found here: VB.NET: Switch Regional Language Automatically
Delphi has built in support for building a multi lingual application but iv'e never used it to be honest so I'm really not sure on how it works and whether it's the right thing but it might be worth a try.
Similar Topics
Keywords : change, language, fly, delphi, 5, 8
(2) My old Delphi 4 will not run on an XP system. Does Delphi 6 run in an XP environment and/or will an Low-level / Pascal / Delphi / Keyboard input simulation (4) I'm trying to simulate a key press in an external program (actually a game). Using the (2) I am about to start a project that will require me to write a client program which will access a (1) Somebody knows some component delphi that I allow to use skin in my application? If possible that he delphi 6 would be prefered (4) simple question: how to upload files using delphi, using http protokol that will be received by php Delphi 7.0 Personal (11) Hi, I've just purcased Borland Delphi 7.0 Personal, as I've have an idea to an publication (3) Code Insight Code Parameters : Ctrl-Shift-Space Code Completion : Ctrl-Space Code Looking for change, language, fly, delphi, 5, 8
|
![]() Help: Change Language On Fly With Delphi - delphi 5-8 |
Affordable Web Hosting, Low cost Web Hosting - ComputingHost.com