using System;
namespace StardewModdingAPI.Framework.Commands
{
/// The 'reload_i18n' SMAPI console command.
internal class ReloadI18nCommand : IInternalCommand
{
/*********
** Fields
*********/
/// Reload translations for all mods.
private readonly Action ReloadTranslations;
/*********
** Accessors
*********/
/// The command name, which the user must type to trigger it.
public string Name { get; } = "reload_i18n";
/// The human-readable documentation shown when the player runs the built-in 'help' command.
public string Description { get; } = "Reloads translation files for all mods.\n\nUsage: reload_i18n";
/*********
** Public methods
*********/
/// Construct an instance.
/// Reload translations for all mods..
public ReloadI18nCommand(Action reloadTranslations)
{
this.ReloadTranslations = reloadTranslations;
}
/// Handle the console command when it's entered by the user.
/// The command arguments.
/// Writes messages to the console.
public void HandleCommand(string[] args, IMonitor monitor)
{
this.ReloadTranslations();
monitor.Log("Reloaded translation files for all mods. This only affects new translations the mods fetch; if they cached some text, it may not be updated.", LogLevel.Info);
}
}
}