1

I'm looking for a solution to change the language at runtime. (Firemonkey / Delphi)

TLang works, but I get weird strings in an empty project. (e.g. Samsung Galaxy Nexus and other mobile stuff) And I prefer another solution and not string-replace like TLang.

Unfortunately, resourcestring doesn't work. I tried to translate the resourcestrings with "resource dll expert" (IDE RAD Studio XE5). And the example application "RichEdit" also doesn't work.

Any idea?

conanmichi
  • 53
  • 1
  • 8

2 Answers2

1

Okay I found the problem, why it isn't running. The tool have some bugs. The path to the Project.exe can not contain spaces.

Another solution is Stringtable like this:

// default.rc file

#define firstString 1
#define secondString 2

STRINGTABLE
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
BEGIN
 firstString , "Neutral String 1"
 secondString , "Neutral String 2"
END

// english.rc file

#define firstString 1
#define secondString 2

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
BEGIN
 firstString , "First String"
 secondString , "Second String"
END

And than {$R default.res default.rc} {$R english.res english.rc} into the *.pas file. To use the transalation: LoadStr(2)

With an resource-editor, I can see the two languages. But how I can change the default/neutral to another language at runtime. Is there a kind of "SetLanguage" function in Delphi?

conanmichi
  • 53
  • 1
  • 8
0

For simple projects TLang works fine, but the included "Language Designer" (doubleclick on the TLang component) is not much fun.
If you want to translate and handle your strings extern you only can import external languages files one by one and have to import all again, if some texts change.
I wrote a small tool to handle texts extern in a spreadsheet and convert this texts to the LNG format: See TLang converter
For large projects you may also check out some commercial products for translating/localization of Delphi FMX projects like:
http://www.sisulizer.de
http://www.tsilang.com
http://www.regulace.org

BitBumper
  • 369
  • 1
  • 10
  • Why when I try writing tranlations texts in 'Language Designer' after writing two letter language code and click in 'Add' button not show Edit Text to write the appropriate translations?? – KryNaC Jul 27 '16 at 11:34