-
-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
feat: Localization #417
feat: Localization #417
Conversation
Hi @michaelmairegger, I'd love to add multi-language support. I do not think a specialized |
I have added TabellaV2 only to show it for the one class. The only advantage about my implementation within TabellaV2 is that it reads all the list from resources rather than hardcoding it. I saw your PR. Initially this was my idea too, to have the keys hardcoded and the value is read from the resources. My thought was that it would be more convinient to have a resource file with the key/values rather than having it to code. The advantage would be, that if e.g. a new Natura will be added that information has to be added only to the Natura.resx file. Othwerwise, we have to add it as translation resource into Natura.resx and to Natura.cs as mapping. Therefore my solution is only for better maintainability reasons. |
Makes sense, althought these tables are unlikely to be updated frequently (but we've seen it happening a couple times in the past). I'd say, go on with your approach then, as it only brings advantages over mine. |
781a192
to
79b322e
Compare
@nicolaiarocci Ok, I will continue. I will add a new class for each Tabella with V2 prefix. This is only temporary since I will add unit tests to ensure I do not forget any key or have a typo in values |
@nicolaiarocci I think I have done everything. If this fits for you I can remove all Legacy classes and rename all V2 classes. |
LGTM. I was wondering if, at this point, it would make sense to also add multi-language support to Validatotrs. There aren't many hard-coded strings there, but they could use translation support. As a foreign adopter, what is your opinion? |
Ok, I will then continue with refactoring and replace the hard-coded tabellas with the new one. Yes that would be a nice feature. I can provide a new PR too |
…ature using localization from resources
6ce4d9c
to
7937c90
Compare
Translation done. If something missing please let me know |
Excellent, thank you. |
This PR refactors the code to be able to read the Tabelle from a resource file. I changed the code only for EsigibilitaIVA to show how my idea works.
For that I introduced a new subclass of Tabella, TabellaV2 which contains the new code. Now each key-value-pair Codice-Nome is read from a resource file and allows localization of all values.
If you like this PR and my idea, I can continue to localize other tabellas too.
#416
Tabelle
Validators