currency-brainstorming-fr

From Microformats Wiki
Revision as of 13:51, 1 May 2007 by AndyMabbett (talk | contribs) (rm redundant link)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Brainstorming

Brainstorming pour le microformat proposé currency.


Ben Buchanan

Verbeux mais extensible et définit explicitement toutes les valeurs (sans briser le DRY) :

<div class="currency">
  <p class="figure">
     <span class="code">code</span>
     <span class="sign">symbol</span>
     <span class="amount">12345</span>
  </p>
</div>

"figure" est là pour associer explicitement le code, le signe et le montant mais permet aussi le potentiel pour plus d'un chiffre de devises pouvant être placé dans le conteneur. Cela anticipe vraiment de plus amples développements et cest l'item le plus facilement laissé tombé au premier stade.

Sans "figure" :

<div class="currency">
     <span class="code">code</span>
     <span class="sign">symbol</span>
     <span class="amount">12345</span>
</div>

Super raccourci, s'appuyant sur le parseur pour tout identifier via un ordre/structure implicite :

<div class="currency">ABC12345$</div>

Bien que ce soit la solution la plus simple, cela a une vulnérabilité notable : quelques devises ont/avaient des abréviations en trois lettres pour leur signe de devise, au lieu d'un symbole. Ceci ferait qu'il serait très difficile pour un parseur d'identifier précisément une telle devise..

En outre, il devrait être noté que le tri seul ne peut pas être utilisé pour identifier quelles parties sont du code, un signe et un montant ; parce que beaucoup de devises sont affichées avec le signe après le nombre.

Super raccourci, mais spécifiant un code devise comme une classe :

<div class="currency ABC">12345$</div>

Cela définit...

  1. nous parlons d'argent - standard ISO implicite,
  2. nous parlons de la variété USD,
  3. nous parlons de 50 unités de cet argent,
  4. un parseur pourrait déduire les nombres et le symbole.

La plus grosse limite que je vois pour ce raccourci est que le code devise n'est pas affiché visiblement pour les lecteurs humains. Le code devise est une information utile pour les lecteurs et devraient idéalement être affiché.

Raccourci (y compris le fait de laisser tomber 'figure", mais définissant explicitement et affichant le code devise. Ceci permettrait aussi à un parseur de traiter les nombres restants comme le montant ; et tout a-z restant ou symbole comme le signe :

<div class="currency">
  <span class="code">ABC</span>12345$</p>
</div>

Charles Iliya Krempeaux

Peut-être quelque chose comme...

Donnez-moi <abbr class="currency" title="CAD">$</abbr>5.00 maintenant !

Même si quelque chose comme ce qui suit pourrait être mieux...

Donnez-moi <span class="money"><abbr class="currency" title="CAD">$</abbr>5.00</span> maintenant !

Mais ce pourrait être encore plus salé sémantiquement que ce qui peut être considéré comme nécessaire. Avoir simplement la classe-devise près d'un nombre pourrait être assez suffisant. Mais c'est néanmoins ouvert à la discussion.

Ben Ward

Un HTML pur pourrait-il être suffisant ?

<html lang="fr-fr">
<p>Mes nouveaux T-shirts coûtent €40, mais ils ont coûté à mon ami au Canada <span lang="en-ca">$34</span></p> 
</html>

Arve Bersvendsen

<p lang="nb">Den kanadiske prisen på t-skjorten var <span class="currency CAD">34 $</span>.</p>

Mike Stickel

<span class="money"><abbr class="currency" title="CAD eng">$</abbr><span class="amount">5.00</span></span>

Dans ce format l'emballage serait "money" ou quelque chose d'équivalent suivi soit par le "amount" véritable ou quelque chose de similaire suivi par soit le "amount" véritable ou la "currency", selon les règles que votre pays/langue suit eu égards à la commande. Parce qu'il peut y avoir une différence entre différentes langues dans les pays, je pense que ce pourrait être une bonne idée d'inclure que dans la définition de la devise "currency" du formatage, par ex, "CAD eng" ou "CAD fr". Ce pourrait aussi donner des sites qui listes plusieurs langues un moyen de faire la différence quand ils présentent plusieurs prix.

Ciaran McNulty

Le seul microformat que j'ai remarqué pour les unités de devise est hListing, et qui répugne à faire de parser les valeurs véritables parce qu'il est trop libre-formulaire dans la plupart des formats de listing existants.

Ma préférence personnelle serait quelque chose comme :

<p class="money">Cet item coûte
  <span class="currency">EUR</span>
  <span class="amount">10.00</span>
</p>

Ce qui avec des règles de parsage équivalentes aux formats existants permettrait des choses comme :

<p class="money">
  Cela vous coûtera
  <abbr class="currency" title="50.00">cinquante</abbr>
  <abbr class="amount" title="GBP">quid</abbr>
  , cher ami!
</p>

Ou dans un exemple plus complexe en plusieurs langues :

<p lang="fr">Prix :
<span class="money">
  <abbr class="currency" title="GBP">£</abbr>  
  <span class="amount">1,250.00</span> 
</span> 
<span lang="fr" class="money">
  (Prix:
  <span class="amount">1600,00</span>
  <abbr class="currency" title="EUR">&euros;</abbr>
  )
</span>
</p>


Andy Mabbett

Straw man proposal

(this reflects Ciaran McNulty's proposals, above)

In order to use currency as a sub-class, the parent should be named 'money'

  • money - class (required) [or "currency"?]
    • currency - class (required; uses ISO 4217) [or "type"?]
    • amount - class (required) [or "value"?]
    • year - class (optional - for historic values only) (better "date", in datetime-design-pattern. Consider inflation in Germany in 1930s!)
    • symbol - class (optional - so that we know whether the symbol is present; or whether it needs to be generated by the user agent; it will also help user agents to ignore $ and other such symbols, when used for purposes other than to indicate a currency, or to remove them, when translating to a different currency.)
    • unit - class (subdivison of currency; use as "symbol")
    • equivalence - class (optional; conversion should be done by the user agent. Do we need this? Does it need a numeric value?)

All classes may occur only once, apart from symbol (to allow for "£14 6s 2d") and unit (to allow for "five pounds 23 pence").

Examples

Thus:

	<span class="money">A widget costs 
		<abbr class="currency symbol" title="USD">$</abbr>
		<span class="amount">12.57</span>
	</span>
	<tr>
		<th>Spaghetti-knitter</th>
		<td class="money">
			<abbr class="currency" title="USD">
				<span class="amount">42.67</span>
			</abbr>
		</td>
	</tr>
	<span class="money">
	Can you spare
		<abbr class="amount" title="10">ten</abbr>
		<abbr class="currency" title="USD">
			<span class="unit">dollars</span>
		</abbr>?
	</span>
	<span class="money">
		It was worth 
		<abbr class="amount" title="0.5">50</abbr> 
		<abbr class="currency" title="GBP">
			<span class="unit">pence</span>.
		</abbr>
	</span>

(note, in the above, that "unit" does not relate directly to the amount in the amount's title abttibute - it's 0.5 pounds, not 0.5 pence.)

	<span class="money">In 
		<span class="year">1857</span>
		 a Dickens novel cost
		<abbr class="amount" title="0.05">1</abbr>
		<abbr class="currency" title="GBP">
			<abbr class="symbol unit" title="shilling">/</abbr>
		</abbr>
	</span>

(The above might be rendered as "... 1/ (worth £4.50 in modern terms" (or whatever the value would be).)

<span class="money">
	<abbr class="amount" title="14.32">
		<abbr class="currency" title="GBP">
			<abbr class="symbol" title="pound">£</abbr>14 
		</abbr>
			6<abbr class="unit" title="shilling">s</abbr> 
			4<abbr class="unit" title="old-penny">d</abbr>
	</abbr>
</span>
	<span class="money">
		<abbr class="equivalence" title="EUR">
			<abbr class="currency" title="FFR">10</abbr>
		</abbr>
	</span>

The following, simplified for clarity, from [1]:

    On
    <span class="currency">
	<abbr class=date" title="1922-08-01>August 1</abbr>, 
	the US Dollar still stood at 
	<span class="value">643</span> 
	<abbr class="type="GDM">Marks</abbr>
    </span>
    to the Dollar. But on 
    <span class="currency">
	<abbr class=date" title="1922-09-05>September 5</abbr> 
	the dollar had already risen to 
	<span class="value">1,440</span> 
	<abbr class="type="GDM">Marks</abbr></span>
    </span>

Is there anything sensible which can't be done with the above?

Assumptions
  • Working out values in secondary currencies is a (real-time or daily) job for server-side scripting or user agents.
  • If "£" is an abbreviation, then its title is "pounds sterling"; though note that "£5" is pronounced as "five pounds sterling" (commonly just "five pounds") and not: "pounds sterling five" in the same way that "$5" is pronounced as: "five dollars" and not "dollars five"
Issues
  • There will be complications where the entire currency has disappeared, (such as the last example; French Francs into Euros).
  • Where no symbol or unit is involved (chiefly in tables, where they will be in the header cell), should we allow:
	<tr>
		<th>Spaghetti-knitter</th>
		<td class="money USD amount">42.67</span></td>
	</tr>

Guillaume Lebleu

In the context of a hListing's price, without a unit:

<span class="price"><abbr class="currency" title="EUR">€</abbr>100</span>

Rendered view:

100

In the context of a hListing's price, with a unit:

<span class="price currencyamount"><abbr class="currency" title="USD">$</abbv><span 
class="amount">25</span> <span class="unit" title="BLL">per 
barrel</span></span>
<span class="price currencyamount"><span class="amount">25</span> <abbr class="currency" 
title="USD">$</abbr><abbr class="unit" title="BLL">/bbl</abbr></span>

Note: the class "amount" may not always be required, but it is useful when the amount is represented as text, or when the amount is mixed within text. See historical example below.

Rendered view:

$25 per barrel

25 $/bbl

Outside of the context of a hListing (not all currency amounts are prices, for instance sales numbers):

<span class="currencyamount"><abbr class="currency" title="EUR">€</abbr>100</span>

Historical price (here currency rate):

<span class="price currencyamount">On <abbr class="datetime" 
title="1998-03-12T08:30:00-05:00">August 1</abbr>, the US Dollar still 
stood at <span class="amount">643 <abbr class="currency" 
title="DEM">Marks</abbr></span> to the <span class="unit currency" 
title="USD">Dollar</span>.</span>

In a table:

<table>
   <tr>
      <th class="currencyamount price">Price (<abbr class="currency" title="CAD">C$</abbr>)</th>  
   </tr>
   <tr>
      <td>100</td>
   </tr>
</table>

Rendered view:

Price (C$)
100

Gary Jones

<span class="currency">
   <abbr class="type" title="CAD">$</abbr>
   <span class="value">5.00</span>
</span>

Renders as:

$5.00

If the formatting of a currency is such that the type symbol comes after the value, then simply swap the order of the type and value elements.

I do think that the use of "type" and "value" classes would be better than variations of "currency_symbol" and "amount". It follows the same principles as some other elemental formats (value excerpting), meaning it's easier to remember and implement, and even ISO4217 has codes for "currencies" that don't use symbols:

<span class="currency">
   <span class="value">23</span> ounces of
   <abbr class="type" title="XAG">gold</abbr>
</span>

Renders as:

23 ounces of gold

Following on from this, the use of a "money" class should not be used; currency does not have to be money, and having a "metal" class starts to make it convoluted. Currency is the parent of money, not the other way around.

Mike Schinkel

I'm taking Andy Mabbett's post and applying my thoughts to his.

Rather than:

	<span class="money">A widget costs 
		<abbr class="currency symbol" title="USD">$</abbr>
		<span class="amount">12.57</span>
	</span>

Why not just:

	A widget costs <span class="currency" title="USD">$12.57</span>

In the above, a number is assumed because their is not an "amount", and the number digit is the currency symbol. I guess what I'm saying is if there is a number in the HTML and it is the correct number (which I think will be the 80 percentile case, give or take, then why require additional markup for it?)

Rather than:

	<tr>
		<th>Spaghetti-knitter</th>
		<td class="money">
			<abbr class="currency" title="USD">
				<span class="amount">42.67</span>
			</abbr>
		</td>
	</tr>

Just:

	<tr>
		<th>Spaghetti-knitter</th>
		<td class="currency" title="USD">42.67</td>
	</tr>

Or:

	<tr>
		<th>Spaghetti-knitter</th>
		<td>
			<span class="currency" title="USD">42.67</span>
		</td>
	</tr>

In this case, which is a little more complicated:

	<span class="money">
	Can you spare
		<abbr class="amount" title="10">ten</abbr>
		<abbr class="currency" title="USD">
			<span class="unit">dollars</span>
		</abbr>?
	</span>

Why not use the following:

	Can you spare
	<span class="currency" title="USD">
		<abbr class="amount" title="10">ten</abbr>
		<span class="unit">dollars</span>
	</span>?

Here:

	<span class="money">
		It was worth 
		<abbr class="amount" title="0.5">50</abbr> 
		<abbr class="currency" title="GBP">
			<span class="unit">pence</span>.
		</abbr>
	</span>

Why not?

	It was worth 
	<span class="currency" title="GBP">
		<abbr class="amount" title="0.5">50</abbr>
		<span class="unit">pence</span>
	</span>?

I'm not going to try to mark up the following two since, thus far, no one has voted for dated money amounts or non-numerical representations (those might be better expressed in their own microformat: hHistoricalCurrency?):

	<span class="money">In 
		<span class="year">1857</span>
		 a Dickens novel cost
		<abbr class="amount" title="0.05">1</abbr>
		<abbr class="currency" title="GBP">
			<abbr class="symbol unit" title="shilling">/</abbr>
		</abbr>
	</span>


<span class="money">
	<abbr class="amount" title="14.32">
		<abbr class="currency" title="GBP">
			<abbr class="symbol" title="pound">£</abbr>14 
		</abbr>
			6<abbr class="unit" title="shilling">s</abbr> 
			4<abbr class="unit" title="old-penny">d</abbr>
	</abbr>
</span>

I don't understand what this is trying to accomplish (it seems incomplete), so I can't mark it up.

	<span class="money">
		<abbr class="equivalence" title="EUR">
			<abbr class="currency" title="FFR">10</abbr>
		</abbr>
	</span>

Again, I'm not going to try to mark up given the lack of interest in dated money amounts:

    On
    <span class="currency">
	<abbr class=date" title="1922-08-01>August 1</abbr>, 
	the US Dollar still stood at 
	<span class="value">643</span> 
	<abbr class="type="GDM">Marks</abbr>
    </span>
    to the Dollar. But on 
    <span class="currency">
	<abbr class=date" title="1922-09-05>September 5</abbr> 
	the dollar had already risen to 
	<span class="value">1,440</span> 
	<abbr class="type="GDM">Marks</abbr></span>
    </span>

My efforts attempt to minimize the disruption in the HTML file and only use additional markup when absolutely required. I believe some high volume websites still try to minimize the markup they serve, and this is bloated as it it. They may decide just to serve up a few digits rather than 50 character per price, especially on pages with lots of prices.

References