跳转到内容

Template:Place

維基詞典,自由的多語言詞典

這個模板為實驗性模板。
暫時未能支援所有國家和行政區劃。

本模板用於產生地名的釋義和分類。對應的資料模組位於Module:place/data

用法

基本用法如下(以德國爲例):

# {{place|zh|國家|洲/歐洲}}。

會產生

  1. 位於歐洲國家

同時將頁面歸類至Category:漢語 歐洲國家

第二個參數是所描述地點的類型。第三個及其後面的參數表示該地點隸屬的更大的地點,形式為類型/名稱。類型可以寫中英文全名,例如continent,某些常見的類型也可以寫英文縮寫,例如cont代表continent),s代表state),p代表province),c代表country國家)等,後文會給出完整的縮寫列表。以多倫多爲例:

# {{place|zh|城市|p/安大略省|c/加拿大}}。

會產生

  1. 位於加拿大安大略省城市

同時將頁面歸類至Category:漢語 安大略省城市

As another example, for Pittsburgh:

# {{place|en|city|s/Pennsylvania|c/United States}}.

generates

  1. 位於United StatesPennsylvania城市.

and places the page in Category:en:Cities in Pennsylvania, USA. (States of the United States are suffixed with , USA in some categories, to aid in distinguishing the US state of Georgia from the country of Georgia.)

For place names in foreign languages, a translation in English can be given, which changes the definition format, e.g. for Allemagne (the French term for Germany):

# {{place|fr|country|cont/Europe|t1=Germany}}

which generates

  1. Germany(位於Europe國家

and places the page in Category:fr:Countries in Europe. (Note that this category has language code fr, which contains French terms for countries in Europe, rather than English terms.)

Some place types use "of" instead of "in" in the definition and category, e.g. for Fairfax County:

# {{place|en|county|s/Virginia|c/United States}}.

which generates

  1. United StatesVirginia.

and places the page in Category:en:Counties of Virginia, USA.

Additional descriptive text can be present among the holonyms, and will be formatted correctly in the definition, e.g. for Germany:

# {{place|en|country|in central|cont/Europe}}.

which generates

  1. 位於Europein central的國家.

and places the page in Category:en:Countries in Europe, as above.

Alternative format

For complex cases, an alternative format can be used, which freely allows for placetypes and holonyms to be interspersed among raw text, e.g. as follows (for Fener):

# {{place|en|A <<neighborhood>> midway up the <<inlet/Golden Horn>> within <<dist/Fatih>> in <<city/Istanbul>>, <<c/Turkey>>.}}

which generates

  1. A 街區 midway up the Golden Horn within Fatih區 in Istanbul, Turkey.

and places the page in Category:en:Neighborhoods in Turkey.

In this format, placetypes and holonyms are surrounded by <<...>>. The presence of a slash indicates a holonym; no slash indicates a placetype. There is no requirement that placetypes precede holonyms.

In this format, it is possible to break up a multiword placetype if the initial word or words are recognized qualifiers (see below), such as "former" or "ancient". Example:

# {{lb|en|now|historical}} {{place|en|A <<former>> French <<colony>> on the <<isl:pref/Hispaniola>> from 1659 to 1809, roughly equivalent to modern-day <<c/Haiti>>}}.

which generates

  1. (歷史) A 前 French 殖民地 on the Hispaniola島 from 1659 to 1809, roughly equivalent to modern-day Haiti.

and places the page in Category:en:Historical polities (as <<former colony>> would do), rather than in Category:en:Polities (as <<colony>> would normally do).

Parameters

Primary parameters:

|1=
the language code of the entry
|2=
see #Placetype parameter
|3=, |4=, |5=, ...
see #Holonym parameters
|t1=, |t2=, |t3=, ...
English translation(s) of the place
|tid1=, |tid2=, |tid3=, ...
sense ID's for the English translation(s) of the place; see {{senseid}}
|cat=, |cat2=, ...
extra categories to add to the page; automatically prefixed by the language code, e.g. |cat=Towns in England will add the page to Category:fr:Towns in England if the specified language code is fr
|sort=
the sort key for the categories generated by the template; rarely needs to be specified, except perhaps for Japanese

Suppression and text parameters:

|def=
replaces the entire definition without affecting the categorization
|also=
adds further text to the type of place without affecting the categorization
|a=
replaces the indefinite article at the beginning of the definition

Extra information parameters:

|modern=, |modern2=, ...
the modern name(s) or location(s) of the place
|official=, |official2=, ...
the official name(s) of the place (e.g. People's Republic of China for China)
|capital=, |capital2=, ...
the capital city/cities of the place
|largest city=, |largest city2=, ...
the largest city/cities of the place
|caplc=
the capital and largest city of the place
|seat=, |seat2=, ...
the seat(s) of the place, particularly for counties and equivalents; displays "county seat", "parish seat" or "borough seat" for counties, parishes and boroughs respectively; otherwise, displays just "seat"
|shire town=, |shire town2=, ...
the shire town (similar to a county seat) of the place, particularly for counties in Vermont

As with holonym parameters (see below), all of these parameters can be prefixed with a language code such as fr:, and prefixing just with : suppresses automatic linking.

Placetype parameter

The type(s) of place of the entry, such as city, country or lake. Multiple values are separated by a slash (/). The special value and suppresses the comma and doesn’t affect categorization.

The placetype parameter can be pluralized and will be handled correctly. For example:

# {{place|en|Two <<former unincorporated communities>> in <<co/Williamson County>>, <<s/Illinois>>, <<c/USA>>}}.

displays as

  1. Two 前unincorporatedformer unincorporated communities in Williamson County, Illinois, USA.

and places the page in Category:en:Unincorporated communities in Illinois, USA and Category:en:Unincorporated communities in the United States.

The aliases that are recognized for holonym placetypes (see below) can also be used here and will automatically be expanded, but as a matter of style it is recommended to spell out the placetype in full except for generally-recognized aliases such as CDP for census-designated place.

Holonym parameters

A holonym parameter has the following format: placetype/placename. The format placetype/langcode:placename can be used to specify a non-English placename. Normally, the placename will automatically be linked; using : with no langcode suppresses automatic linking. Automatic linking is done exactly as if {{l}} were being used, which means that square brackets can be used inside it to link to individual parts, and {{w}} can be used to link to Wikipedia.

If the placetype and following slash are omitted, the parameter is displayed as regular text.

If there are multiple holonyms, commas are placed before all holonyms except the first, according to the following algorithm:

  1. No comma is placed before the first holonym (whether a placename or raw text).
  2. No comma is placed before a holonym (whether a placename or raw text) preceded by raw text.
  3. No comma is placed before the special raw-text values and and in.
  4. A comma is placed before all other holonyms.

This does not apply to the alternative format described above, where raw text, placetypes and placenames are freely interspersed and no extra commas are added unless multiple placenames are grouped together (see below).

Grouped holonyms

Multiple comma-separated placenames can be given, and are formatted correctly and individually linked. For example:

  1. {{place|en|river|c/Ukraine,Belarus,Poland}}.
    位於PolandBelarusUkraine.
  2. {{place|en|Several <<cities>> in <<c/Argentina,Chile,Philippines,Spain,United States>>}}.
    Several cities in ArgentinaChilePhilippinesSpainUnited States.

Holonyms that take "the"

Some holonyms are normally preceded by "the", as in "the United States", while others aren't, e.g. "France". Holonyms that are normally preceded by "the" will have this added if they occur either as (1) the first-specified holonym parameter; (2) the non-first holonym in a multi-holonym list (for this, see the example just above); (3) when accompanied by the :pref or :Pref modifiers (see below). In other positions, they will not be preceded by "the", e.g.:

  1. {{place|en|city|in the southern|c/United States}}.
    位於United Statesin the southern的城市.
  2. {{place|en|city|s/Georgia|c/United States}}.
    位於United StatesGeorgia城市.

Holonym placetype aliases

Several aliases are recognized for placetype:

  • ccountry
  • rregion
  • pprovince
  • sstate
  • ccconstituent country (should be used for England, Scotland, and Wales)
  • contcontinent
  • deptdepartment
  • distdistrict
  • rivriver
  • careacouncil area
  • cdp, CDPcensus-designated place

[etc.]

The full list can be found below under Recognized placetypes, which lists all recognized placetypes along with the aliases (if any) of each placetype.

Holonym placetype modifiers

Following the holonym placetype can be a colon followed by one or more comma-separated modifiers, e.g. s:suf/New York. Currently, the following modifiers are recognized:

  • suf: Display the full placetype as a lowercase suffix, e.g. s:suf/New YorkNew York state.
  • Suf: Display the full placetype as a capitalized suffix, e.g. s:Suf/New YorkNew York State.
  • pref: Display the full placetype as a lowercase prefix, e.g. s:pref/New York(the) state of New York (the initial "the" is displayed in the same circumstances as when it is displayed before a holonym like "United States"; see above).
  • Pref: Display the full placetype as a capitalized prefix, e.g. s:Pref/New York(the) State of New York (the initial "the" is displayed in the same circumstances as when it is displayed before a holonym like "United States"; see above).
  • noaff: Suppress the default display of a prefix or suffix (see below).

The reasons for using such a modifier are that (a) category recognition code is based off the full holonym placename, and hence won't work properly if a holonym like s/[[New York]] State is used; and (b) the bare holonym without the prefix or suffix will be autolinked, without the need to explicitly inserted brackets around the bare holonym.

Note that some holonym placetypes have prefixes or suffixes attached by default, e.g.:

  • "canton", "civil parish", "community development block", "council area", "county borough", "department", "district", "district municipality", "local government district" (suffixed with "district"), "London borough" (suffixed with "borough"), "parish", "peninsula", "subdivision", "tehsil" (suf)
  • "autonomous oblast", "autonomous okrug", "census area", "krai", "oblast", "okrug", "regional county municipality" (Suf)
  • "metropolitan borough", "municipal district", "regional district", "regional municipality", "rural municipality" (Pref)

This affixing does not happen if the holonym placename already has the placetype or a part of it in it, if an explicit prefixing or suffixing modifier is used, or if the modifier noaff is used.

Examples:

  1. {{place|en|city|carea/Highland|cc/Scotland}}.
    位於Scotland高地議會地區的城市.
  2. {{place|en|capital city|c:pref/Georgia}}.
    Georgia國的首都.

Multiple descriptions

The special value ; restarts the description and categorization (except for the language code), and joins the two descriptions with a semicolon. For example:

  1. Rio de Janeiro
    {{place|pt|city/state capital|s/Rio de Janeiro|c/Brazil|;|former capital city|of|c/Brazil}}
    BrazilRio de Janeiro城市首府Brazilof的前首都

The main reason to use this format, as opposed to simply stringing the entire description together, is that categorization is restarted. This allows for more flexible categorization of places that serve multiple functions than would otherwise be possible.

More generally, any value beginning with a ; and not immediately followed by a space has the same restarting behavior, and in addition the text after the semicolon serves as the joining text, in place of a semicolon. For example:

  1. Vatican City
    {{place|en|city-state|r/Southern Europe|;,|an <<enclave>> within the city of <<city/Rome>>, <<c/Italy>>}}
    位於Southern Europe城邦,an 飛地 within the city of Rome, Italy.

If the joining text begins with an ASCII or Unicode letter, a space is placed before the joining text, otherwise no space is added, as above. Finally, the special value ;; joins the descriptions with only a space.

More complex examples

  1. Scranton
    {{place|en|city|in northeastern|s/Pennsylvania|c/United States}}.
    位於United StatesPennsylvaniain northeastern的城市.
    (adds Category:en:Cities in Pennsylvania, USA)
  2. Italy
    {{place|en|country|in southern|cont/Europe|caplc=en:Rome}}.
    位於Europein southern的國家。首都和最大城市:Rome.
    (adds Category:en:Countries in Europe)
  3. Roma
    {{place|it|capital city|c/Italy|t1=Rome}}.
    RomeItaly首都).
    (adds Category:it:Capital cities)
  4. Wavrin
    {{place|fr|village/and/municipality|dept/Nord|r/fr:[[Nord-Pas-de-Calais]] region|c/France}}.
    FranceNord-Pas-de-Calais regionNord省的市鎮.
    (adds Category:fr:Villages in France and Category:fr:Municipalities of France)
  5. Bernicia
    {{place|en|a=An Anglo-Saxon|kingdom|in northeastern|c/England|and|southeastern|c/Scotland}}.
    位於ScotlandsoutheasternEnglandin northeastern的An Anglo-Saxon王國.
    (adds Category:en:Polities, for lack of a more specific category)
    {{place|en|An Anglo-Saxon <<kingdom>> in northeastern <<c/England>> and southeastern <<c/Scotland>>.}}
    An Anglo-Saxon 王國 in northeastern England and southeastern Scotland.
    (same as previous example, using the alternative format)

Guide to adding new items to the data module

Module:place/data controls the categorization of entries and some issues concerning the wording of definitions. This section will show, as an example, how to change the categorization and display of archipelagos.

Each index of the variable export is a placetype. You can begin by adding the item

["archipelago"] = {
},

Each item has subitems for individual countries and one called "default". These subitems have subsubitems that indicate whether the entry should be categorized under the given holonym. The special index of "itself" indicates that the entry is categorized without a holonym. For example, if we add the following code:

["archipelago"] = {
	["country/Indonesia"] = {
		["province"] = {true},
		["country"] = {true},
	},
	["default"] = {
		["itself"] = {true},
	},
},

Then entries for archipelagos in Indonesia will be categorized under Category:langcode:Archipelagos in Province, Indonesia, or Category:langcode:Archipelagos in Indonesia if a province is not provided. For all other countries, or when no country is given, the entry will be added to Category:langcode:Archipelagos.

Instead of true, you can use a string to replace the word Archipelagos in the category. For example, if in the default subitem you used instead

		["itself"] = {"Islands"},

Then archipelagos outside of Indonesia would be added to Category:langcode:Islands

If the type of place requires wording more complicated than “place A, place B, place C, [] ”, a variable called synergy= can be used. Each subitem of this variable is the type of place that precedes it, and has the variables before=, between= and after=.

	synergy = {
		["island"] = {
			before = "in the island of",
			between = "in the",
			after = "archipelago"
		},
	},

This would make {{place|en|village|island/Komodo|archipelago/Lesser Sunda}} generate “A village in the island of Komodo in the Lesser Sunda archipelago.”

The other variables are:

preposition=
Replace the default preposition "in" in definitions and categories (e.g. “A department of France” instead of “A department in France”).
plural=
Replace the default plural in categories (e.g. “Kibbutzim in Israel” instead of “Kibbutzes in Israel”). The default pluralizing algorithm is very smart and almost always works (e.g. city -> cities, valley -> valleys, parish -> parishes, pass -> passes, commonwealth -> commonwealths), so this is rarely necessary.
article=
Replace the default article "a"/"an" in definitions when occurring as the entry placetype (e.g. “The capital of” instead of “A capital of”). The value will almost always be "the".
holonym_article=
Specify an article to add to holonyms containing this placetype (e.g. riv/Nile -> "the Nile" instead of just "Nile").
affix_type=
Specify that holonyms containing this placetype will automatically have a prefix or suffix added, as described above under #Holonym placetype modifiers. Possible values are pref, Pref, suf and Suf.
affix=
Specify the affix to use in conjunction with affix_type=, instead of using the placetype itself (e.g. "local government district" specifies affix="district").
no_affix_strings=
Used in conjunction with affix_type=; specifies a string or list of strings which, if occurring in the holonym, will disable automatic affixation. Defaults to the placetype itself. Matching is case-insensitive. For example, "autonomous okrug" specifies no_affix_strings="okrug" (so that if "okrug" or "Okrug" occurs in the holonym, it will disable affixing), and "district municipality" specifies {"district", "municipality"} (so that if either "district" or "municipality", capitalized or lowercase, occurs in the holonym, it will disable affixing).
display_handler=
Specify a function to control the display of the holonym. Passed two arguments, the holonym placetype and placename, and should return the string to display.
cat_handler=
Specify a function to control the categorization of the holonym. Passed three arguments, the holonym placetype and placename and the full place spec that describes all facets of the place description (described in more detail in the comments to Module:place). Should return a table such as { ["itself"] = {"Cities in Nicaragua"} }, i.e. in the same format as the innermost table in the holonym's category spec, as described above.

Recognized placetypes

The following placetypes are recognized by the module, and processed specially. This does not mean that other placetypes cannot be used, but they will not get special handling (e.g. their display form will not be linked and they will not trigger any categorization).

Module:Place_doc第20行Lua错误:bad argument #1 to 'pairs' (table expected, got nil)

Recognized placenames

The following place names are recognized by the module, and handled specially in some fashion. Note that there's nothing preventing any place name from being used. Note that items in the third and fourth columns are boldfaced if they are different from the placename in the first column.

Module:Place_doc第113行Lua错误:bad argument #1 to 'pairs' (table expected, got nil)

Recognized qualifiers

The following qualifiers are recognized by the module. This means that if such a qualifier is used before a recognized placetype, the placetype will still be recognized and processed as normal. Note that items in the second column are boldfaced if they are different from the qualifier in the first column.

Module:Place_doc第231行Lua错误:bad argument #1 to 'pairs' (table expected, got nil)