WPLocalLoadVCLStrings Global Variable

Unit
WPLocalize

Declaration
WPLocalLoadVCLStrings : procedure;

Description
This global procedure pointer can be used to add automatic localization for strings which do not belong to a form, such as error messages.
var
  MessageText : string = 'A Message';
  prevWPLocalSaveVCLStrings: procedure;
  prevWPLocalLoadVCLStrings: procedure;


procedure MySaveActionCaptions;
begin
  if Assigned(WPLangSaveString) then
      WPLangSaveString('MYStringA', MessageText, 0);
  if assigned(prevWPLocalSaveVCLStrings) then prevWPLocalSaveVCLStrings;
end;

procedure MyLoadActionCaptions;
var
  s: string;
  a : Integer;
begin
  s := '';
  if Assigned(WPLangLoadString) then
     if WPLangLoadString('MYStringA', s, a) then 
	    MessageText :=  s;
  if assigned(prevWPLocalLoadVCLStrings) then prevWPLocalLoadVCLStrings;
end;

initialization
  prevWPLocalSaveVCLStrings := MyLocalSaveVCLStrings;
  WPLocalSaveVCLStrings := MySaveActionCaptions;

finalization
  WPLocalSaveVCLStrings := prevWPLocalSaveVCLStrings;
  WPLocalLoadVCLStrings := prevWPLocalLoadVCLStrings;
end.


Copyright (C) by WPCUBED GmbH - Munich
http://www.wpcubed.com