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

Localized quantity names #890

Closed
bitbonk opened this issue Jan 6, 2021 · 6 comments
Closed

Localized quantity names #890

bitbonk opened this issue Jan 6, 2021 · 6 comments

Comments

@bitbonk
Copy link

bitbonk commented Jan 6, 2021

Is your feature request related to a problem? Please describe.
I various UIs we need the user to select a quantity, similar the UI in the unit converter sample app. For example for the configuration of the axis of a graph. But the UI must be localized to the culture of the user, hence also the names of units in the selection list must be localized.

Describe the solution you'd like
Just like UnitsNet provides localization for the values (number + unit) of a quantity it should also provide localization for the names of the quantities. For example QuantityInfo.ToString() could return the localized name of the quantity.

Describe alternatives you've considered
The best alternative we could come up with so far is that we could write a tool that adds all names from Quantity.Infos and populate resx files with it, that we then embed in our application. But we would need to synchronize these resx files with the version of UnitsNet that is being used in each project and update them manually whenever a new version of UnitsNet is released. Also this won't solve the problem of localizing custom quantities. It would be nice if the proposed solution could also handle localization custom quantities (the provider of the custom quantity could also provides all localizations for it).

@angularsen
Copy link
Owner

angularsen commented Jan 6, 2021

I believe this has already been discussed in #397 and I think it's a good idea to support something like this.

Would you be interested in writing a short design proposal and then follow up with a pull request when we agree on a design?
Just brief bullets points on what changes you intend to make and how it will be used.

I'm happy to assist.

@bitbonk
Copy link
Author

bitbonk commented Jan 8, 2021

Is there already a way to add a missing language for units in user code (i.e. without having to create a UnitsNet PR) ?
If a user wants to support a language for all or some units that UnitsNet does not yet have, can she do it in her code, without having to wait for UnitsNet to support that language?

I think when coming up with a design, this use case should be taken into account (for both units and quantities).

@angularsen
Copy link
Owner

Yes you can add abbreviations at runtime for 3rd party units:
https://github.com/angularsen/UnitsNet/wiki/Extending-with-Custom-Units

@yannickrondeau
Copy link

@angularsen I haven't been around a lot lately, but I wondered if the proposal discussed in the #397 would still work. I know that some work has been done to the UnitsNet core, thus my question.

@angularsen
Copy link
Owner

@yannickrondeau I looked over the proposal and yes I still think it fits, we don't have anything like this.

@stale
Copy link

stale bot commented Jun 2, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants