Difference between revisions of "Template:ConvertAbbrev/ISO 3166-2/GB"

From blackwiki
Jump to navigation Jump to search
imported>Dudemanfellabra
(create for use with Template:ConvertAbbrev)
 
imported>Dudemanfellabra
(implement case insensitivity)
 
Line 1: Line 1:
 
{{#ifeq:{{{force|}}}|abbr||
 
{{#ifeq:{{{force|}}}|abbr||
{{#switch: {{{1}}}
+
{{#switch: {{uc:{{{1}}}}}
 
<!--
 
<!--
  
Line 311: Line 311:
 
| {{#ifeq:{{{force|}}}|long|{{{1}}}}}
 
| {{#ifeq:{{{force|}}}|long|{{{1}}}}}
 
}}}}{{#ifeq:{{{force|}}}|long||
 
}}}}{{#ifeq:{{{force|}}}|long||
{{#switch: {{{1}}}
+
{{#switch: {{lc:{{{1}}}}}
 
<!--
 
<!--
  
Line 317: Line 317:
  
 
-->
 
-->
|England=ENG
+
|england=ENG
|Northern Ireland=NIR
+
|northern ireland=NIR
|Scotland=SCT
+
|scotland=SCT
|Wales=WLS
+
|wales=WLS
|England and Wales=EAW
+
|england and wales=EAW
|Great Britain=GBN
+
|great britain=GBN
|United Kingdom=UKM
+
|united kingdom=UKM
 
<!--
 
<!--
  
Line 333: Line 333:
  
 
-->
 
-->
|Buckinghamshire=BKM
+
|buckinghamshire=BKM
|Cambridgeshire=CAM
+
|cambridgeshire=CAM
|Cumbria=CMA
+
|cumbria=CMA
|Derbyshire=DBY
+
|derbyshire=DBY
|Devon=DEV
+
|devon=DEV
|Dorset=DOR
+
|dorset=DOR
|East Sussex=ESX
+
|east sussex=ESX
|Essex=ESS
+
|essex=ESS
|Gloucestershire=GLS
+
|gloucestershire=GLS
|Hampshire=HAM
+
|hampshire=HAM
|Hertfordshire=HRT
+
|hertfordshire=HRT
|Kent=KEN
+
|kent=KEN
|Lancashire=LAN
+
|lancashire=LAN
|Leicestershire=LEC
+
|leicestershire=LEC
|Lincolnshire=LIN
+
|lincolnshire=LIN
|Norfolk=NFK
+
|norfolk=NFK
|North Yorkshire=NYK
+
|north yorkshire=NYK
|Northamptonshire=NTH
+
|northamptonshire=NTH
|Nottinghamshire=NTT
+
|nottinghamshire=NTT
|Oxfordshire=OXF
+
|oxfordshire=OXF
|Somerset=SOM
+
|somerset=SOM
|Staffordshire=STS
+
|staffordshire=STS
|Suffolk=SFK
+
|suffolk=SFK
|Surrey=SRY
+
|surrey=SRY
|Warwickshire=WAR
+
|warwickshire=WAR
|West Sussex=WSX
+
|west sussex=WSX
|Worcestershire=WOR
+
|worcestershire=WOR
 
<!--
 
<!--
  
Line 365: Line 365:
  
 
-->
 
-->
|City of London|London=LND
+
|city of london|london=LND
 
<!--
 
<!--
  
Line 371: Line 371:
  
 
-->
 
-->
|Barking and Dagenham=BDG
+
|barking and dagenham=BDG
|Barnet=BNE
+
|barnet=BNE
|Bexley=BEX
+
|bexley=BEX
|Brent=BEN
+
|brent=BEN
|Bromley=BRY
+
|bromley=BRY
|Camden=CMD
+
|camden=CMD
|Croydon=CRY
+
|croydon=CRY
|Ealing=EAL
+
|ealing=EAL
|Enfield=ENF
+
|enfield=ENF
|Greenwich=GRE
+
|greenwich=GRE
|Hackney=HCK
+
|hackney=HCK
|Hammersmith and Fulham=HMF
+
|hammersmith and fulham=HMF
|Haringey=HRY
+
|haringey=HRY
|Harrow=HRW
+
|harrow=HRW
|Havering=HAV
+
|havering=HAV
|Hillingdon=HIL
+
|hillingdon=HIL
|Hounslow=HNS
+
|hounslow=HNS
|Islington=ISL
+
|islington=ISL
|Kensington and Chelsea=KEC
+
|kensington and chelsea=KEC
|Kingston upon Thames=KTT
+
|kingston upon thames=KTT
|Lambeth=LBH
+
|lambeth=LBH
|Lewisham=LEW
+
|lewisham=LEW
|Merton=MRT
+
|merton=MRT
|Newham=NWM
+
|newham=NWM
|Redbridge=RDB
+
|redbridge=RDB
|Richmond upon Thames=RIC
+
|richmond upon thames=RIC
|Southwark=SWK
+
|southwark=SWK
|Sutton=STN
+
|sutton=STN
|Tower Hamlets=TWH
+
|tower hamlets=TWH
|Waltham Forest=WFT
+
|waltham forest=WFT
|Wandsworth=WND
+
|wandsworth=WND
|Westminster=WSM
+
|westminster=WSM
 
<!--
 
<!--
  
Line 408: Line 408:
  
 
-->
 
-->
|Barnsley=BNS
+
|barnsley=BNS
|Birmingham=BIR
+
|birmingham=BIR
|Bolton=BOL
+
|bolton=BOL
|Bradford=BRD
+
|bradford=BRD
|Bury=BUR
+
|bury=BUR
|Calderdale=CLD
+
|calderdale=CLD
|Coventry=COV
+
|coventry=COV
|Doncaster=DNC
+
|doncaster=DNC
|Dudley=DUD
+
|dudley=DUD
|Gateshead=GAT
+
|gateshead=GAT
|Kirklees=KIR
+
|kirklees=KIR
|Knowsley=KWL
+
|knowsley=KWL
|Leeds=LDS
+
|leeds=LDS
|Liverpool=LIV
+
|liverpool=LIV
|Manchester=MAN
+
|manchester=MAN
|Newcastle upon Tyne=NET
+
|newcastle upon tyne=NET
|North Tyneside=NTY
+
|north tyneside=NTY
|Oldham=OLD
+
|oldham=OLD
|Rochdale=RCH
+
|rochdale=RCH
|Rotherham=ROT
+
|rotherham=ROT
|Saint Helens|St. Helens|St Helens=SHN
+
|saint helens|st. helens|st helens=SHN
|Salford=SLF
+
|salford=SLF
|Sandwell=SAW
+
|sandwell=SAW
|Sefton=SFT
+
|sefton=SFT
|Sheffield=SHF
+
|sheffield=SHF
|Solihull=SOL
+
|solihull=SOL
|South Tyneside=STY
+
|south tyneside=STY
|Stockport=SKP
+
|stockport=SKP
|Sunderland=SND
+
|sunderland=SND
|Tameside=TAM
+
|tameside=TAM
|Trafford=TRF
+
|trafford=TRF
|Wakefield=WKF
+
|wakefield=WKF
|Walsall=WLL
+
|walsall=WLL
|Wigan=WGN
+
|wigan=WGN
|Wirral=WRL
+
|wirral=WRL
|Wolverhampton=WLV
+
|wolverhampton=WLV
 
<!--
 
<!--
  
Line 449: Line 449:
  
 
-->
 
-->
|Bath and North East Somerset=BAS
+
|bath and north east somerset=BAS
|Blackburn with Darwen=BBD
+
|blackburn with darwen=BBD
|Bedford=BDF
+
|bedford=BDF
|Blackpool=BPL
+
|blackpool=BPL
|Bournemouth=BMH
+
|bournemouth=BMH
|Bracknell Forest=BRC
+
|bracknell forest=BRC
|Brighton and Hove=BNH
+
|brighton and hove=BNH
|City of Bristol|Bristol=BST
+
|city of bristol|bristol=BST
|Central Bedfordshire=CBF
+
|central bedfordshire=CBF
|Cheshire East=CHE
+
|cheshire east=CHE
|Cheshire West and Chester=CHW
+
|cheshire west and chester=CHW
|Cornwall=CON
+
|cornwall=CON
|Darlington=DAL
+
|darlington=DAL
|Derby=DER
+
|derby=DER
|Durham=DUR
+
|durham=DUR
|East Riding of Yorkshire=ERY
+
|east riding of yorkshire=ERY
|Halton=HAL
+
|halton=HAL
|Hartlepool=HRL
+
|hartlepool=HRL
|Herefordshire=HEF
+
|herefordshire=HEF
|Isle of Wight=IOW
+
|isle of wight=IOW
|Kingston upon Hull=KHL
+
|kingston upon hull=KHL
|Leicester=LCE
+
|leicester=LCE
|Luton=LUT
+
|luton=LUT
|Medway=MDW
+
|medway=MDW
|Middlesbrough=MDB
+
|middlesbrough=MDB
|Milton Keynes=MIK
+
|milton keynes=MIK
|North East Lincolnshire=NEL
+
|north east lincolnshire=NEL
|North Lincolnshire=NLN
+
|north lincolnshire=NLN
|North Somerset=NSM
+
|north somerset=NSM
|Northumberland=NBL
+
|northumberland=NBL
|Nottingham=NGM
+
|nottingham=NGM
|Peterborough=PTE
+
|peterborough=PTE
|Plymouth=PLY
+
|plymouth=PLY
|Poole=POL
+
|poole=POL
|Portsmouth=POR
+
|portsmouth=POR
|Reading=RDG
+
|reading=RDG
|Redcar and Cleveland=RCC
+
|redcar and cleveland=RCC
|Rutland=RUT
+
|rutland=RUT
|Shropshire=SHR
+
|shropshire=SHR
|Slough=SLG
+
|slough=SLG
|South Gloucestershire=SGC
+
|south gloucestershire=SGC
|Southampton=STH
+
|southampton=STH
|Southend-on-Sea|Southend on Sea=SOS
+
|southend-on-sea|southend on sea=SOS
|Stockton-on-Tees|Stockton on Tees=STT
+
|stockton-on-tees|stockton on tees=STT
|Stoke-on-Trent|Stoke on Trent=STE
+
|stoke-on-trent|stoke on trent=STE
|Swindon=SWD
+
|swindon=SWD
|Telford and Wrekin=TFW
+
|telford and wrekin=TFW
|Thurrock=THR
+
|thurrock=THR
|Torbay=TOB
+
|torbay=TOB
|Warrington=WRT
+
|warrington=WRT
|West Berkshire=WBK
+
|west berkshire=WBK
|Wiltshire=WIL
+
|wiltshire=WIL
|Windsor and Maidenhead=WNM
+
|windsor and maidenhead=WNM
|Wokingham=WOK
+
|wokingham=WOK
|York=YOR
+
|york=YOR
 
<!--
 
<!--
  
Line 509: Line 509:
  
 
-->
 
-->
|Antrim=ANT
+
|antrim=ANT
|Ards=ARD
+
|ards=ARD
|Armagh=ARM
+
|armagh=ARM
|Ballymena=BLA
+
|ballymena=BLA
|Ballymoney=BLY
+
|ballymoney=BLY
|Banbridge=BNB
+
|banbridge=BNB
|Belfast=BFS
+
|belfast=BFS
|Carrickfergus=CKF
+
|carrickfergus=CKF
|Castlereagh=CSR
+
|castlereagh=CSR
|Coleraine=CLR
+
|coleraine=CLR
|Cookstown=CKT
+
|cookstown=CKT
|Craigavon=CGV
+
|craigavon=CGV
|Derry=DRY
+
|derry=DRY
|Down=DOW
+
|down=DOW
|Dungannon=DGN
+
|dungannon=DGN
|Fermanagh=FER
+
|fermanagh=FER
|Larne=LRN
+
|larne=LRN
|Limavady=LMV
+
|limavady=LMV
|Lisburn=LSB
+
|lisburn=LSB
|Magherafelt=MFT
+
|magherafelt=MFT
|Moyle=MYL
+
|moyle=MYL
|Newry and Mourne District|Newry and Mourne=NYM
+
|newry and mourne district|newry and mourne=NYM
|Newtownabbey=NTA
+
|newtownabbey=NTA
|North Down=NDN
+
|north down=NDN
|Omagh=OMH
+
|omagh=OMH
|Strabane=STB
+
|strabane=STB
 
<!--
 
<!--
  
Line 540: Line 540:
  
 
-->
 
-->
|Aberdeen City|Aberdeen=ABE
+
|aberdeen city|aberdeen=ABE
|Aberdeenshire=ABD
+
|aberdeenshire=ABD
|Angus=ANS
+
|angus=ANS
|Argyll and Bute=AGB
+
|argyll and bute=AGB
|Clackmannanshire=CLK
+
|clackmannanshire=CLK
|Dumfries and Galloway=DGY
+
|dumfries and galloway=DGY
|Dundee City|Dundee=DND
+
|dundee City|dundee=DND
|East Ayrshire=EAY
+
|east ayrshire=EAY
|East Dunbartonshire=EDU
+
|east dunbartonshire=EDU
|East Lothian=ELN
+
|east lothian=ELN
|East Renfrewshire=ERW
+
|east renfrewshire=ERW
|City of Edinburgh|Edinburgh=EDH
+
|city of edinburgh|edinburgh=EDH
|Eilean Siar=ELS
+
|eilean siar=ELS
|Falkirk=FAL
+
|falkirk=FAL
|Fife=FIF
+
|fife=FIF
|Glasgow City|Glasgow=GLG
+
|glasgow city|glasgow=GLG
|Highland=HLD
+
|highland=HLD
|Inverclyde=IVC
+
|inverclyde=IVC
|Midlothian=MLN
+
|midlothian=MLN
|Moray=MRY
+
|moray=MRY
|North Ayrshire=NAY
+
|north ayrshire=NAY
|North Lanarkshire=NLK
+
|north lanarkshire=NLK
|Orkney Islands=ORK
+
|orkney islands=ORK
|Perth and Kinross=PKN
+
|perth and kinross=PKN
|Renfrewshire=RFW
+
|renfrewshire=RFW
|The Scottish Borders|Scottish Borders=SCB
+
|the scottish borders|scottish borders=SCB
|Shetland Islands=ZET
+
|shetland islands=ZET
|South Ayrshire=SAY
+
|south ayrshire=SAY
|South Lanarkshire=SLK
+
|south lanarkshire=SLK
|Stirling=STG
+
|stirling=STG
|West Dunbartonshire=WDU
+
|west dunbartonshire=WDU
|West Lothian=WLN
+
|west lothian=WLN
 
<!--
 
<!--
  
Line 577: Line 577:
  
 
-->
 
-->
|Blaenau Gwent=BGW
+
|blaenau gwent=BGW
|Bridgend=BGE
+
|bridgend=BGE
|Caerphilly=CAY
+
|caerphilly=CAY
|Cardiff=CRF
+
|cardiff=CRF
|Carmarthenshire=CMN
+
|carmarthenshire=CMN
|Ceredigion|Sir Ceredigion=CGN
+
|ceredigion|sir ceredigion=CGN
|Conwy=CWY
+
|conwy=CWY
|Denbighshire=DEN
+
|denbighshire=DEN
|Flintshire=FLN
+
|flintshire=FLN
|Gwynedd=GWN
+
|gwynedd=GWN
|Isle of Anglesey=AGY
+
|isle of anglesey=AGY
|Merthyr Tydfil=MTY
+
|merthyr tydfil=MTY
|Monmouthshire=MON
+
|monmouthshire=MON
|Neath Port Talbot=NTL
+
|neath port talbot=NTL
|Newport=NWP
+
|newport=NWP
|Pembrokeshire=PEM
+
|pembrokeshire=PEM
|Powys=POW
+
|powys=POW
|Rhondda, Cynon, Taff|Rhondda, Cynon, Taf=RCT
+
|rhondda, cynon, taff|rhondda, cynon, taf=RCT
|Swansea=SWA
+
|swansea=SWA
|Torfaen|Tor-faen=TOF
+
|torfaen|tor-faen=TOF
|The Vale of Glamorgan=VGL
+
|the vale of glamorgan=VGL
|Wrexham=WRX
+
|wrexham=WRX
 
<!--
 
<!--
  
Line 604: Line 604:
  
 
-->
 
-->
|Cymru=CYM
+
|cymru=CYM
|Pen-y-bont ar Ogwr=POG
+
|pen-y-bont ar ogwr=POG
|Caerffili=CAF
+
|caerffili=CAF
|Caerdydd=CRD
+
|caerdydd=CRD
|Sir Gaerfyrddin=GFY
+
|sir gaerfyrddin=GFY
|Sir Ddinbych=DDB
+
|sir ddinbych=DDB
|Sir y Fflint=FFL
+
|sir y fflint=FFL
|Sir Ynys Môn|Sir Ynys Mon=YNM
+
|sir ynys môn|sir ynys mon=YNM
|Merthyr Tudful=MTU
+
|merthyr tudful=MTU
|Sir Fynwy=FYN
+
|sir fynwy=FYN
|Castell-nedd Port Talbot=CTL
+
|castell-nedd port talbot=CTL
|Casnewydd=CNW
+
|casnewydd=CNW
|Sir Benfro=BNF
+
|sir benfro=BNF
|Abertawe=ATA
+
|abertawe=ATA
|Bro Morgannwg=BMG
+
|bro morgannwg=BMG
|Wrecsam=WRC
+
|wrecsam=WRC
 
| {{#ifeq:{{{force|}}}|abbr|{{uc:{{{1}}}}}}}
 
| {{#ifeq:{{{force|}}}|abbr|{{uc:{{{1}}}}}}}
 
}}}}<noinclude>{{Documentation|Template:ConvertAbbrev/doc}}</noinclude>
 
}}}}<noinclude>{{Documentation|Template:ConvertAbbrev/doc}}</noinclude>

Latest revision as of 16:14, 27 August 2011

Template documentation[view] [edit] [history] [purge]

This template is used to convert commonly abbreviated things such as countries, states, provinces, and even language codes to and from their abbreviations. A hierarchical tree of subtemplates allows this template to convert virtually anything, which is really good for use in a backdoor template. If you have the word "California", but the template you're trying to use will only recognize "CA", use this to convert it!

How to use the template

Syntax: {{ConvertAbbrev|datatype|specification|value|force=abbr or long}}

This template consists of a "tree" of subtemplates containing databases of abbreviations. Each successive parameter in the code input tells the template which database to query. The datatype parameter is the most broad and tells the template what type of information you are looking for (i.e. Countries, states, or languages). The specification parameter refines the search. For example, if the datatype parameter is "ISO 3166-1", that tells the template to look for a subtype (alpha2, alpha3, or numeric). If the datatype parameter is "ISO 3166-2", the template will look for a specific country (Canada, Mexico, United States, etc.). If the datatype parameter is "ISO 639-1", the template looks for the name of a language (English, Spanish, Zulu, etc.). The value parameter is the actual name or abbreviation the user wishes to convert.

The force parameter overrides the normal nature of the conversion and forces an abbreviation or a long word to be returned. This is useful when a user may input either an abbreviation or a full name, but the template in question can only accept one of them.

If the ISO codes are a little hard to remember, there are also shortcuts:

  • {{ConvertAbbrev|ISO 3166-1|alpha-2|__country__}} can also be called by
    • {{ConvertAbbrev|Countries|alpha-2|__country__}} or
    • {{ConvertAbbrev|Countries|__country__}}.
      Note: The default for country abbreviations is alpha-2. For alpha-3 and numeric abbreviations, the user must specify the type in the specification parameter.
  • {{ConvertAbbrev|ISO 3166-2|CA|__province__}} can also be called by
  • {{ConvertAbbrev|ISO 639-1|__language__}} can also be called by
    • {{ConvertAbbrev|Languages|-1|__language__}} or
    • {{ConvertAbbrev|Languages|__language__}}.
      Note: The default for language abbreviations is ISO 639-1. For ISO 639-2 abbreviations, the user must specify the type in the specification parameter.
  • {{ConvertAbbrev|ISO 639-2|__language__}} can also be called by

Supported datasets

Countries supported in ISO 3166-2:
  Supported
  Not yet supported
  Does not exist in ISO 3166-2

Usage Examples

From Name to Abbreviation
Code Returns
{{ConvertAbbrev|ISO 3166-1|alpha-2|United Kingdom}} GB
{{ConvertAbbrev|Countries|alpha-3|United States}} USA
{{ConvertAbbrev|ISO 3166-2|CA|Alberta}} AB
{{ConvertAbbrev|Countries|Mexico|Federal District}} DF
{{ConvertAbbrev|ISO 639-1|Russian}} ru
{{ConvertAbbrev|Languages|Chinese}} zh
From Abbreviation to Name
Code Returns
{{ConvertAbbrev|ISO 3166-1|alpha-2|GB}} United Kingdom
{{ConvertAbbrev|Countries|alpha-3|USA}} United States
{{ConvertAbbrev|ISO 3166-2|CA|AB}} Alberta
{{ConvertAbbrev|Countries|Mexico|DF}} Federal District
{{ConvertAbbrev|ISO 639-1|ru}} Russian
{{ConvertAbbrev|Languages|zh}} Chinese

Sub-pages

For a list of all the sub-pages of this template, see: Special:PrefixIndex/Template:ConvertAbbrev