using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using JetBrains.Annotations;
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]
[NotContentImplementable]
public interface ILocalizationManager
{
///
/// 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.
/// Logs a warning if the message does not exist.
///
string GetString(string messageId);
///
/// Checks if the specified id has been registered, without checking its arguments.
///
/// Unique Identifier for a translated message.
/// true if it exists, even if it requires any parameters to be passed.
bool HasString(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);
///
/// Version of that supports arguments.
///
string GetString(string messageId, (string, object) arg);
///
/// Version of that supports arguments.
///
string GetString(string messageId, (string, object) arg, (string, object) arg2);
///
/// 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, (string, object) arg);
///
/// 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, (string, object) arg1, (string, object) arg2);
///
/// 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; }
///
/// Checks if the culture is loaded, if not,
/// loads it via
/// and then set it as .
///
void SetCulture(CultureInfo culture);
///
/// Checks to see if the culture has been loaded.
///
bool HasCulture(CultureInfo culture);
///
/// Load data for a culture.
///
///
void LoadCulture(CultureInfo culture);
///
/// Loads obtained from ,
/// they are different for client and server, and also can be saved.
///
CultureInfo SetDefaultCulture();
///
/// Returns all locale directories from the game's resources.
///
List GetFoundCultures();
///
/// Sets culture to be used in the absence of the main one.
///
void SetFallbackCluture(params 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);
///
/// Initializes the .
///
void Initialize()
{
}
}
internal interface ILocalizationManagerInternal : ILocalizationManager
{
void AddLoadedToStringSerializer(IRobustMappedStringSerializer serializer);
}
}