Table of Contents

Class Res

Namespace: FastReport.Olap.Utils
Assembly: FastCube.Core.dll

Used to get localized values from the language resource file.

public static class Res

Inheritance

objectRes

Remarks

The resource file used by default is english. To load another locale, call the FastReport.Olap.Utils.Res.LoadLocale(System.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).

public static string LocaleFolder { get; set; }

Property Value

string

LocaleName

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

public static string LocaleName { get; }

Property Value

string

Methods

Get(string)

Gets a string with specified ID.

public static string Get(string id)

Parameters

id string

The resource ID.

Returns

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

LoadEnglishLocale()

Loads the english locale.

public static void LoadEnglishLocale()

LoadLocale(string)

Loads the locale from a file.

public static void LoadLocale(string fileName)

Parameters

fileName string

The name of the file that contains localized strings.

LoadLocale(Stream)

Loads the locale from a stream.

public static void LoadLocale(Stream stream)

Parameters

stream Stream

The stream that contains localized strings.

Set(string, string)

Replaces the specified locale string with the new value.

public static void Set(string id, string value)

Parameters

id string

Comma-separated path to the existing locale string.

value string

The new string.

Examples

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

Remarks

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

StringExists(string)

Checks if specified ID exists.

public static bool StringExists(string id)

Parameters

id string

The resource ID.

Returns

bool

true if specified ID exists.

TryGet(string)

Tries to get a string with specified ID.

public static string TryGet(string id)

Parameters

id string

The resource ID.

Returns

string

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