1
votes

I'm a beginner in Delphi but I need to add multiple other languages support to current application.

Projects->Languages->Add(languages) does not work in my version of Delphi and gives these errors on compiling:

[Error] E1026 File not found: 'vcl\DBLOGDLG.dfm'
[Error] E1026 File not found: 'vcl\DBPWDLG.dfm'

I tried creating my own translation by adding them to [root]/lang/ en.rc , lt.rc, lv.rc Example of lang.rc

STRINGTABLE
BEGIN
    telefon_monitor L"Phone Monitoring"
    koned L"Calls"
    alates L"From"
    kuni L"Until"
    vali_numbrid L"Choose numbers"
    otsi L"Search"
    tolgi L"Translate"
    satted L"Settings"
    salvesta L"Save"
    lisa_rida L"Add row"
END

I have no idea how to read them.

Does anyone have any better idea how to load translations? What I want to do is, read config.ini [language] section and based that display translation from .rc file or some better extensions.

1
This part of the version of Delphi you are using doesn't like paths with spaces in them. See: codenewsfast.com/cnf/thread/0/permalink.thr-ng1883q145 - Brian
You could try to use a fast VCL compoent called TLanguages, you can find it on github! github.com/albertodev01/TLanguages - Alberto Miola
@Brian I saw that too, but no help. After removing spaces I get other error. But it does not matter. Alberto Miola posted TLanguages seems good and not stale. Thank you both of you! :) - MysteriousNothing

1 Answers

0
votes

Could not use github.com/albertodev01/TLanguages on Delphi XE2 which sucks.

I ended up creating a translation.json file and overwrite default values on Application.FormCreate plus made language toggle system

{ "en_EN":{ "hello":"Hello!" },
  "lv_LT":{ "hello":"Hi!" }
}

PS! Parsing nested json in older Delphi is something else.