"Wikitravel has a speed and convenience the books' publishers can only envy." Time Europe

Tech:Automatic area codes in listings

From Wikitravel Shared
Jump to: navigation, search

For Wikitravel, we've always had a tension in phone numbers in listings between showing the full number for international dialing (with country code, city code, etc.) and showing the just the locally dialed part. We came up with a nice compromise of formatting the area codes differently (italic) so someone calling from outside the area could have the full number easily, while someone calling locally could tell quickly what the correct number to call is without a lot of extra numbers.

The main problem has been that writing the same country, area and/or city codes over and over in the same article is tedious and error-prone.

For the optional parts of phone numbers, it would be nice to have some defaults, as discussed with Andrew and Mary in IRC. Namely: guides can have a special RDF tag, {{phoneCode|123}}, which sets the phone code for that destination to 123 (or whatever). The default phone code is prefixed to all the phone numbers in listings.

The prefixes are strung together geographically according to the IsIn hierarchy. That way, if the phoneCode for United States of America is 1, and the phoneCode for Santa Monica is 310, then the phone numbers prefixes will be automatically prefixed with +1-310- . If there's a funky phone code situation, then you can add an override at the guide level with {{fullPhoneCode|4-333}}, or at the listing level by using a "+" at the beginning of a phone number to indicate that it's a full number.

No matter what the phone code is, it will be formatted in italics just in front of the phone number.

Variants

Actions

In other languages