Interface IResourceProvider
Interface for resource provider classes When defined in the Client section of the config file, classes of this type will be loaded as providers for text resources
Namespace: SuperOffice.Globalization
Assembly: SuperOffice.Plugins.dll
Syntax
public interface IResourceProvider
Methods
CanInitialize()
Check if all requirements for initialization have been met.
Declaration
bool CanInitialize()
Returns
Type | Description |
---|---|
bool | true if a subsequent call to Initialized will succeed |
Remarks
For instance, if the provider needs database access, then it should make a fast check inside this method to verify that a valid session is running.
When this method returns true, Initialize() will be called once. If this method returns false, then it will be called repeatedly. High performance in this implementation is essential.GetResource(string)
Returns a string from this provider in the current culture
Declaration
string GetResource(string name)
Parameters
Type | Name | Description |
---|---|---|
string | name | The name of the resource/resource symbol |
Returns
Type | Description |
---|---|
string | The resource string, or null if not found |
GetResource(string, string)
Returns a string from this provider in the specified culture
Declaration
string GetResource(string name, string cultureName)
Parameters
Type | Name | Description |
---|---|---|
string | name | The name of the resource/resource symbol |
string | cultureName | The name of the culture in the form en-US, nb-NO |
Returns
Type | Description |
---|---|
string | The resource string, or null if not found |
GetSupportedLanguages()
Return an array of cultures that this provider has resources for. This method is called once, after Initialize.
Declaration
CultureInfo[] GetSupportedLanguages()
Returns
Type | Description |
---|---|
CultureInfo[] |
Initialize()
Initializes the provider. To improve performance frequently used data should be loaded into memory here.
Declaration
void Initialize()
Remarks
Implementers MUST use the Thread.CurrentThread.CurrentUICulture to determine the culture they are currently servicing. In a multi-threaded international world, there is no reason to expect that two adjacent threads will have the same culture. Static variables implementing any concept that sounds like 'current culture' should excite the deepest suspicion.