[JEDI.NET-commits] main/run Jedi.System.FrameworkResources.pas,NONE,1.1
Status: Pre-Alpha
Brought to you by:
jedi_mbe
|
From: Marcel B. <jed...@us...> - 2005-01-23 11:03:34
|
Update of /cvsroot/jedidotnet/main/run In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9343/main/run Added Files: Jedi.System.FrameworkResources.pas Log Message: Added static class to access resource strings from the mscorlib and System assemblies. --- NEW FILE: Jedi.System.FrameworkResources.pas --- {--------------------------------------------------------------------------------------------------- The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/MPL-1.1.html Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See the License for the specific language governing rights and limitations under the License. The Original Code is: Jedi.System.FrameworkResources.pas, released on 2005-01-23. The Initial Developer of the Original Code is Marcel Bestebroer Portions created by Marcel Bestebroer are Copyright (C) 2004 Marcel Bestebroer All Rights Reserved. Contributor(s): You may retrieve the latest version of this file at the JEDI.NET home page, located at http://sf.net/projects/jedidotnet Known Issues: ---------------------------------------------------------------------------------------------------} // $Id: Jedi.System.FrameworkResources.pas,v 1.1 2005/01/23 11:03:16 jedi_mbe Exp $ unit Jedi.System.FrameworkResources; interface {$REGION 'interface uses'} uses Jedi.System.SourceVersioning, System.Globalization, System.Resources; {$ENDREGION} {$REGION 'mscorlib resources'} type [JediSourceInfo('$Header: /cvsroot/jedidotnet/main/run/Jedi.System.FrameworkResources.pas,v 1.1 2005/01/23 11:03:16 jedi_mbe Exp $')] MscorlibResources = class sealed (&Object) {$REGION 'Constructors'} strict private class constructor Create; strict protected constructor Create; {$ENDREGION} {$REGION 'Data'} strict private class var rm: ResourceManager; {$ENDREGION} {$REGION 'String retrieval'} public class function GetResourceString(id: string): string; overload; static; class function GetResourceString(culture: CultureInfo; id: string): string; overload; static; class function GetResourceString(id: string; arg0: &Object): string; overload; static; class function GetResourceString(culture: CultureInfo; id: string; arg0: &Object): string; overload; static; class function GetResourceString(id: string; arg0, arg1: &Object): string; overload; static; class function GetResourceString(culture: CultureInfo; id: string; arg0, arg1: &Object): string; overload; static; class function GetResourceString(id: string; arg0, arg1, arg2: &Object): string; overload; static; class function GetResourceString(culture: CultureInfo; id: string; arg0, arg1, arg2: &Object): string; overload; static; class function GetResourceString(id: string; args: array of &Object): string; overload; static; class function GetResourceString(culture: CultureInfo; id: string; args: array of &Object): string; overload; static; {$ENDREGION} end; {$ENDREGION} {$REGION 'System resources'} type [JediSourceInfo('$Header: /cvsroot/jedidotnet/main/run/Jedi.System.FrameworkResources.pas,v 1.1 2005/01/23 11:03:16 jedi_mbe Exp $')] SystemResources = class sealed (&Object) {$REGION 'Constructors'} strict private class constructor Create; strict protected constructor Create; {$ENDREGION} {$REGION 'Data'} strict private class var rm: ResourceManager; {$ENDREGION} {$REGION 'String retrieval'} public class function GetResourceString(id: string): string; overload; static; class function GetResourceString(culture: CultureInfo; id: string): string; overload; static; class function GetResourceString(id: string; arg0: &Object): string; overload; static; class function GetResourceString(culture: CultureInfo; id: string; arg0: &Object): string; overload; static; class function GetResourceString(id: string; arg0, arg1: &Object): string; overload; static; class function GetResourceString(culture: CultureInfo; id: string; arg0, arg1: &Object): string; overload; static; class function GetResourceString(id: string; arg0, arg1, arg2: &Object): string; overload; static; class function GetResourceString(culture: CultureInfo; id: string; arg0, arg1, arg2: &Object): string; overload; static; class function GetResourceString(id: string; args: array of &Object): string; overload; static; class function GetResourceString(culture: CultureInfo; id: string; args: array of &Object): string; overload; static; {$ENDREGION} end; {$ENDREGION} implementation {$REGION 'MscorlibResources'} class constructor MscorlibResources.Create; begin rm := ResourceManager.Create('mscorlib', TypeOf(System.String).Assembly); end; constructor MscorlibResources.Create; begin inherited Create; end; class function MscorlibResources.GetResourceString(id: string): string; begin Result := GetResourceString(CultureInfo.CurrentCulture, id); end; class function MscorlibResources.GetResourceString(culture: CultureInfo; id: string): string; begin Result := rm.GetString(id, culture); end; class function MscorlibResources.GetResourceString(id: string; arg0: &Object): string; begin Result := System.String.Format(GetResourceString(CultureInfo.CurrentCulture, id), arg0); end; class function MscorlibResources.GetResourceString(culture: CultureInfo; id: string; arg0: &Object): string; begin Result := System.String.Format(GetResourceString(culture, id), arg0); end; class function MscorlibResources.GetResourceString(id: string; arg0, arg1: &Object): string; begin Result := System.String.Format(GetResourceString(CultureInfo.CurrentCulture, id), arg0, arg1); end; class function MscorlibResources.GetResourceString(culture: CultureInfo; id: string; arg0, arg1: &Object): string; begin Result := System.String.Format(GetResourceString(culture, id), arg0, arg1); end; class function MscorlibResources.GetResourceString(id: string; arg0, arg1, arg2: &Object): string; begin Result := System.String.Format(GetResourceString(CultureInfo.CurrentCulture, id), arg0, arg1, arg2); end; class function MscorlibResources.GetResourceString(culture: CultureInfo; id: string; arg0, arg1, arg2: &Object): string; begin Result := System.String.Format(GetResourceString(culture, id), arg0, arg1, arg2); end; class function MscorlibResources.GetResourceString(id: string; args: array of &Object): string; begin Result := System.String.Format(GetResourceString(CultureInfo.CurrentCulture, id), args); end; class function MscorlibResources.GetResourceString(culture: CultureInfo; id: string; args: array of &Object): string; begin Result := System.String.Format(GetResourceString(culture, id), args); end; {$ENDREGION} {$REGION 'SystemResources'} class constructor SystemResources.Create; begin rm := ResourceManager.Create('System', TypeOf(Uri).Assembly); end; constructor SystemResources.Create; begin inherited Create; end; class function SystemResources.GetResourceString(id: string): string; begin Result := GetResourceString(CultureInfo.CurrentCulture, id); end; class function SystemResources.GetResourceString(culture: CultureInfo; id: string): string; begin Result := rm.GetString(id, culture); end; class function SystemResources.GetResourceString(id: string; arg0: &Object): string; begin Result := System.String.Format(GetResourceString(CultureInfo.CurrentCulture, id), arg0); end; class function SystemResources.GetResourceString(culture: CultureInfo; id: string; arg0: &Object): string; begin Result := System.String.Format(GetResourceString(culture, id), arg0); end; class function SystemResources.GetResourceString(id: string; arg0, arg1: &Object): string; begin Result := System.String.Format(GetResourceString(CultureInfo.CurrentCulture, id), arg0, arg1); end; class function SystemResources.GetResourceString(culture: CultureInfo; id: string; arg0, arg1: &Object): string; begin Result := System.String.Format(GetResourceString(culture, id), arg0, arg1); end; class function SystemResources.GetResourceString(id: string; arg0, arg1, arg2: &Object): string; begin Result := System.String.Format(GetResourceString(CultureInfo.CurrentCulture, id), arg0, arg1, arg2); end; class function SystemResources.GetResourceString(culture: CultureInfo; id: string; arg0, arg1, arg2: &Object): string; begin Result := System.String.Format(GetResourceString(culture, id), arg0, arg1, arg2); end; class function SystemResources.GetResourceString(id: string; args: array of &Object): string; begin Result := System.String.Format(GetResourceString(CultureInfo.CurrentCulture, id), args); end; class function SystemResources.GetResourceString(culture: CultureInfo; id: string; args: array of &Object): string; begin Result := System.String.Format(GetResourceString(culture, id), args); end; {$ENDREGION} end. |