Show / Hide Table of Contents

Class Res

Used to get localized values from the language resource file.

Inheritance
System.Object
Res
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: FastReport.Utils
Assembly: FastReport.OpenSource.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 (*.frl).

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

CopyTo(Stream, Stream)

Declaration
public static void CopyTo(Stream input, Stream output)
Parameters
Type Name Description
System.IO.Stream input
System.IO.Stream output

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".

GetBuiltin(String)

Get builtin string.

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

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.

TryGetBuiltin(String)

Tries to get builtin string with specified ID.

Declaration
public static string TryGetBuiltin(string id)
Parameters
Type Name Description
System.String id
Returns
Type Description
System.String
Back to top Generated by DocFX