-
Notifications
You must be signed in to change notification settings - Fork 69
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
References to units should be in ASCII only #112
Comments
Implement my own suggestion in issue #112
The display text for these units in some places uses characters from the CJK compatibility block that are discouraged (e.g. "\u33ad" for "rad") even though they do semantically represent the unit. This is not consistent though with some using canonical forms even though there are characters to represent them (e.g. "\u33ad/s" rather than "\u33ae" for "rad/s" or "Hz" rather than "\u3390" for frequency). How about moving the display information from This could be addressed by using a semantic reference in the metadata rather than a raw unit. For example, storing "vessel": {
"speedThroughWater": {
"value": 1.0,
"meta" : {
"unitType": "speed.boat"
}
} In "unitTypes" : {
"speed.boat" : {
"unit": "m/s",
"display": "m/s",
"ratio": 1.0
}
} In "unitTypes" : {
"speed.boat" : {
"unit": "m/s",
"display": "kts",
"ratio": 1.94384
}
} |
The specification json schema files are the master for unit information. Did you notice https://github.com/SignalK/specification/blob/master/keyswithmetadata.json ? That is generated from json schema. I'm not 100% convinced that the extra indirection layer for specifying the display units is worthwhile. In the end the display units are up to the Signal K consuming application. |
If we do start catering for localization we should also cater for locales that use more than one presentation for a particular value. Nautical distance is expressed differently in some locales depending on the distance. For example I guess this is why my Navico chartplotter has a "small distances" and "large distances" unit selection mechanism. The next problem is that some people like a particular language but not a particular locale. Myself, I'm particular to and I prefer an english language UI but with local units. |
That is the kind of use-case I was envisioning by this change. How a quantity is presented can depend on what is being measured, the locale of the user (both language and location i.e. en_GB differently to en_US or en_DE), and ultimately user preference.
The rules for formatting a value can be specified for each value (supporting @canboat's case); this is similar to how ICU encodes rules for its MeasureUnit in its underlying model. @tkurki Moving this to i18n separates this from the data model and makes it a presentation concern. Basing this off the key values (like As an example, |
Sounds like something that would come useful, but a closed SI unit issue is the wrong place to have this discussion. Would you care to outline your solution in a separate issue? And I encourage you to come up with content for an actual solution & submit a pull request. In Signal K context it all starts with the schema keys - your UI gets data for a key, say The open content part I don't get - how and why would stuff not in the schema be mapped in Signal K localization files? |
When a unit has a Unicode string (for instance \u00b0 for degrees) label this ends up in various places in the model, which might not be readable in all editors.
The 'units' description in
definitions.json
should contain a map"label": { "display": "\uxxxx" .... }
The text was updated successfully, but these errors were encountered: