Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>It's awfully hard to prove a negative. But I suspect you are out of luck.</p> <p>The most comprehensive collection of culture-specific names, preferences, and units that I know of is the Unicode <a href="http://cldr.unicode.org/index" rel="nofollow">Common Locale Data Repository (CLDR)</a> project. Looking at the <a href="http://www.unicode.org/repos/cldr-aux/charts/23.1/summary/root.html" rel="nofollow">summary of its most recent, v23.1, release</a>, I can see entries for currencies, time zone cities, names of time intervals, phrases for "in {0} months" and "{0} seconds ago"... but not cultural conventions for units of mass and volume. </p> <p>If the CLDR doesn't have it, I'd be surprised if there is any off the shelf collection that does have it.</p> <p>What you will need is:</p> <ul> <li>Data about which units various locales favour, for various kinds of measurement (mass, volume, etc.) Good luck getting single answers to such questions; in western Canada I see people using a mish-mash of pounds and kilograms, metres and feet, °F and °C, in everyday life. This is the data which may not be collected anywhere.</li> <li>Names used for the various units in various locales. Whether we use metres or feet in this part of Canada, you'll want to have words for both units in all the languages your users use (English, French, simplified Chinese, Urdu,...). Any localiser could get you these word lists.</li> <li>A mechanism to manage and retrieve the names of the various units, by locale. <a href="http://docs.python.org/2/library/gettext.html" rel="nofollow">Gettext</a> can do this for you. </li> <li>A mechanism to manage and retrieve the identifiers for the various units, by locale. I haven't heard of any mechanism that does this directly, but you could write one yourself, or maybe repurpose Gettext.</li> <li>Application logic to take a locale and a kind of unit, retrieve the identifier for the unit in that locale, and look up the locale's name for that unit in the target locale.</li> <li>Application logic to convert quantities from one unit to another. I suspect this would be simple to write yourself. Finding the conversion coefficients shouldn't be hard.</li> <li>Data about how various locales format numbers, and a mechanism to manage and retrieve that data. CLDR does do this for you. There has been some work on using <a href="http://cldr.unicode.org/index/cldr-spec/json" rel="nofollow">JSON bindings of CLDR in Python</a>.</li> </ul> <p>As a closing thought: your question presupposes "a need to internationalize units system". Have you studied your users and your product to see how they use units and how the product uses units, so that you are sure an automatic change of units is appropriate? I live in a country that is officially metric, but is overshadowed by a country that is emphatically <em>not</em> metric. I would rather have apps present grams, or pounds, or whatever unit the content author decided. If I want to convert, sometimes a precise conversion is good, and sometimes an approximate conversion is more useful ("2 pounds" can sometimes be a better rendering of "1 kilo" than "2 pounds 3.2 oz"). Before you invest too much work in this tool you seek, I suggest investing some time in your requirements.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload