From 5061f9362b4ff6a07dd4999c2127414eda6cb824ca35cc885c8bbcb386682ae5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Garc=C3=ADa?= <93217193+Daniel-Garmig@users.noreply.github.com> Date: Wed, 29 Jul 2026 14:46:06 +0200 Subject: [PATCH] GuestLog - Small improvements and changes in localization for DataLists. --- .../Components/Controls/GuestDocForm.razor | 12 +- .../Pages/GuestDocuments/GuestDocList.razor | 10 +- src/Somnia.GuestLog/GuestConsts.cs | 6 +- .../Resources/DataListLocale.resx | 391 ++++++++++++++++++ .../Resources/LanguageLocale.es.resx | 42 +- .../Resources/LanguageLocale.resx | 260 ------------ .../Services/IDataListService.cs | 2 + .../Services/StaticDataListService.cs | 21 +- src/Somnia.GuestLog/Somnia.GuestLog.csproj | 3 + 9 files changed, 464 insertions(+), 283 deletions(-) create mode 100644 src/Somnia.GuestLog/Resources/DataListLocale.resx diff --git a/src/Somnia.GuestLog/Components/Controls/GuestDocForm.razor b/src/Somnia.GuestLog/Components/Controls/GuestDocForm.razor index 48dfc71..b429098 100644 --- a/src/Somnia.GuestLog/Components/Controls/GuestDocForm.razor +++ b/src/Somnia.GuestLog/Components/Controls/GuestDocForm.razor @@ -6,7 +6,7 @@ @inject IDataListService dataListService; @inject IValidator guestDocValidator; -@inject IStringLocalizer lang; + @@ -20,7 +20,7 @@ Required> @foreach (string docType in dataListService.GetDataListByName(GuestConsts.DataList_DocumentTypes)) { - @lang[$"dataList.DocumentType.{docType}"] + @dataListService.GetLocalizedValue(GuestConsts.DataList_DocumentTypes, docType) } @@ -58,7 +58,7 @@ @foreach (string gender in dataListService.GetDataListByName(GuestConsts.DataList_GenderOptions)) { - @lang[$"dataList.GenderOption.{gender}"] + @dataListService.GetLocalizedValue(GuestConsts.DataList_GenderOptions, gender) } @@ -95,7 +95,7 @@ Lang +@inject IDataListService dataListService; Somnia - Guest Docs @@ -46,13 +46,15 @@ - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + Afghanistan + Angola + Anguilla + Åland Islands + Albania + Andorra + United Arab Emirates + Argentina + Armenia + American Samoa + Antarctica + French Southern Territories + Antigua and Barbuda + Australia + Austria + Azerbaijan + Burundi + Belgium + Benin + Bonaire, Sint Eustatius and Saba + Burkina Faso + Bangladesh + Bulgaria + Bahrain + Bahamas + Bosnia and Herzegovina + Saint Barthélemy + Belarus + Belize + Bermuda + Bolivia, Plurinational State of + Brazil + Barbados + Brunei Darussalam + Bhutan + Bouvet Island + Botswana + Central African Republic + Canada + Cocos (Keeling) Islands + Switzerland + Chile + China + Côte d'Ivoire + Cameroon + Congo, Democratic Republic of the + Congo + Cook Islands + Colombia + Comoros + Cabo Verde + Costa Rica + Cuba + Curaçao + Christmas Island + Cayman Islands + Cyprus + Czechia + Germany + Djibouti + Dominica + Denmark + Dominican Republic + Algeria + Ecuador + Egypt + Eritrea + Western Sahara + Spain + Estonia + Ethiopia + Finland + Fiji + Falkland Islands (Malvinas) + France + Faroe Islands + Micronesia, Federated States of + Gabon + United Kingdom of Great Britain and Northern Ireland + Georgia + Guernsey + Ghana + Gibraltar + Guinea + Guadeloupe + Gambia + Guinea-Bissau + Equatorial Guinea + Greece + Grenada + Greenland + Guatemala + French Guiana + Guam + Guyana + Hong Kong + Heard Island and McDonald Islands + Honduras + Croatia + Haiti + Hungary + Indonesia + Isle of Man + India + British Indian Ocean Territory + Ireland + Iran, Islamic Republic of + Iraq + Iceland + Israel + Italy + Jamaica + Jersey + Jordan + Japan + Kazakhstan + Kenya + Kyrgyzstan + Cambodia + Kiribati + Saint Kitts and Nevis + Korea, Republic of + Kuwait + Lao People's Democratic Republic + Lebanon + Liberia + Libya + Saint Lucia + Liechtenstein + Sri Lanka + Lesotho + Lithuania + Luxembourg + Latvia + Macao + Saint Martin (French part) + Morocco + Monaco + Moldova, Republic of + Madagascar + Maldives + Mexico + Marshall Islands + North Macedonia + Mali + Malta + Myanmar + Montenegro + Mongolia + Northern Mariana Islands + Mozambique + Mauritania + Montserrat + Martinique + Mauritius + Malawi + Malaysia + Mayotte + Namibia + New Caledonia + Niger + Norfolk Island + Nigeria + Nicaragua + Niue + Netherlands, Kingdom of the + Norway + Nepal + Nauru + New Zealand + Oman + Pakistan + Panama + Pitcairn + Peru + Philippines + Palau + Papua New Guinea + Poland + Puerto Rico + Korea, Democratic People's Republic of + Portugal + Paraguay + Palestine, State of + French Polynesia + Qatar + Réunion + Romania + Russian Federation + Rwanda + Saudi Arabia + Sudan + Senegal + Singapore + South Georgia and the South Sandwich Islands + Saint Helena, Ascension and Tristan da Cunha + Svalbard and Jan Mayen + Solomon Islands + Sierra Leone + El Salvador + San Marino + Somalia + Saint Pierre and Miquelon + Serbia + South Sudan + Sao Tome and Principe + Suriname + Slovakia + Slovenia + Sweden + Eswatini + Sint Maarten (Dutch part) + Seychelles + Syrian Arab Republic + Turks and Caicos Islands + Chad + Togo + Thailand + Tajikistan + Tokelau + Turkmenistan + Timor-Leste + Tonga + Trinidad and Tobago + Tunisia + Türkiye + Tuvalu + Taiwan, Province of China + Tanzania, United Republic of + Uganda + Ukraine + United States Minor Outlying Islands + Uruguay + United States of America + Uzbekistan + Holy See + Saint Vincent and the Grenadines + Venezuela, Bolivarian Republic of + Virgin Islands (British) + Virgin Islands (U.S.) + Viet Nam + Vanuatu + Wallis and Futuna + Samoa + Yemen + South Africa + Zambia + Zimbabwe + + DNI + NIE + Passport + ID Card + Other + + Male + Female + Other + + \ 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 6cc2bd4..581a64b 100644 --- a/src/Somnia.GuestLog/Resources/LanguageLocale.es.resx +++ b/src/Somnia.GuestLog/Resources/LanguageLocale.es.resx @@ -22,8 +22,10 @@ [base64 mime encoded serialized .NET Framework object] - - [base64 mime encoded string representing a byte array form of the .NET Framework object] + + [base64 mime encoded string representing a byte array form of the .NET Framework + object] This is a comment @@ -59,7 +61,8 @@ : using a System.ComponentModel.TypeConverter : and then encoded with base64 encoding. --> - + @@ -112,12 +115,33 @@ 2.0 - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + 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 + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, + Culture=neutral, PublicKeyToken=b77a5c561934e089 - - Valor Simple! - - + + Tipo Documento + Número Documento + Fecha emisión + Número Soporte + Nacionalidad + Nombre + Apellido 1 + Apellido 2 + Fecha Nacimiento + Sexo + Número Teléfono + Dirección Email + Dirección + Ciudad + Provincia + Región + País + Código Postal + Fecha Creación + Fecha Modificación + + \ No newline at end of file diff --git a/src/Somnia.GuestLog/Resources/LanguageLocale.resx b/src/Somnia.GuestLog/Resources/LanguageLocale.resx index b0e8b7e..7a036de 100644 --- a/src/Somnia.GuestLog/Resources/LanguageLocale.resx +++ b/src/Somnia.GuestLog/Resources/LanguageLocale.resx @@ -152,266 +152,6 @@ Return Close - Aruba - Afghanistan - Angola - Anguilla - Åland Islands - Albania - Andorra - United Arab Emirates - Argentina - Armenia - American Samoa - Antarctica - French Southern Territories - Antigua and Barbuda - Australia - Austria - Azerbaijan - Burundi - Belgium - Benin - Bonaire, Sint Eustatius and Saba - Burkina Faso - Bangladesh - Bulgaria - Bahrain - Bahamas - Bosnia and Herzegovina - Saint Barthélemy - Belarus - Belize - Bermuda - Bolivia, Plurinational State of - Brazil - Barbados - Brunei Darussalam - Bhutan - Bouvet Island - Botswana - Central African Republic - Canada - Cocos (Keeling) Islands - Switzerland - Chile - China - Côte d'Ivoire - Cameroon - Congo, Democratic Republic of the - Congo - Cook Islands - Colombia - Comoros - Cabo Verde - Costa Rica - Cuba - Curaçao - Christmas Island - Cayman Islands - Cyprus - Czechia - Germany - Djibouti - Dominica - Denmark - Dominican Republic - Algeria - Ecuador - Egypt - Eritrea - Western Sahara - Spain - Estonia - Ethiopia - Finland - Fiji - Falkland Islands (Malvinas) - France - Faroe Islands - Micronesia, Federated States of - Gabon - United Kingdom of Great Britain and Northern Ireland - Georgia - Guernsey - Ghana - Gibraltar - Guinea - Guadeloupe - Gambia - Guinea-Bissau - Equatorial Guinea - Greece - Grenada - Greenland - Guatemala - French Guiana - Guam - Guyana - Hong Kong - Heard Island and McDonald Islands - Honduras - Croatia - Haiti - Hungary - Indonesia - Isle of Man - India - British Indian Ocean Territory - Ireland - Iran, Islamic Republic of - Iraq - Iceland - Israel - Italy - Jamaica - Jersey - Jordan - Japan - Kazakhstan - Kenya - Kyrgyzstan - Cambodia - Kiribati - Saint Kitts and Nevis - Korea, Republic of - Kuwait - Lao People's Democratic Republic - Lebanon - Liberia - Libya - Saint Lucia - Liechtenstein - Sri Lanka - Lesotho - Lithuania - Luxembourg - Latvia - Macao - Saint Martin (French part) - Morocco - Monaco - Moldova, Republic of - Madagascar - Maldives - Mexico - Marshall Islands - North Macedonia - Mali - Malta - Myanmar - Montenegro - Mongolia - Northern Mariana Islands - Mozambique - Mauritania - Montserrat - Martinique - Mauritius - Malawi - Malaysia - Mayotte - Namibia - New Caledonia - Niger - Norfolk Island - Nigeria - Nicaragua - Niue - Netherlands, Kingdom of the - Norway - Nepal - Nauru - New Zealand - Oman - Pakistan - Panama - Pitcairn - Peru - Philippines - Palau - Papua New Guinea - Poland - Puerto Rico - Korea, Democratic People's Republic of - Portugal - Paraguay - Palestine, State of - French Polynesia - Qatar - Réunion - Romania - Russian Federation - Rwanda - Saudi Arabia - Sudan - Senegal - Singapore - South Georgia and the South Sandwich Islands - Saint Helena, Ascension and Tristan da Cunha - Svalbard and Jan Mayen - Solomon Islands - Sierra Leone - El Salvador - San Marino - Somalia - Saint Pierre and Miquelon - Serbia - South Sudan - Sao Tome and Principe - Suriname - Slovakia - Slovenia - Sweden - Eswatini - Sint Maarten (Dutch part) - Seychelles - Syrian Arab Republic - Turks and Caicos Islands - Chad - Togo - Thailand - Tajikistan - Tokelau - Turkmenistan - Timor-Leste - Tonga - Trinidad and Tobago - Tunisia - Türkiye - Tuvalu - Taiwan, Province of China - Tanzania, United Republic of - Uganda - Ukraine - United States Minor Outlying Islands - Uruguay - United States of America - Uzbekistan - Holy See - Saint Vincent and the Grenadines - Venezuela, Bolivarian Republic of - Virgin Islands (British) - Virgin Islands (U.S.) - Viet Nam - Vanuatu - Wallis and Futuna - Samoa - Yemen - South Africa - Zambia - Zimbabwe - - DNI - NIE - Passport - ID Card - Other - - Male - Female - Other - New Guest Document Details diff --git a/src/Somnia.GuestLog/Services/IDataListService.cs b/src/Somnia.GuestLog/Services/IDataListService.cs index 556f1d6..a93e3d8 100644 --- a/src/Somnia.GuestLog/Services/IDataListService.cs +++ b/src/Somnia.GuestLog/Services/IDataListService.cs @@ -6,4 +6,6 @@ public interface IDataListService public HashSet GetDataListByName(string dataListName); public bool IsValueInList(string dataListName, string value); + + public string GetLocalizedValue(string dataListName, string? value); } diff --git a/src/Somnia.GuestLog/Services/StaticDataListService.cs b/src/Somnia.GuestLog/Services/StaticDataListService.cs index cca35b7..7297b51 100644 --- a/src/Somnia.GuestLog/Services/StaticDataListService.cs +++ b/src/Somnia.GuestLog/Services/StaticDataListService.cs @@ -1,7 +1,21 @@ +using Microsoft.Extensions.Localization; +using Somnia.GuestLog.Resources; + namespace Somnia.GuestLog.Services; -public class StaticDataListService() : IDataListService +public class StaticDataListService( + IServiceProvider serviceProvider +) : IDataListService { + + private IStringLocalizer _dataListLang + { + get + { + return serviceProvider.GetRequiredService>(); + } + } + private readonly Dictionary> dataListDict = new([ new KeyValuePair>(GuestConsts.DataList_DocumentTypes, _documentTypeSet), new KeyValuePair>(GuestConsts.DataList_GenderOptions, _genderOptionSet), @@ -28,6 +42,11 @@ public class StaticDataListService() : IDataListService return set.Contains(value); } + public string GetLocalizedValue(string dataListName, string? value) + { + return _dataListLang[$"dataList.{dataListName}.{value}"]; + } + #region DataList Dicts diff --git a/src/Somnia.GuestLog/Somnia.GuestLog.csproj b/src/Somnia.GuestLog/Somnia.GuestLog.csproj index 7ad89f6..7c1e4ab 100644 --- a/src/Somnia.GuestLog/Somnia.GuestLog.csproj +++ b/src/Somnia.GuestLog/Somnia.GuestLog.csproj @@ -31,5 +31,8 @@ MSBuild:Compile + + MSBuild:Compile + \ No newline at end of file