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

Localization related Issues #1171

Closed
LHTXQ opened this issue Dec 19, 2022 · 14 comments
Closed

Localization related Issues #1171

LHTXQ opened this issue Dec 19, 2022 · 14 comments

Comments

@LHTXQ
Copy link

LHTXQ commented Dec 19, 2022

Describe the bug
In different languages, it is the "unit name" that should be localized, not the "unit symbol".

To Reproduce

  1. Create an application modeled after the Unit converter app;
  2. Change the CultureInfo from "en-US" to "zh-CN";

Expected behavior
In different languages, it is the "unit name" that should be localized, not the "unit symbol". Please see the screenshots.

Screenshots
image

@LHTXQ LHTXQ added the bug label Dec 19, 2022
@angularsen
Copy link
Owner

Localization of unit names and quantity names is not yet supported.
Feature discussed here:
#397

If you are interested in attempting a pull request, I'm happy to assist.

@LHTXQ
Copy link
Author

LHTXQ commented Dec 24, 2022

I see.
I also want to say that the abbreviation of the unit should not be localized. For example, "cm" should appear as "cm" in any language, not as "厘米" in Chinese. You can see the correct example in my screenshot above.

The following screenshot annotation is a little messy, I wonder if you can understand what I want to express.
image

Finally, I'm still a beginner in programming, so I can't give this project any help on this issue.

@angularsen
Copy link
Owner

For example, "cm" should appear as "cm" in any language

I don't know what is correct in Chinese, but at least for Russian it seems the correct behavior is to translate "cm" to "cм". So I don't agree that it should say "cm" for all languages.

Google translate says "厘米" equals "cm", however, it also says "centimeter" equals "厘米". Does that mean there is no difference between "cm" and "centimeter" in Chinese?

Do you have some source of reference, online examples or second opinion to support removing the Chinese translation to revert to the English abbreviations instead? I don't know the conventions and standards of Chinese language.

Abbreviations were translated to Chinese in this PR:
Add chinese abbreviations for area,length,mass units by chinasqzl · Pull Request #867 · angularsen/UnitsNet

@LHTXQ
Copy link
Author

LHTXQ commented Dec 27, 2022

I think the unit abbreviation is used after the value of the quantity. We usually write "25 cm" when we mean "25 centimeter", not "25 厘米".

771ffdc8122e6d7edb089f47e2ca130

We should probably replace the unit name with the translated unit abbreviation, leaving the unit abbreviation as the English representation:

centimetre - 厘米(This is the current abbreviated translation of centimeter units)
cm - cm.

The following links are examples of solutions to mechanics of materials exercises where you can see our usage of unit symbols (abbreviation): https://max.book118.com/html/2018/1004/8134135067001125.shtm

@angularsen
Copy link
Owner

Thanks for the additional sources. I think you are correct, but I've asked for comments from the PR author in #867 to chime in here just to be extra sure.

@LHTXQ
Copy link
Author

LHTXQ commented Jan 12, 2023

Thanks for the additional sources. I think you are correct, but I've asked for comments from the PR author in #867 to chime in here just to be extra sure.

: |
It looks like he hasn't used Github since July of last year.

@angularsen
Copy link
Owner

No comments from the author, I think we should just proceed with this.

@LHTXQ would you be willing to attempt a pull request? I'm happy to assist.
Generally, just edit the JSON files and run generate-code.bat after.

Detailed steps here: https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit

Note: To avoid breaking change, we need to keep the old unit abbreviations around and mark for removal in #1200 . By inserting the new, correct unit abbreviations first in the JSON array, and keeping the old ones last in the array, we will support both when parsing while the first in the array is used for ToString().

@LHTXQ
Copy link
Author

LHTXQ commented Feb 13, 2023

No comments from the author, I think we should just proceed with this.

@LHTXQ would you be willing to attempt a pull request? I'm happy to assist. Generally, just edit the JSON files and run generate-code.bat after.

Detailed steps here: https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit

Note: To avoid breaking change, we need to keep the old unit abbreviations around and mark for removal in #1200 . By inserting the new, correct unit abbreviations first in the JSON array, and keeping the old ones last in the array, we will support both when parsing while the first in the array is used for ToString().

I would like to contribute to this project very much, but I have been busy recently and have no time to spare.
I asked a friend to do this, and if she has time she should be able to make the change quickly.

It would be great if she could translate the names of common units (units of length) as well! 😄 (College students who use love to generate electricity)

@angularsen
Copy link
Owner

No problem, let me know when you want to proceed in any way. I'll try to assist.

@LHTXQ
Copy link
Author

LHTXQ commented May 27, 2023

Sorry, I forgot what you mentioned above #397 , forget I said any of the following...


I found that there's only "Abbreviation" property in the json file but no "SingularName" property. Does that mean I can't translate the unit name?

    {
      "SingularName": "Gram",
      "PluralName": "Grams",
      "BaseUnits": {
        "M": "Gram"
      },
      "FromUnitToBaseFunc": "{x} / 1e3",
      "FromBaseToUnitFunc": "{x} * 1e3",
      "Prefixes": [ "Femto", "Pico", "Nano", "Micro", "Milli", "Centi", "Deci", "Deca", "Hecto", "Kilo" ],
      "Localization": [
        {
          "Culture": "en-US",
          "Abbreviations": [ "g" ]
        },
        {
          "Culture": "ru-RU",
          "Abbreviations": [ "г" ]
        },
        {
          "Culture": "zh-CN",
          "Abbreviations": [ "克" ]
           //************************************
           //No "SingularName" ?
           //************************************
        }
      ]
    },

If we can translate "SingularName" property, is it possible to do this work by machine translation? In Chinese, as far as I know, almost abbreviations are the same as English, so it's easy for machine translator to tanslate only "SingularName". Maybe other languages' translation work also can be done like this.

@angularsen
Copy link
Owner

Localization feature discussed here:
#397

Also, someone started on an implementation, but progress stopped:
#974

@chinasqzl
Copy link

你说的对。 @LHTXQ

Copy link

github-actions bot commented Jul 8, 2024

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.

Copy link

This issue was automatically closed due to inactivity.

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