using System;
using System.Diagnostics.CodeAnalysis;
using JetBrains.Annotations;
using Robust.Shared.IoC;
namespace Robust.Shared.Localization
{
///
/// Static convenience wrapper for the .
///
///
///
/// Mirrors the API of , but statically.
/// This makes it more convenient to use.
///
///
/// This API follows the same thread locality requirements as
///
///
[PublicAPI]
public static class Loc
{
private static ILocalizationManager LocalizationManager => IoCManager.Resolve();
///
/// Gets a language appropriate string represented by the supplied messageId.
///
/// Unique Identifier for a translated message.
///
/// The language appropriate message if available, otherwise the messageId is returned.
///
public static string GetString(string messageId)
{
return LocalizationManager.GetString(messageId);
}
[Obsolete("Use ILocalizationManager")]
public static bool TryGetString(string messageId, [NotNullWhen(true)] out string? message)
{
return LocalizationManager.TryGetString(messageId, out message);
}
///
/// Version of that supports arguments.
///
public static string GetString(string messageId, params (string,object)[] args)
{
return LocalizationManager.GetString(messageId, args);
}
[Obsolete("Use ILocalizationManager")]
public static bool TryGetString(
string messageId,
[NotNullWhen(true)] out string? value,
params (string, object)[] args)
{
return LocalizationManager.TryGetString(messageId, out value, args);
}
}
}