Newer
Older
Sunfish / src / Sunfish.Cli / Texts.cs
@Ivan Dominguez Ivan Dominguez 21 hours ago 8 KB 3.0
namespace Sunfish.Cli;

/// <summary>Textos propios de la consola (el idioma lo decide Sunfish.Strings).</summary>
internal static class Texts
{
    private static string T(string english, string spanish) => Strings.Spanish ? spanish : english;

    public static string Usage => T(
        """
        Sunfish 3.0 - web and file server for old and new computers

        Usage:
          sunfish-cli [options]            interactive screen (with a terminal); otherwise like serve
          sunfish-cli FOLDER [options]     share a folder right now (read only, not saved)
          sunfish-cli serve [options]      serve without interface (services, scripts)
          sunfish-cli share add NAME FOLDER [Key=value ...]
          sunfish-cli share set NAME Key=value ...     (keys of the [Share] section, e.g. Upload=true)
          sunfish-cli share del NAME  |  share list
          sunfish-cli user add|passwd|del NAME  |  user list
          sunfish-cli admin status|enable|disable|passwd|allow ...   (web administration panel)
          sunfish-cli import-v2 [FILE]     import a Sunfish 2.0 configuration (sunfish2)
          sunfish-cli --help | --version

        Options:
          -c, --config FILE   configuration file (default: sunfish.conf next to the
                              program, or the user configuration folder)
          -p, --port N        HTTP port (default 8080)
          --lang es|en        language of the messages
          -v, --verbose       log every connection detail
        """,
        """
        Sunfish 3.0 - servidor web y de ficheros para equipos antiguos y modernos

        Uso:
          sunfish-cli [opciones]           pantalla interactiva (con terminal); si no, como serve
          sunfish-cli CARPETA [opciones]   comparte una carpeta al momento (solo lectura, no se guarda)
          sunfish-cli serve [opciones]     sirve sin interfaz (servicios, scripts)
          sunfish-cli share add NOMBRE CARPETA [Clave=valor ...]
          sunfish-cli share set NOMBRE Clave=valor ...  (claves de la seccion [Share], p. ej. Upload=true)
          sunfish-cli share del NOMBRE  |  share list
          sunfish-cli user add|passwd|del NOMBRE  |  user list
          sunfish-cli admin status|enable|disable|passwd|allow ...   (panel de administración web)
          sunfish-cli import-v2 [FICHERO]  importa la configuración de Sunfish 2.0 (sunfish2)
          sunfish-cli --help | --version

        Opciones:
          -c, --config FICHERO  fichero de configuracion (por defecto: sunfish.conf junto al
                                programa, o la carpeta de configuracion del usuario)
          -p, --port N          puerto HTTP (por defecto 8080)
          --lang es|en          idioma de los mensajes
          -v, --verbose         registrar todos los detalles de las conexiones
        """);

    public static string NoConfig(string portable, string user) => T(
        $"No configuration file found. Create {portable} or {user}, or share a folder with: sunfish-cli FOLDER",
        $"No hay fichero de configuracion. Crea {portable} o {user}, o comparte una carpeta con: sunfish-cli CARPETA");

    public static string NotAFolder(string path) => T($"Not a folder: {path}", $"No es una carpeta: {path}");
    public static string UnknownOption(string option) => T($"Unknown option: {option}", $"Opcion desconocida: {option}");
    public static string MissingValue(string option) => T($"Missing value for {option}", $"Falta el valor de {option}");
    public static string BadPort(string value) => T($"Invalid port: {value}", $"Puerto no valido: {value}");
    public static string ConfigWarning(string message) => T($"Configuration: {message}", $"Configuracion: {message}");
    public static string CannotStart(string message) => T($"Cannot start the server: {message}", $"No se puede arrancar el servidor: {message}");
    public static string Sharing(string path) => T($"Sharing {path}", $"Compartiendo {path}");
    public static string OpenWith => T("Open in a browser:", "Abre en un navegador:");
    public static string NoShares => T("There are no enabled shares.", "No hay shares activos.");
    public static string StopHint => T("Press Ctrl+C to stop.", "Pulsa Ctrl+C para parar.");
    public static string Stopping => T("Stopping...", "Parando...");

    public static string UserUsage => T(
        "Usage: sunfish-cli user add|passwd|del NAME [-c FILE]  |  sunfish-cli user list [-c FILE]",
        "Uso: sunfish-cli user add|passwd|del NOMBRE [-c FICHERO]  |  sunfish-cli user list [-c FICHERO]");
    public static string PasswordPrompt => T("Password: ", "Contraseña: ");
    public static string PasswordRepeat => T("Repeat the password: ", "Repite la contraseña: ");
    public static string PasswordMismatch => T("The passwords do not match.", "Las contraseñas no coinciden.");
    public static string PasswordEmpty => T("The password cannot be empty.", "La contraseña no puede estar vacía.");
    public static string UserExists(string name) => T($"The user '{name}' already exists.", $"El usuario '{name}' ya existe.");
    public static string UserMissing(string name) => T($"There is no user '{name}'.", $"No existe el usuario '{name}'.");
    public static string BadUserName(string name) => T($"Invalid user name: '{name}'.", $"Nombre de usuario no válido: '{name}'.");
    public static string UserSaved(string name, string file) => T($"User '{name}' saved in {file}", $"Usuario '{name}' guardado en {file}");
    public static string UserDeleted(string name) => T($"User '{name}' deleted.", $"Usuario '{name}' borrado.");
    public static string NoUsers => T("There are no users.", "No hay usuarios.");
    public static string UserShares(string shares) => T($"shares: {shares}", $"shares: {shares}");
    public static string ShareUsage => T(
        "Usage: sunfish-cli share add NAME FOLDER [Key=value ...] | share set NAME Key=value ... | share del NAME | share list  [-c FILE]",
        "Uso: sunfish-cli share add NOMBRE CARPETA [Clave=valor ...] | share set NOMBRE Clave=valor ... | share del NOMBRE | share list  [-c FICHERO]");
    public static string ShareMissing(string name) => T($"There is no share '{name}'.", $"No existe el share '{name}'.");
    public static string ShareSaved(string name, string file) => T($"Share '{name}' saved in {file}", $"Share '{name}' guardado en {file}");
    public static string AdminUsage => T(
        "Usage: sunfish-cli admin status | enable | disable | passwd | allow ADDRESSES  [-c FILE]\n" +
        "       ADDRESSES: IPs or networks, e.g. 127.0.0.1,::1,192.168.1.0/24 (or *)",
        "Uso: sunfish-cli admin status | enable | disable | passwd | allow DIRECCIONES  [-c FICHERO]\n" +
        "     DIRECCIONES: IP o redes, p. ej. 127.0.0.1,::1,192.168.1.0/24 (o *)");
    public static string AdminOn => T("Web administration panel: enabled", "Panel de administración web: activado");
    public static string AdminOffText => T("Web administration panel: disabled", "Panel de administración web: desactivado");
    public static string AdminAllowed(string list) => T($"Allowed from: {list}", $"Permitido desde: {list}");
    public static string AdminNeedsPassword => T("Choose a password for the panel (user: admin).", "Elige una contraseña para el panel (usuario: admin).");
    public static string AdminPasswordSaved(string file) => T($"Panel password saved in {file}", $"Contraseña del panel guardada en {file}");
    public static string ImportNotFound(string name) => T(
        $"No '{name}' file found next to the program or in the current folder. Usage: sunfish-cli import-v2 [FILE] [-c FILE]",
        $"No hay un fichero '{name}' junto al programa ni en la carpeta actual. Uso: sunfish-cli import-v2 [FICHERO] [-c FICHERO]");
    public static string ImportAsk(string file) => T(
        $"Sunfish 2.0 configuration found ({file}). Import its shares? [Y/n] ",
        $"Hay una configuración de Sunfish 2.0 ({file}). ¿Importar sus shares? [S/n] ");
    public static string GrantHint => T(
        "To protect a share, add its name to 'Users = ...' in the share section.",
        "Para proteger un share, añade el nombre a 'Users = ...' en su sección.");
}