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

feat: add Spanish and Catalan languages #16

Merged
merged 1 commit into from
Jan 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ set(LOCALIZATION_SOURCES app/localization/LanguageManager.cpp
app/localization/StringIDs.cpp
app/localization/English.cpp
app/localization/Japanese.cpp
app/localization/German.cpp)
app/localization/German.cpp
app/localization/Spanish.cpp
app/localization/Catalan.cpp)

set(APP_SOURCES app/main.cpp
app/MainDlg.cpp
Expand Down
144 changes: 144 additions & 0 deletions app/localization/Catalan.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
#include "StringIDs.h"
#include "exception"
#include "Languages.h"

using namespace std;
using namespace string_literals;

namespace Localization::Catalan
{
string GetString(int id)
{
switch (id)
{
case StringID::OK:
return "OK"s;

case StringID::CANCEL:
return "Cancel·lar"s;

case StringID::CLOSE:
return "Tancar"s;

case StringID::BONJOUR_INSTALL:
#ifdef _WIN32
return R"(<p>Si us plau, instal·la Bonjour per Windows des d'aquest enllaç:</p>
<p><a href="https://support.apple.com/kb/DL999">https://support.apple.com/kb/DL999</a></p>)"s;
#else
return "Si us plau, instal·la el servei avahi-daemon i la llibreria libavahi-compat-libdnssd-dev."s;
#endif
case StringID::TROUBLE_SHOOT_RAOP_SERVICE:
return "El servei AirPlay no s'ha pogut iniciar.\nSi us plau, activa el servei Bonjour/Avahi."s;

case StringID::RECONFIG_RAOP_SERVICE:
return "L'emissió d'àudio s'aturarà breument per reconfigurar el programa!"s;

case StringID::FAILED_TO_START_DACP_BROWSER:
return "El navegador DACP no s'ha pogut iniciar. El Control Multimèdia no es troba disponible."s;

case StringID::MENU_FILE:
return "&Fitxer"s;

case StringID::MENU_QUIT:
return "&Sortir"s;

case StringID::MENU_EDIT:
return "E&ditar"s;

case StringID::MENU_OPTIONS:
return "&Opcions..."s;

case StringID::MENU_HELP:
return "A&juda"s;

case StringID::MENU_ABOUT:
return "&Sobre..."s;

case StringID::LABEL_AIRPORT_NAME:
return "Nom Airport"s;

case StringID::LABEL_AIRPORT_PASSWORD:
return "Contrasenya"s;

case StringID::LABEL_AIRPORT_CHANGE:
return "Cambiar..."s;

case StringID::LABEL_TITLE_INFO:
return "Info Pista"s;

case StringID::TOOLTIP_PREV_TRACK:
return "Anterior"s;

case StringID::TOOLTIP_NEXT_TRACK:
return "Següent"s;

case StringID::TOOLTIP_VOLUME_UP:
return "Volum més"s;

case StringID::TOOLTIP_VOLUME_DOWN:
return "Volum menys"s;

case StringID::TOOLTIP_PLAY_PAUSE:
return "Play/Pause"s;

case StringID::STATUS_READY:
return "Tot llest"s;

case StringID::STATUS_CONNECTED:
return "Conectat a "s;

case StringID::DIALOG_CHANGE_NAME_PASSWORD:
return "Canvia el Nom Airport i Contrasenya"s;

case StringID::DIALOG_ABOUT:
return "Sobre"s;

case StringID::ABOUT_INFO:
return CW2AEX(L"\xA9"s) + " Copyright 2025\nFrank Friemel\n\nShairportQt està basat Shairport de James Laird\n "s;

case StringID::OPTION_MINIMIZED:
return "Obrir minimitzat"s;

case StringID::OPTION_AUTOSTART:
return "Autoinici"s;

case StringID::DIALOG_OPTIONS:
return "Opcions Avançades"s;

case StringID::LABEL_DATA_BUFFER:
return "Buffering"s;

case StringID::LABEL_MIN:
return "min"s;

case StringID::LABEL_MAX:
return "max"s;

case StringID::LABEL_SOUND_DEVICE:
return "Dispositiu de So"s;

case StringID::LABEL_LOG_TO_FILE:
return "Guardar registres a fitxer"s;

case StringID::LABEL_DISABLE_MM_CONTROL:
return "Desactivar Controls Multimèdia"s;

case StringID::LABEL_DEFAULT_DEVICE:
return "Dispositiu per defecte del sistema"s;

case StringID::LABEL_KEEP_STICKY:
return "mantenir la finestra sempre visible"s;

case StringID::LABEL_TRAY_ICON:
return "Icona de safata"s;

case StringID::MENU_SHOW_APP_WINDOW:
return "&Obrir"s;

case StringID::MENU_SHOW_TRACK_INFO_IN_TRAY:
return "&Mostra \"Reproduïnt\" a la safata"s;

}
return English::GetString(id);
}
}
10 changes: 10 additions & 0 deletions app/localization/LanguageManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,14 @@ namespace Localization
{
return Japanese::GetString(id);
}
else if (m_currentLanguage == "es-es"s)
{
return Spanish::GetString(id);
}
else if (m_currentLanguage == "ca-es"s)
{
return Catalan::GetString(id);
}
return English::GetString(id);
}

Expand All @@ -73,6 +81,8 @@ namespace Localization
list<string> result;

result.push_back("en-EN"s);
result.push_back("es-ES"s);
result.push_back("ca-ES"s);
result.push_back("ja-JP"s);
result.push_back("de-DE"s);

Expand Down
12 changes: 11 additions & 1 deletion app/localization/Languages.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,14 @@ namespace Localization
{
extern std::string GetString(int id);
}
}

namespace Spanish
{
extern std::string GetString(int id);
}

namespace Catalan
{
extern std::string GetString(int id);
}
}
144 changes: 144 additions & 0 deletions app/localization/Spanish.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
#include "StringIDs.h"
#include "exception"
#include "Languages.h"

using namespace std;
using namespace string_literals;

namespace Localization::Spanish
{
string GetString(int id)
{
switch (id)
{
case StringID::OK:
return "OK"s;

case StringID::CANCEL:
return "Cancelar"s;

case StringID::CLOSE:
return "Cerrar"s;

case StringID::BONJOUR_INSTALL:
#ifdef _WIN32
return R"(<p>Por favor, instala Bonjour para Windows desde este enlace:</p>
<p><a href="https://support.apple.com/kb/DL999">https://support.apple.com/kb/DL999</a></p>)"s;
#else
return "Por favor, instala el servicio avahi-daemon y la librería libavahi-compat-libdnssd-dev."s;
#endif
case StringID::TROUBLE_SHOOT_RAOP_SERVICE:
return "El servicio AirPlay no se ha podido iniciar.\nPor favor, activa el servicio Bonjour/Avahi."s;

case StringID::RECONFIG_RAOP_SERVICE:
return "La emisión de audio se detendrá en breve para reconfigurar el programa!"s;

case StringID::FAILED_TO_START_DACP_BROWSER:
return "El navegador DACP no se ha podido iniciar. El Control Multimedia no está disponible."s;

case StringID::MENU_FILE:
return "&Archivo"s;

case StringID::MENU_QUIT:
return "&Salir"s;

case StringID::MENU_EDIT:
return "E&ditar"s;

case StringID::MENU_OPTIONS:
return "&Opciones..."s;

case StringID::MENU_HELP:
return "A&yuda"s;

case StringID::MENU_ABOUT:
return "&Acerca de..."s;

case StringID::LABEL_AIRPORT_NAME:
return "Nombre Airport"s;

case StringID::LABEL_AIRPORT_PASSWORD:
return "Contraseña"s;

case StringID::LABEL_AIRPORT_CHANGE:
return "Cambiar..."s;

case StringID::LABEL_TITLE_INFO:
return "Info Pista"s;

case StringID::TOOLTIP_PREV_TRACK:
return "Anterior"s;

case StringID::TOOLTIP_NEXT_TRACK:
return "Siguiente"s;

case StringID::TOOLTIP_VOLUME_UP:
return "Volumen más"s;

case StringID::TOOLTIP_VOLUME_DOWN:
return "Volumen menos"s;

case StringID::TOOLTIP_PLAY_PAUSE:
return "Play/Pause"s;

case StringID::STATUS_READY:
return "Listo"s;

case StringID::STATUS_CONNECTED:
return "Conectado a "s;

case StringID::DIALOG_CHANGE_NAME_PASSWORD:
return "Cambiar Nombre Airport y Contraseña"s;

case StringID::DIALOG_ABOUT:
return "Acerca de"s;

case StringID::ABOUT_INFO:
return CW2AEX(L"\xA9"s) + " Copyright 2025\nFrank Friemel\n\nShairportQt está basado en Shairport de James Laird\n "s;

case StringID::OPTION_MINIMIZED:
return "Iniciar minimizado"s;

case StringID::OPTION_AUTOSTART:
return "Autoinicio"s;

case StringID::DIALOG_OPTIONS:
return "Opciones Avanzadas"s;

case StringID::LABEL_DATA_BUFFER:
return "Buffering"s;

case StringID::LABEL_MIN:
return "min"s;

case StringID::LABEL_MAX:
return "max"s;

case StringID::LABEL_SOUND_DEVICE:
return "Dispositivo de Sonido"s;

case StringID::LABEL_LOG_TO_FILE:
return "Guardar registros en archivo"s;

case StringID::LABEL_DISABLE_MM_CONTROL:
return "Desactivar Controles Multimedia"s;

case StringID::LABEL_DEFAULT_DEVICE:
return "Dispositivo por defecto del sistema"s;

case StringID::LABEL_KEEP_STICKY:
return "mantener la ventana siempre visible"s;

case StringID::LABEL_TRAY_ICON:
return "Icono de bandeja"s;

case StringID::MENU_SHOW_APP_WINDOW:
return "M&ostrar"s;

case StringID::MENU_SHOW_TRACK_INFO_IN_TRAY:
return "&Mostrar \"Reproduciendo\" en la bandeja"s;

}
return English::GetString(id);
}
}
Loading