wojta 0 Report post Posted April 20, 2006 Hi guys, what is the best option for delphi if I want to change languages on fly in my applications?thxWojta Share this post Link to post Share on other sites
Chesso 0 Report post Posted June 8, 2006 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=ExitMyButton2=Openetc...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 http://forums.xisto.com/no_longer_exists/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. Share this post Link to post Share on other sites
miCRoSCoPiC^eaRthLinG 0 Report post Posted June 8, 2006 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 Share this post Link to post Share on other sites
Chesso 0 Report post Posted June 8, 2006 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. Share this post Link to post Share on other sites