-
Notifications
You must be signed in to change notification settings - Fork 391
Implementation of the localized Quantities and Units' name. #397
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
Comments
I think this proposal looks pretty good and something we can extend upon. I like how Just to be clear on the terminology, we define Did you intentionally put |
It wasn't intentional, it should indeed be a value, defining multiple name for one culture wouldn't make much sens. I updated the description with the new terminology (Thanks). I will be working on the above implementation as a proof of concept. I know that some libraries are also localized (such as Fluent Validation) and will take a look at them to see how they did it and if we could improve from the above solution. |
So, what remains to decide is how to access these localized names of quantities and units. Bear in mind that we also have a base type discussion #371 going on in parallel that might influence this design. I see two options: Static getter methods per quantityThe advantage of this is better intellisense and a more intuitive method signature, since we can hard code the
Implemented with straight forward static methods:
Instance getter methods in UnitSystemThe advantage of this is less code and binary size, since we only need one method instead of one for each of the 60+ quantities.
Implemented similar to GetDefaultAbbreviation():
|
Considering the #371 feature, would it be better to keep the implementation as similar as possible to the current one ? If so, I would prefer implementing it using the same behavior as the GetDefaultAbbrebiation() |
Sorry for slow answer. I agree, for now let's go with On second look, my earlier example should be:
|
Just checking in, can we help make any progress here? |
Hi @angularsen! I started reviewing the code and the json files to see how we could achieve this. I did not have any time to continue working on this lately. I should be working on this this weekend. |
Awesome! |
Just a head up here, I've been working on this on my own repository. Still got a lot to figure out, I want to make sure I understand the framework correctly. However, I think that we might be able to work something out. I'll try to keep you updated of the progress. Currently this si not a major issue on our end, which is why I haven't got a lot of time on it. |
Thanks for the update, let me know if I can help in any way. --
*Andreas Gullberg Larsen* | +47 975 70 270 <+47%20975%2070%20270> | Leinsmoen
7, 7655 Verdal, Norway
|
Hi! It's been a while since I gave news on this feature request. I've been busy lately with company stuff and couldn't work on this at all. However, it just came back on the table internally here with localization issues, therefore I started working on it again. From what I've revised so far, the abbreviations are loaded trough the localization class I will give more news in the upcoming days. Again, sorry for the time it took me to get going on this. |
Welcome back :-)
No problem, I fully understand how the interest in libs can come and go.
I agree that localization should be optional, in the sense that if a
culture is not defined it falls back to en-US (as we already do) and if
maybe SingularName or PluralName is not defined for say French, it would
fall back to en-US for the missing values. At least in my mind that is what
seems the most intuitive?
--
*Andreas Gullberg Larsen* | +47 975 70 270 <+47%20975%2070%20270> | Leinsmoen
7, 7655 Verdal, Norway
|
Still on this? :-) |
Hi @angularsen, Unfortunately, I didn't had enough time to complete the changes I've made so far. We are currently holding the projet using the Units Net framework and moved to another project, therefore I don't have any time available right now. If this isn't implemented by someone else, I might consider implementing it later when we will be back on our project using it. Sorry for the late answer and feedback regarding this issue. |
No problem, I understand. I'll close this issue for now, but please reopen if you later want to pick up on this. |
#974 started implementing this |
Problem
The library offers method to get the unit abbreviation localized. However, there is no way of localizing the quantity and unit's name. It would help if the library could handle localization of them "built-in".
Solution
Currently the localization is handled in Json files under the
Localization
field. The idea would be to duplicate this field for each properties that defines names so each names can be localized.Here is an example of the localization within a json file.
This feature could be linked to #371. The public properties and the abstract class could implement the methods and properties to access the localized names. In a similar way of the abbreviation.
The text was updated successfully, but these errors were encountered: