[Tex/LaTex] Is it possible in Latex to convert all numbers between imperial and metric

units

This question led to a new package:
smartunits

I am currently writing a document that I would like to deploy to both European and American audiences. The problem is, as usual, the choice between imperial vs metric units.

The text is not scientific, and not meant for a scientific audience, so I cannot simply use metric units all the way through and call it a day. Since many of the units are buried in the text, finding them all and changing them is quite cumbersome (even with the use of hidden comments as guiding flags).

What I am looking for is a method to offer the best out of both worlds. I am looking for something that can convert all metric units into imperial and vice versa. The ideal scheme would look like this:

\usepackage{smart_unit_package}

\smart_unit_convert{imperial}
...

\begin{document}
Oscar Wilde's height is said to have been \smart_unit{1.91}{meter}.
\end{document}

Which should hopefully result in:

Oscar Wilde's height is said to have been 6'3''

The idea behind it would be that the units can be controlled from the preamble, without having to alter the text.

Is there such a package available, or is it easily possible to create my own solution (I'm not that great at coding, and have never even tried writing anything in Tex before)?

I took a look at the siunitx package, but there is nothing in there about converting units back and forth.

Edit: As per Joseph Wright's comment, a few more details:
The units to convert would, at the minimum, be for weight, length, and time (with the last one optional, but advantageous). The conversion should be from standard metric (kilograms, meters, 24:00 format) to imperial (pounds, feet, 12 AM/PM format).

If I personally were writing a package, I would probably allow for certain command flags (e.g.: kilometer should translate to miles, not to thousands of feet), and body height (say 189 cm) should convert to 6'2'', not to "2 yards".

I realize that getting this right for every possible scenario (body height, mountain height, small distance, large distance, etc. etc.) is somewhat complex (mostly thanks to the weird parts of the imperial system).
As to accuracy: Since it is not written for a scientific audience, any rounding up to the decimal point is fine. I.e.: 1 meter can easily convert into 3 feet, even if it is not really exact. Of course, if more accuracy were needed, a roundoff-point would be necessary.

Second edit: A simple hack that I think might also work (even if it's not really elegant), is a way in latex to define two words. For instance:

Oscar Wilde's height is said to have been \twowords{191cm}{6'3''}.

With some possibility of choosing which one gets selected in the preamble. This would force the user to convert everything by himself, but it would allow easy swapping between units, at least.

Best Answer

Implementing your hack is quite easy:

\newif\ifMetric\Metrictrue% metric by default
\newcommand\MyUnit[2]{\ifMetric #1\else #2\fi}% \MyUnits{metric}{imperial}

Then you can simply use \MyUnit{191cm}{6'3''} in your document and change between metric and imperial at any point using \Metrictrue and \Metricfalse.

Here's a full example (with a crude use of SIunits as requested in the comments):

\documentclass{article}
\usepackage{SIunits}
\newif\ifMetric\Metrictrue% metric by default
\newcommand\MyUnit[2]{\ifMetric #1\else #2\fi}% \MyUnits{metric}{imperial}

\begin{document}
   Metric: \MyUnit{191 \centi\meter}{$6'3''$}

   \Metricfalse Imperial:  \MyUnit{191 \centi\meter}{$6'3''$}

   \Metrictrue Metric:  \MyUnit{191 \centi\meter}{$6'3''$}
\end{document}

and the output:

enter image description here

Edit: the smartunits package

When I first wrote this post I said that it ought to be possible to do this properly using pgfkeys. Partly as a proof-of-concept, and partly as an exercise to learn how to use pgfkeys, there is now a smartunits package for converting between metric and Imperial units.

Here is a MWE:

\documentclass{article}
\usepackage{smartunits}
\usepackage{xcolor}
\usepackage{listings}\lstset{language=[LaTeX]TeX}
\lstset{language=[LaTeX]TeX,
        texcsstyle=*\bfseries\color{blue},
        keywordstyle=\color{blue},
        commentstyle=\color{brown},
        morekeywords={SmartUnit,SmartUnitSettings,sisetup},
}

\begin{document}
  \begin{lstlisting}[texcl]
      \SmartUnitSettings{metric imperial, places=1}
      \SmartUnit{km=100.0,figures=1}   % \SmartUnit{km=100.0,figures=1}
      \SmartUnit{miles=62.15,places=1} % \SmartUnit{miles=62.15,places=1}
      \SmartUnit{cm=10}                % \SmartUnit{cm=10}
      \SmartUnit{celsius=20}           % \SmartUnit{celsius=20}
      \SmartUnit{miles=5.0, figures=1} % \SmartUnit{miles=5.0, figures=1}
      \SmartUnit{miles=5.0,places=2}   % \SmartUnit{miles=5.0, places=2}
      \SmartUnit{hours=0, minutes=59}  % \SmartUnit{hours=0, minutes=59}
      \SmartUnit{hours=12, minutes=12} % \SmartUnit{hours=12, minutes=12}
      \SmartUnit{kg=10.0, places=1}    % \SmartUnit{kg=10.0, places=1}
      \SmartUnit{pound=10.0,figures=1} % \SmartUnit{pound=10.0,figures=1}
      \SmartUnit{l=10.0, places=1}     % \SmartUnit{l=10.0, places=1}
      \SmartUnit{L=10.0, places=1,uk}  % \SmartUnit{L=10.0, places=1,uk}
  \end{lstlisting}
\end{document}

and here is the output this produces:

enter image description here (There is some trickery using the listings package to have LateX typeset the commands after the %'s on each line.)