- From: Matthew Ström via GitHub <sysbot+gh@w3.org>
- Date: Mon, 05 Dec 2022 15:23:57 +0000
- To: public-design-tokens-log@w3.org
> This issue is not about string values, it is about keywords
Yes, sorry, I was using "string" to mean "a piece of text".
I think many use cases can be covered by defining escape sequences (#171). That will help an author in cases like:
```json
{
"keyword-like-font-name": {
"$value": "Helvetica",
"$type": "string"
},
"string-like-font-name": {
"$value": "\"Helvetica\"",
"$type": "string"
}
}
```
(maybe `string` isn't the right word here, but I don't think `keyword` is, either. Maybe something like `raw` or `preformatted`? see #91 )
Which, when translated into css variables, would result in the following.
```css
:root {
--keyword-like-font-name: Helvetica;
--string-like-font-name: "Helvetica";
}
```
If you'll forgive the pedantry, in this example,
```json
{
"$value": "infinity"
}
```
```js
const foo = Infinity;
```
`Infinity` is a number, not a keyword (is this a good argument for having a `number` type in the spec?)
---
The cases that are not covered by the `string` type and escaping are where each platform has a different convention for referring to the exact same thing.
Your font example is the most salient one. In CSS, the keyword for "the default system font" is `system-ui`. In Swift, (please correct me if i'm wrong), you need to use the `.system()` class with a required `size` property (eg `.system(size: 34)`).
Which leads to the question: should translators be required to maintain the mapping these one-to-many keyword values in tokens to the correct platform-specific versions? Or should the spec allow for the author to provide the mapping? Or both?
--
GitHub Notification of comment by ilikescience
Please view or discuss this issue at https://github.com/design-tokens/community-group/issues/177#issuecomment-1337569202 using your GitHub account
--
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Monday, 5 December 2022 15:23:59 UTC