using System;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using JetBrains.Annotations;
using Robust.Shared.ContentPack;
using Robust.Shared.Serialization;
namespace Robust.Shared.Localization
{
// ReSharper disable once CommentTypo
///
/// Provides facilities to obtain language appropriate in-game text.
///
///
///
/// Translation is handled using Project Fluent (https://www.projectfluent.org/)
/// You pass a Fluent 'identifier' as a string and the localization manager will fetch the message
/// matching that identifier from the currently loaded language's Fluent files.
///
///
///
[PublicAPI]
public interface ILocalizationManager
{
///
/// Gets a language approrpiate string represented by the supplied messageId.
///
/// Unique Identifier for a translated message.
///
/// The language appropriate message if available, otherwise the messageId is returned.
///
string GetString(string messageId);
///
/// Try- version of
///
///
/// Does not log a warning if the message does not exist.
/// Does however log errors if any occur while formatting.
///
bool TryGetString(string messageId, [NotNullWhen(true)] out string? value);
///
/// Version of that supports arguments.
///
string GetString(string messageId, params (string, object)[] args);
///
/// Try- version of
///
///
/// Does not log a warning if the message does not exist.
/// Does however log errors if any occur while formatting.
///
bool TryGetString(string messageId, [NotNullWhen(true)] out string? value, params (string, object)[] keyArgs);
///
/// Default culture used by other methods when no culture is explicitly specified.
/// Changing this also changes the current thread's culture.
///
CultureInfo? DefaultCulture { get; set; }
///
/// Load data for a culture.
///
///
void LoadCulture(CultureInfo culture);
///
/// Immediately reload ALL localizations from resources.
///
void ReloadLocalizations();
///
/// Add a function that can be called from Fluent localizations.
///
/// The culture to add the function instance for.
/// The name of the function.
/// The function itself.
void AddFunction(CultureInfo culture, string name, LocFunction function);
///
/// Gets localization data for an entity prototype.
///
EntityLocData GetEntityData(string prototypeId);
}
internal interface ILocalizationManagerInternal : ILocalizationManager
{
void AddLoadedToStringSerializer(IRobustMappedStringSerializer serializer);
}
}