Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Spanish language #32

Open
Manudam69 opened this issue Nov 30, 2024 · 1 comment
Open

Add Spanish language #32

Manudam69 opened this issue Nov 30, 2024 · 1 comment

Comments

@Manudam69
Copy link

es.ts

export const es = {
  language: {
    flag: "🇪🇸",
    name: "Español",
  },
  errors: {
    needMoreParticipants: "¡Se necesitan al menos 2 participantes!",
    invalidPairs: "No se pudieron generar pares válidos con las reglas actuales. Por favor, revisa las reglas e inténtalo nuevamente.",
    multipleMustRules: "Se encontraron múltiples reglas de DEBE",
    conflictingRules: "Uso conflictivo de una regla de DEBE y NO DEBE",
    emptyName: "Nombre vacio",
    duplicateName: "Nombre duplicado: {{name}}",
    invalidRuleFormat: "Formato de regla no válido: {{rule}}",
    unknownParticipant: "Participante desconocido en la regla: {{name}}",
    noValidReceivers: "No quedan destinatarios válidos para este participante.",
    line: "Linea {{number}}",
  },
  home: {
    vanity: "El proyecto comenzó en el invierno de 2015 por Maël",
    title: "Planificador de Santa Secreto",
    explanation: [
      "¡Bienvenido! Esta herramienta te ayudará a organizar el intercambio de regalos para las fiestas. Simplemente enumera a todos los participantes y asignaremos los emparejamientos de manera aleatoria según las reglas que establezcas.",
      "Recibirás un enlace único para cada participante, el cual deberás compartir tú mismo (por email, Slack, etc). [<exampleLink>Enlace de ejemplo</exampleLink>]",
      "Sin cuentas, sin correos electrónicos, sin complicaciones, y todo alojado en <githubLink>GitHub Pages</githubLink> sin backend!",
    ]
      .map((line) => `<p>${line}</p>`)
      .join(""),
    exampleLink: "Enlace de ejemplo",
  },
  pairing: {
    title: "Tu asignación de Santa Secreto.",
    assignment: "Bienvenido, <name/>! Has sido elegido para comprar un regalo para:",
    loading: "Cargando...",
    error: "No se pudo descifrar el mensaje. Es posible que el enlace sea inválido.",
    startYourOwn: "¡Iniciar un Santa Secreto!",
  },
  participants: {
    title: "Participantes",
    addPerson: "Agregar persona",
    generatePairs: "Generar emparejamientos",
    enterName: "Ingresa el nombre del participante",
    editRules: "Editar reglas",
    removeParticipant: "Remover participante",
    rulesCount_one: "{{count}} regla definida",
    rulesCount_other: "{{count}} reglas definidas",
    switchToFormView: "Cambiar a vista de formulario",
    switchToTextView: "Cambiar a vista de texto",
  },
  rules: {
    title: "Reglas para {{name}}",
    mustBePairedWith: "Debe ser emparejado con",
    mustNotBePairedWith: "No debe ser emparejado con",
    selectParticipant: "Selecciona otro participante",
    removeRule: "Eliminar regla",
    addMustRule: "Forzar un emparejamiento",
    addMustNotRule: "Prevenir un emparejamiento",
    cancel: "Cancelar",
    saveRules: "Guardar Reglas",
  },
  links: {
    title: "Enlaces para compartir",
    warningParticipantsChanged: "Advertencia: Los participantes o las reglas han cambiado desde la última vez que se generaron estos enlaces.",
    resetAssignments: "Regenerar emparejamientos.",
    shareInstructions: "Comparte esos enlaces solo con la persona correspondiente que dará el regalo",
    exportCSV: "Exportar como CSV",
    copySecretLink: "Copiar Enlace Secreto.",
    linkCopied: "Añadido al portapapeles!",
    for: "para",
  },
  settings: {
    title: "Configuración",
    instructions: "Instrucciones adicionales",
    instructionsPlaceholder: "Por ejemplo, presupuesto, fecha, ubicación...",
    instructionsHelp: "Se mostrarán a todos los participantes en su página de asignación. Manténlo breve: aumenta la longitud de los enlaces.",
  },
};

config.ts

import i18n from 'i18next';
import { initReactI18next } from 'react-i18next';
import LanguageDetector from 'i18next-browser-languagedetector';
import { en } from './en';
import { fr } from './fr';
import { es } from './es';

export type Translations = typeof en;

const resources = {
  en: { translation: en },
  fr: { translation: fr },
  es: { translation: es },
} satisfies Record<string, { translation: Translations }>;

export const SUPPORTED_LANGUAGES = Object.keys(resources);

i18n
  .use(LanguageDetector)
  .use(initReactI18next)
  .init({
    resources,
    fallbackLng: 'en',
    interpolation: {
      escapeValue: false
    }
  });

// Type augmentation for useTranslation hook
declare module 'i18next' {
  interface CustomTypeOptions {
    resources: typeof resources['en'];
  }
}

export default i18n; 
@arcanis
Copy link
Owner

arcanis commented Dec 2, 2024

Thanks Manuel! I'll wait a little before adding more languages as I'm still adding features, rewording things, and want to avoid having to actively update translations for languages I don't speak, but adding spanish is on my shortlist after that 😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants