Refine Discourse Units

Hello,
this feature request is simple; all I am requesting is that the keywords for Discourse Units be truncated from one letter. Meaning instead of the confusing way it tries to convert something when I say: “60 invites” it will pick up a whole word i.e. 60 inches

This confused me when I started using WFC, so I thought a little refresh could be good for our many new users to come!

This task should just require some back end, I actually have the Git link so in case you want to try it out :slight_smile:

https://github.com/udan11/discourse-units/tree/master/javascripts/discourse-units/lib/definitions

Voted! It’s quite annoying, lol. Plus, if you really need to convert something, the mighty fine Google works!

2 Likes

Yes that’s very true.

Now on to the backend if Zac or you develops it; I don’t know JS by heart but I came up with a lil’ something for you if you want to see how it works :slight_smile:

export default [
  {
    type: "duration",
    scale: "time",
    symbols: [ "millisecond"],
    si: 1 / 1000
  },

  {
    type: "duration",
    scale: "time",
    symbols: [ "second"],
    si: 1
  },

  {
    type: "duration",
    scale: "time",
    symbols: ["minute"],
    si: 60
  },

  {
    type: "duration",
    scale: "time",
    symbols: ["hour"],
    si: 60 * 60
  },

  {
    type: "duration",
    scale: "time",
    symbols: ["day"],
    si: 24 * 60 * 60
  },

  {
    type: "duration",
    scale: "time",
    symbols: ["week"],
    si: 7 * 24 * 60 * 60
  },

  {
    type: "duration",
    scale: "time",
    symbols: ["month"],
    si: 30 * 24 * 60 * 60
  },

  {
    type: "duration",
    scale: "time",
    symbols: ["year"],
    si: 365 * 24 * 60 * 60
  },

  {
    type: "duration",
    scale: "time",
    symbols: ["decade"],
    si: 10 * 365 * 24 * 60 * 60
  },

  {
    type: "duration",
    scale: "time",
    symbols: ["century"],
    si: 100 * 365 * 24 * 60 * 60
  }
];






Now this is for Length:
‘
export default [
  // Metric
  {
    type: "length",
    scale: "metric",
    symbols: [“millimeter"],
    si: 1 / 1000
  },

  {
    type: "length",
    scale: "metric",
    symbols: ["centimeter"],
    si: 1 / 100
  },

  {
    type: "length",
    scale: "metric",
    symbols: [“meter"],
    si: 1
  },

  {
    type: "length",
    scale: "metric",
    symbols: ["kilometer"],
    si: 1000
  },

  // Imperial
  {
    type: "length",
    scale: "imperial",
    symbols: ["inch", '"'],
    si: 1 / 39.3701
  },

  {
    type: "length",
    scale: "imperial",
    symbols: ["yard"],
    si: 1 / 1.09361
  },

  {
    type: "length",
    scale: "imperial",
    symbols: ["foot", "feet", "'"],
    si: 1 / 3.28084
  },

  {
    type: "length",
    scale: "imperial",
    symbols: ["miles"],
    si: 1609.34
  }
];

Mass:

export default [
  {
    type: "mass",
    scale: "metric",
    symbols: ["ug"],
    si: 1 / 1000000000
  },

  {
    type: "mass",
    scale: "metric",
    symbols: ["mg"],
    si: 1 / 1000000
  },

  {
    type: "mass",
    scale: "metric",
    symbols: ["gram"],
    si: 1 / 1000
  },

  {
    type: "mass",
    scale: "metric",
    symbols: ["kilogram"],
    si: 1
  },

  {
    type: "mass",
    scale: "metric",
    symbols: ["t"],
    si: 1000
  },

  // Imperial
  {
    type: "mass",
    scale: "imperial",
    symbols: ["oz"],
    si: 1 / 35.274
  },

  {
    type: "mass",
    scale: "imperial",
    symbols: ["lb"],
    si: 1 / 2.20462
  }
];
1 Like

Personally, I would love to add the stuff, but I need some complications. The way that the other team is true of repository. I’ll try adding this as a CSS and see if it works, but I’m not sure. If not, the developer is working on a fix, so it has been disabled for now. If no fix available, we will take a vote whether to deal with it or to just get rid of it

1 Like