Nov 23, 2009

Help: Change Language On Fly With Delphi - delphi 5-8

free web hosting
Open Discussion & Free Web Hosting > Computers & Tech > Programming > Programming General > Delphi & (Object) Pascal

Help: Change Language On Fly With Delphi - delphi 5-8

wojta
Hi guys, what is the best option for delphi if I want to change languages on fly in my applications?

thx

Wojta

Comment/Reply (w/o sign-up)

Chesso
Can't believe I missed this post sorry.

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.

 

 

 


Comment/Reply (w/o sign-up)

miCRoSCoPiC^eaRthLinG
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

Comment/Reply (w/o sign-up)

Chesso
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.

Comment/Reply (w/o sign-up)


Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

This textarea will convert to Rich-Text automatically (IE, Firefox, Chrome)

Similar Topics

Keywords : change, language, fly, delphi, 5, 8

  1. Hide Delphi's Splash Screen - Delphi 6
    (0)
  2. Delphi 6 And XP
    (2)
    My old Delphi 4 will not run on an XP system. Does Delphi 6 run in an XP environment and/or will an
    application developed in Delphi 6 run in an XP environment?....
  3. Keyboard Simulation
    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
    keybd_event does work for regular Windows programs (like Notepad, for example), but not for the
    game. I suppose this happens because it uses DirectX libraries, and also this simulation provided by
    keybd_event isn't, let's say, low-level enough. Would someone be able to help me on this?
    I'm using currently Delphi (Pascal), but if needed I suppose I can manage to apply some assembly
    code or something. Thanks in advance.....
  4. Can Delphi Be Used For Distributed Appz?
    (2)
    I am about to start a project that will require me to write a client program which will access a
    database (mysql) across the internet. Will Delphi 2006 Professional have the tools I need to do
    this, or will I need to get Enterprise or Architect. Note that we are not planning on using model
    driven architecture in this project, so buying Enterprise or Architect for Bold or ECO isn't
    required. Thanks wojta....
  5. Where Can I Find Free Skin Component For Delphi
    (1)
    Somebody knows some component delphi that I allow to use skin in my application? If possible that he
    is free.....
  6. Uploading File Using Delphi To A Php Upload Script
    delphi 6 would be prefered (4)
    simple question: how to upload files using delphi, using http protokol that will be received by php
    script ? ex: delphi ---------------> www.giveittome.com/whereisit.php thanks Oncom Beureum....
  7. Resources For Beginner Delphi Programmer ?
    Delphi 7.0 Personal (11)
    Hi, I've just purcased Borland Delphi 7.0 Personal, as I've have an idea to an publication
    that I wish to create. But I seemed much more complicated than I was expected. I've been
    working with webdesigning for several years, and also PHP programming, but never worked with any
    core programming applications like this. My question is as follow. Do anyone have any expirence
    about Delphi, and do any knows where to find turtorials or even better samples, as I really like to
    try this out and then further as it looks funny and cool. My application idea is somethi....
  8. List Of Delphi Keyboard Shortcut - Very Useful
    (3)
    Code Insight Code Parameters : Ctrl-Shift-Space Code Completion : Ctrl-Space Code
    Templates : Ctrl-J Class Completion Class Completion : Ctrl-Shift-C Class Nav
    Up Ctrl-Shift-Up Class Nav Down Ctrl-Shift-Down Code Browsing (D6 and above) Symbol Browsing :
    Alt-Up Browse Forward : Alt-Right Browse Backward : Alt-Left Message Window Previous
    Message : Alt-F7 Next Message : Alt-F8 IDE Windows Code Explorer : Ctrl-Shift-E Project
    Manager : Ctrl-Alt-F11 Window List : Alt-0 (zero) Object Inspector : F11 Debugger Windows
    Event Log :....

    1. Looking for change, language, fly, delphi, 5, 8

See Also,

*SIMILAR VIDEOS*
Searching Video's for change, language, fly, delphi, 5, 8
advertisement



Help: Change Language On Fly With Delphi - delphi 5-8

Affordable Web Hosting, Low cost Web Hosting - ComputingHost.com