Search Results for

    Show / Hide Table of Contents

    Class Res

    Used to get localized values from the language resource file.

    Inheritance
    System.Object
    Res
    Namespace: FastReport.BG.Utils
    Assembly: FastReport.BG.dll
    Syntax
    public static class Res
    Remarks

    The resource file used by default is english. To load another locale, call the LoadLocale(String) method. It should be done at application start before you use any FastReport classes.

    Properties

    LocaleFolder

    Gets or set the folder that contains localization files (*.fcl).

    Declaration
    public static string LocaleFolder { get; set; }
    Property Value
    Type Description
    System.String

    LocaleName

    Returns the current UI locale name, for example "en".

    Declaration
    public static string LocaleName { get; }
    Property Value
    Type Description
    System.String

    Methods

    Get(String)

    Gets a string with specified ID.

    Declaration
    public static string Get(string id)
    Parameters
    Type Name Description
    System.String id

    The resource ID.

    Returns
    Type Description
    System.String

    The localized string.

    Remarks

    Since the locale file is xml-based, it may contain several xml node levels. For example, the file contains the following items:

    <Objects>
      <Report Text="Report"/>
      <Bands Text="Bands">
        <ReportTitle Text="Report Title"/>
      </Bands>
    </Objects>

    To get the localized "ReportTitle" value, you should pass the following ID to this method: "Objects,Bands,ReportTitle".

    GetIcon(String, Int32)

    Gets an image with specified index and converts it to Icon.

    Declaration
    public static Icon GetIcon(string resName, int index)
    Parameters
    Type Name Description
    System.String resName
    System.Int32 index

    Image index (zero-based).

    Returns
    Type Description
    System.Drawing.Icon

    The Icon object.

    GetImage(String, Int32)

    Gets an image with specified index.

    Declaration
    public static Bitmap GetImage(string resName, int index)
    Parameters
    Type Name Description
    System.String resName
    System.Int32 index

    Image index (zero-based).

    Returns
    Type Description
    System.Drawing.Bitmap

    The image with specified index.

    Remarks

    FastReport contains about 240 truecolor images of 16x16 size that are stored in one big image side-by-side. This image can be found in FastReport resources (the "buttons.png" resource).

    GetImages(String)

    Gets the standard images used in FastReport as an ImageList.

    Declaration
    public static ImageList GetImages(string resName)
    Parameters
    Type Name Description
    System.String resName
    Returns
    Type Description
    System.Windows.Forms.ImageList

    ImageList object that contains standard images.

    Remarks

    FastReport contains about 240 truecolor images of 16x16 size that are stored in one big image side-by-side. This image can be found in FastReport resources (the "buttons.png" resource).

    LoadEnglishLocale()

    Loads the english locale.

    Declaration
    public static void LoadEnglishLocale()

    LoadLocale(Stream)

    Loads the locale from a stream.

    Declaration
    public static void LoadLocale(Stream stream)
    Parameters
    Type Name Description
    System.IO.Stream stream

    The stream that contains localized strings.

    LoadLocale(String)

    Loads the locale from a file.

    Declaration
    public static void LoadLocale(string fileName)
    Parameters
    Type Name Description
    System.String fileName

    The name of the file that contains localized strings.

    Set(String, String)

    Replaces the specified locale string with the new value.

    Declaration
    public static void Set(string id, string value)
    Parameters
    Type Name Description
    System.String id

    Comma-separated path to the existing locale string.

    System.String value

    The new string.

    Remarks

    Use this method if you want to replace some existing locale value with the new one.

    Examples
    Res.Set("Messages,SaveChanges", "My text that will appear when you close the designer");

    StringExists(String)

    Checks if specified ID exists.

    Declaration
    public static bool StringExists(string id)
    Parameters
    Type Name Description
    System.String id

    The resource ID.

    Returns
    Type Description
    System.Boolean

    true if specified ID exists.

    TryGet(String)

    Tries to get a string with specified ID.

    Declaration
    public static string TryGet(string id)
    Parameters
    Type Name Description
    System.String id

    The resource ID.

    Returns
    Type Description
    System.String

    The localized value, if specified ID exists; otherwise, the ID itself.

    Back to top © 2021-2022 Copyright Fast Reports Inc.