#nullable enable
using System.Collections;
using System.Globalization;
using System.Resources;
namespace Terminal.Gui.Resources;
///
/// Provide static access to the ResourceManagerWrapper
///
public static class GlobalResources
{
private static readonly ResourceManagerWrapper _resourceManagerWrapper;
static GlobalResources ()
{
// Initialize the ResourceManagerWrapper once
var resourceManager = new ResourceManager (typeof (Strings));
_resourceManagerWrapper = new (resourceManager);
}
///
/// Looks up a resource value for a particular name. Looks in the specified CultureInfo, and if not found, all parent
/// CultureInfos.
///
///
///
/// Null if the resource was not found in the current culture or the invariant culture.
public static object GetObject (string name, CultureInfo culture = null!) { return _resourceManagerWrapper.GetObject (name, culture); }
///
/// Looks up a set of resources for a particular CultureInfo. This is not useful for most users of the ResourceManager
/// - call GetString() or GetObject() instead. The parameters let you control whether the ResourceSet is created if it
/// hasn't yet been loaded and if parent CultureInfos should be loaded as well for resource inheritance.
///
///
///
///
///
public static ResourceSet? GetResourceSet (CultureInfo culture, bool createIfNotExists, bool tryParents)
{
return _resourceManagerWrapper.GetResourceSet (culture, createIfNotExists, tryParents)!;
}
///
/// Looks up a set of resources for a particular CultureInfo. This is not useful for most users of the ResourceManager
/// - call GetString() or GetObject() instead. The parameters let you control whether the ResourceSet is created if it
/// hasn't yet been loaded and if parent CultureInfos should be loaded as well for resource inheritance. Allows
/// filtering of resources.
///
///
///
///
///
///
public static ResourceSet? GetResourceSet (CultureInfo culture, bool createIfNotExists, bool tryParents, Func? filter)
{
return _resourceManagerWrapper.GetResourceSet (culture, createIfNotExists, tryParents, filter)!;
}
///
/// Looks up a resource value for a particular name. Looks in the specified CultureInfo, and if not found, all parent
/// CultureInfos.
///
///
///
/// Null if the resource was not found in the current culture or the invariant culture.
public static string GetString (string name, CultureInfo? culture = null!) { return _resourceManagerWrapper.GetString (name, culture); }
}