1.
There was sample project (shipped with Delphi) called RichEdit
which had run-time change of language. To achieve that, Reinit
unit was used (you can take it from here) which actually reloads all the resources.
It's working normally on simple programs like that, but may be real pain to implement in something more complex, as all the controls on form are reverted to initial state in which they have been at start-up, so it's your responsibility to keep your data consistent.
Though in proper implementation where all the application logic is separated from GUI (so there are no vars on TForm
, no storing user data in edit boxes etc), it should work normally.
See RichEdit
sample's source code to understand how to use Reinit.pas
2.
The classical approach is to use ResourceString
. In interface section of your unit or better in separate unit, write:
ResourceString
ChangeLanguageStr = 'Zmieniłeś język';
//another strings here
and for showing message:
ShowMessage(ChangeLanguageStr);
These strings will be shown in translation manager.