Keyword for units for internationalization #51
Replies: 2 comments
-
Probably also shortcuts for
|
Beta Was this translation helpful? Give feedback.
-
This is a hard problem to solve and I my goal is make computers to do their job and keep recipe files clean and language simple. I don't have full solution yet, but I'll share the direction. Please, suggest your ideas too!
For mass/mass, volume/volume I think to use conversion table in this way (example for people from Europe):
The item on the left is "domestic" and parser will prefer it over the right side when makes the plan for converting units. For the US cups will be on the left. The beauty of this approach is that people tune their level of control, because some prefer to have everything measured in grams and some are fine with approximate values. The problem I can't solve with this approach is how to use different "domestic" units in the same time based on value itself and pick one which is more suitable for formatting, for example parser should prefer For mass/volume and volume/mass there's no other way, but to introduce an ingredient density: conversion rules which applicable only to one ingredient. I though to have a yaml file per ingredient where we store conversion rules (and later also nutrition values): # filename potato.yaml
conversion:
- "50%g = 1%medium"
- "0.7%kg = 1%l"
nutrition:
... Perhaps add some sane default values as well which can be used if nothing like that provided. On the left it should always be mass units and on the right volume. Definitely this whole thing will require a command in CLI (like |
Beta Was this translation helpful? Give feedback.
-
As fas as I understand the specification allows dynamic units for ingredients. This is great if Americans want to share recipes with other Americans. However Cups are not a common or meaningful unit in Europe. A great addition would be keywords for mass (at 9.81 m/s^2) and volumes.
For the metric systems those could be:
l
for litres. Alternatives are possible for better readability.ml
for millie litres.dl
for dezi litre.kg
for kilograms.g
for grams.mg
for millie grams.The renderers for the recipes could then dynamically convert the units into the unit needed. This also would make recipe sharing much more easier.
Beta Was this translation helpful? Give feedback.
All reactions