-
Notifications
You must be signed in to change notification settings - Fork 404
-
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?
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 1 comment 1 reply
-
Hi, you can simply add a new localization object to a unit's Localization
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 run generate-code.bat
to update the source code.
Beta Was this translation helpful? Give feedback.
All reactions
-
Oh, and in some cases you may have to also specify AbbreviationsForPrefixes
if you need to override the default prefixes k
for kilo, M
for mega etc.
Example:
UnitsNet/Common/UnitDefinitions/Energy.json
Lines 141 to 152 in 9574d47
Beta Was this translation helpful? Give feedback.