Sample Code for setting application language:
=============================================
When you set that registry key, Delphi switches language automaticly on startup
if resourcefile <application>.<lang> is available.
unit loc_unit;
interface
function GetAppLanguage:String;
procedure ResetAppLanguage;
procedure SetAppLanguage(sLang:String);
implementation
uses forms, windows, sysutils, registry;
// -------------------------------------------------------------------
const sloc:String='Software\Embarcadero\Locales\';
function GetAppLanguage:String;
begin
Result:= GetLocaleOverride(application.ExeName)
end;
procedure ResetAppLanguage;
var RegistryEntry: TRegistry;
begin
RegistryEntry:= TRegistry.Create(KEY_READ);
try
RegistryEntry.RootKey:= HKEY_CURRENT_USER;
RegistryEntry.Access:= KEY_WRITE;
RegistryEntry.OpenKey(sloc,True);
RegistryEntry.DeleteValue(application.ExeName);
finally
RegistryEntry.CloseKey();
FreeAndNil(RegistryEntry)
end;
end;
procedure SetAppLanguage(sLang:String);
var RegistryEntry: TRegistry;
begin
RegistryEntry:= TRegistry.Create(KEY_READ);
try
RegistryEntry.RootKey:= HKEY_CURRENT_USER;
RegistryEntry.Access:= KEY_WRITE;
RegistryEntry.OpenKey(sloc,True);
RegistryEntry.WriteString(application.ExeName, sLang);
finally
RegistryEntry.CloseKey();
FreeAndNil(RegistryEntry)
end;
end;
// -------------------------------------------------------------------
end.