Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add new language#1170

Unanswered
rolandow asked this question inQ&A
Dec 15, 2022· 1 comments· 1 reply
Discussion options

How can we add translations for an other language? Currently en-US and ru-RU seems to be defined, but how can we extend the library with our own language that does not exist in the library yet?

I assume we can define some json, and then load this to the library as well?

What would be the right procedure?

You must be logged in to vote

Replies: 1 comment 1 reply

Comment options

Hi, you can simply add a new localization object to a unit'sLocalization array.

Here is Chinese (zh-CN), for example:
https://github.com/angularsen/UnitsNet/blob/master/Common/UnitDefinitions/Length.json#L64-L77

This will have to be done for each unit you want to translate. The fallback is always en-US.

Then rungenerate-code.bat to update the source code.

You must be logged in to vote
1 reply
@angularsen
Comment options

Oh, and in some cases you may have to also specifyAbbreviationsForPrefixes if you need to override the default prefixesk for kilo,M for mega etc.

Example:

"Localization": [
{
"Culture":"en-US",
"Abbreviations": ["th (E.C.)" ],
"AbbreviationsForPrefixes": {"Deca":"Dth (E.C.)" }
},
{
"Culture":"ru-RU",
"Abbreviations": ["Европейский терм" ],
"AbbreviationsForPrefixes": {"Deca":"Европейский декатерм" }
}
]

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Category
Q&A
Labels
None yet
2 participants
@rolandow@angularsen

[8]ページ先頭

©2009-2025 Movatter.jp