diff --git a/Directory.Packages.props b/Directory.Packages.props index 1cb17f5..43dcc95 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -12,6 +12,7 @@ + diff --git a/src/Somnia.GuestLog/Components/Controls/LanguageSelector.razor b/src/Somnia.GuestLog/Components/Controls/LanguageSelector.razor new file mode 100644 index 0000000..bf36f69 --- /dev/null +++ b/src/Somnia.GuestLog/Components/Controls/LanguageSelector.razor @@ -0,0 +1,60 @@ +@using System.Globalization +@using Microsoft.AspNetCore.Localization + +@inject IJSRuntime JS +@inject NavigationManager Navigation + + + + + + + @foreach (CultureInfo culture in supportedCultures) + { + + @culture.DisplayName + + } + + + + + + +@code { + + private bool _open; + + private CultureInfo? currentCulture; + private List supportedCultures = [ + new CultureInfo("en-US"), + new CultureInfo("es-ES"), + ]; + + protected override void OnInitialized() + { + currentCulture = CultureInfo.CurrentCulture; + } + + + private void BtnToggleOpen() => _open = !_open; + private async Task CmbSelectedCultureChanged(CultureInfo? newCulture) + { + if (newCulture is null) + { + return; + } + + string cookieValue = CookieRequestCultureProvider.MakeCookieValue( +new RequestCulture(newCulture, newCulture)); + + await JS.InvokeVoidAsync("setBlazorCultureCookie", cookieValue); + Navigation.NavigateTo(Navigation.Uri, forceLoad: true); + + //Close Popover. + _open = false; + } + +} \ No newline at end of file diff --git a/src/Somnia.GuestLog/Components/Layout/MainLayout.razor b/src/Somnia.GuestLog/Components/Layout/MainLayout.razor index a0b9f62..704d394 100644 --- a/src/Somnia.GuestLog/Components/Layout/MainLayout.razor +++ b/src/Somnia.GuestLog/Components/Layout/MainLayout.razor @@ -19,6 +19,7 @@ + diff --git a/src/Somnia.GuestLog/Program.cs b/src/Somnia.GuestLog/Program.cs index fb7b13a..e088ef1 100644 --- a/src/Somnia.GuestLog/Program.cs +++ b/src/Somnia.GuestLog/Program.cs @@ -6,6 +6,7 @@ using Microsoft.AspNetCore.Localization; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Diagnostics; using MudBlazor.Services; +using MudBlazor.Translations; using Serilog; using Serilog.Extensions.Logging; using Somnia.GuestLog; @@ -84,6 +85,7 @@ builder.Services.AddRazorComponents() .AddInteractiveServerComponents(); builder.Services.AddLocalization(); +builder.Services.AddMudTranslations(); builder.Services.AddHttpClient(); // Add Validation Services diff --git a/src/Somnia.GuestLog/Resources/DataListLocale.es.resx b/src/Somnia.GuestLog/Resources/DataListLocale.es.resx new file mode 100644 index 0000000..6a9a48d --- /dev/null +++ b/src/Somnia.GuestLog/Resources/DataListLocale.es.resx @@ -0,0 +1,397 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, + Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, + Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + Aruba + Afganistán + Angola + Anguila + Åland, (las) Islas + Albania + Andorra + Emiratos Árabes Unidos (los) + Argentina + Armenia + Samoa Americana + Antártida + Tierras Australes Francesas (las) + Antigua y Barbuda + Australia + Austria + Azerbaiyán + Burundi + Bélgica + Benín + Bonaire, San Eustaquio y Saba + Burkina Faso + Bangladés + Bulgaria + Baréin + Bahamas (las) + Bosnia y Herzegovina + San Barthélemy + Belarús + Belice + Bermuda + Bolivia (Estado Plurinacional de) + Brasil + Barbados + Brunei Darussalam + Bhután + Bouvet, Isla + Botsuana + República Centroafricana (la) + Canadá + Cocos / Keeling, (las) Islas + Suiza + Chile + China + Côte d'Ivoire + Camerún + Congo (la República Democrática del) + Congo (el) + Cook, (las) Islas + Colombia + Comoras (las) + Cabo Verde + Costa Rica + Cuba + Curazao + Christmas, Isla + Caimán, (las) Islas + Chipre + Chequia + Alemania + Yibuti + Dominica + Dinamarca + Dominicana, (la) República + Argelia + Ecuador + Egipto + Eritrea + Sáhara Occidental + España + Estonia + Etiopía + Finlandia + Fiyi + Malvinas [Falkland], (las) Islas + Francia + Feroe, (las) Islas + Micronesia (Estados Federados de) + Gabón + Reino Unido de Gran Bretaña e Irlanda del Norte + Georgia + Guernsey + Ghana + Gibraltar + Guinea + Guadalupe + Gambia (la) + Guinea-Bissau + Guinea Ecuatorial + Grecia + Granada + Groenlandia + Guatemala + Guayana Francesa + Guam + Guyana + Hong Kong + Heard (Isla) e Islas McDonald + Honduras + Croacia + Haití + Hungría + Indonesia + Isla de Man + India + Territorio Británico del Océano Índico (el) + Irlanda + Irán (República Islámica de) + Irak + Islandia + Israel + Italia + Jamaica + Jersey + Jordania + Japón + Kazajistán + Kenia + Kirguistán + Camboya + Kiribati + Saint Kitts y Nevis + Corea (la República de) + Kuwait + Lao, (la) República Democrática Popular + Líbano + Liberia + Libia + Santa Lucía + Liechtenstein + Sri Lanka + Lesoto + Lituania + Luxemburgo + Letonia + Macao + San Martín (parte francesa) + Marruecos + Mónaco + Moldova (la República de) + Madagascar + Maldivas + México + Marshall, (las) Islas + Macedonia del Norte + Malí + Malta + Myanmar + Montenegro + Mongolia + Marianas Septentrionales, (las) Islas + Mozambique + Mauritania + Montserrat + Martinica + Mauricio + Malaui + Malasia + Mayotte + Namibia + Nueva Caledonia + Níger (el) + Norfolk, Isla + Nigeria + Nicaragua + Niue + Países Bajos (los) + Noruega + Nepal + Nauru + Nueva Zelandia + Omán + Pakistán + Panamá + Pitcairn, (las) Islas + Perú + Filipinas (las) + Palau + Papúa Nueva Guinea + Polonia + Puerto Rico + Corea (la República Popular Democrática de) + Portugal + Paraguay + Palestina, Estado de + Polinesia Francesa + Catar + Reunión + Rumania + Rusia, (la) Federación de + Ruanda + Arabia Saudita + Sudán + Senegal + Singapur + Georgia del Sur (la) y las Islas Sandwich del Sur + Santa Elena, Ascensión y Tristán de Acuña + Svalbard y Jan Mayen + Salomón, (las) Islas + Sierra Leona + El Salvador + San Marino + Somalia + San Pedro y Miquelón + Serbia + Sudán del Sur + Santo Tomé y Príncipe + Suriname + Eslovaquia + Eslovenia + Suecia + Eswatini + San Martín (parte neerlandesa) + Seychelles + República Árabe Siria + Turcas y Caicos, (las) Islas + Chad + Togo + Tailandia + Tayikistán + Tokelau + Turkmenistán + Timor-Leste + Tonga + Trinidad y Tabago + Túnez + Turquía + Tuvalu + Taiwán (Provincia de China) + Tanzania, República Unida de + Uganda + Ucrania + Islas menores alejadas de Estados Unidos (las) + Uruguay + Estados Unidos de América (los) + Uzbekistán + Santa Sede (la) + San Vincente y las Granadinas + Venezuela (República Bolivariana de) + Vírgenes Británicas, (las) Islas + Vírgenes de los Estados Unidos, (las) Islas + Viet Nam + Vanuatu + Wallis y Futuna + Samoa + Yemen + Sudáfrica + Zambia + Zimbabue + + DNI + NIE + Pasaporte + ID Card + Otro + + Hombre + Mujer + Otro + + Efectivo + Tarjeta + Transferencia + Pago por Móvil + Otro + + \ No newline at end of file diff --git a/src/Somnia.GuestLog/Resources/LanguageLocale.es.resx b/src/Somnia.GuestLog/Resources/LanguageLocale.es.resx index 581a64b..c5dc1e9 100644 --- a/src/Somnia.GuestLog/Resources/LanguageLocale.es.resx +++ b/src/Somnia.GuestLog/Resources/LanguageLocale.es.resx @@ -123,25 +123,147 @@ Culture=neutral, PublicKeyToken=b77a5c561934e089 + ID + Versión Tipo Documento Número Documento - Fecha emisión + Fecha Emisión Número Soporte Nacionalidad Nombre - Apellido 1 + Apellido Apellido 2 Fecha Nacimiento Sexo Número Teléfono - Dirección Email - Dirección - Ciudad - Provincia - Región - País - Código Postal + Correo Electrónico Fecha Creación Fecha Modificación + Id + Fecha Entrada + Fecha Salida + Cantidad Habitaciones + Número Habitaciones + Forma de Pago + Huéspedes + Fecha Creación + Fecha Modificación + + Id + Formato Exportación + Parámetros Exportación + Resultado Exportación + Ruta Exportación + Detalles Exportación + Fecha Exportación + + Tipo Exportación + Fecha Desde + Fecha Hasta + + TMP + + Acciones + Recargar Datos + En Progreso... + Configurar Columnas + ¡Eliminar no se puede deshacer! + ¿Confirmar? + Eliminar + Crear + Editar + Volver + Cerrar + Buscar + Guaradar + Cancelar + No hay resultados + Mostrar todos los elementos + Usa '%' como comodín + Fecha Inicio + Fecha Fin + Cargando... + Cambios Guardados... + ¡Edición cancelada! + Idioma + + Dirección + Ciudad + Provincia + Región + País + Código Postal + + + + OK + Error desconocido + Fallo de validación de datos + ¡No encontrado! + Error de almacenamiento de ficheros + + Huésped (ID: '{0}') está en una Estancia. + Huésped (ID: '{0}') ya está en una estancia en el periodo: {1} + + OK + Sin datos + Error de Exportación + Error de ficheros + + GuestLog JSON + Spain Parte Viajeros + + 'Date Entrada' Estancia + + + Huéspedes + Estancias + Exportación de Estancias + + + Documentos Huéspedes + Lista de Documentos + Nuevo Huésped + + ¡Ya existe un huésped con este documento! + Ver huésped existente + + Se ha entrado en modo edición + Guardar cambios en el documento + Cancelar edición. Se perderán los cambios + Error al guardar el documento '{0}' + + Lista Estancias + Lista Estancias + Nueva Estancia + + Nueva Estancia + + Exportación de Estancias + Listado de Exportaciones + Nueva Exportación + + Nueva Exportación de Estancias + + + Datos Documento + Datos Huésped + Datos de contacto + Datos Dirección + Buscar Dirección + + Detalles estancia + Lista de Huéspedes + Añadir Huésped + + Buscar dirección + Buscar dirección + Buscar dirección + Usar dirección + + Buscar Huésped + Usar Huésped + Huéspedes sugeridos + \ No newline at end of file diff --git a/src/Somnia.GuestLog/Resources/LanguageLocale.resx b/src/Somnia.GuestLog/Resources/LanguageLocale.resx index 1ccfb45..3be992c 100644 --- a/src/Somnia.GuestLog/Resources/LanguageLocale.resx +++ b/src/Somnia.GuestLog/Resources/LanguageLocale.resx @@ -185,6 +185,7 @@ Loading... Changes saved... Edit Canceled! + Language Address City diff --git a/src/Somnia.GuestLog/Somnia.GuestLog.csproj b/src/Somnia.GuestLog/Somnia.GuestLog.csproj index 0335040..f45492e 100644 --- a/src/Somnia.GuestLog/Somnia.GuestLog.csproj +++ b/src/Somnia.GuestLog/Somnia.GuestLog.csproj @@ -17,6 +17,7 @@ + diff --git a/src/Somnia.GuestLog/wwwroot/js/App.js b/src/Somnia.GuestLog/wwwroot/js/App.js index 64522b2..378196d 100644 --- a/src/Somnia.GuestLog/wwwroot/js/App.js +++ b/src/Somnia.GuestLog/wwwroot/js/App.js @@ -11,3 +11,9 @@ window.downloadFileFromStream = async (fileName, contentStreamReference) => { anchorElement.remove(); URL.revokeObjectURL(url); } + +// Function to update Language cookie. +window.setBlazorCultureCookie = async (newCulture) => { + await window.cookieStore.set('.AspNetCore.Culture', newCulture); + console.log("Updated cookie to " + newCulture); +}; \ No newline at end of file