# Module:Road data/strings/doc

## Syntax

### Hierarchy and fields

At its most basic level, this module is a nested table of strings. At the top is the root table, named for the abbreviation of a country, state, or province. This table stores the type data for a particular place, which is named in the comment in the first line, and is returned at the end of the module. The table is composed of further tables, one per type. The basic syntax for a type table is:  
<syntaxhighlight lang="lua">
place.type = {
shield = "",
name = "",
link = "",
abbr = ""
}
</syntaxhighlight>  
The four main fields in a type table are <code>shield</code>, <code>name</code>, <code>link</code>, and <code>abbr</code>. Currently, these are the types used by all countries. By convention, they are always specified, using an empty string <code>"",</code> if there is no value.
- <code>shield</code> determines the shield that is displayed, if any
- <code>name</code> specifies the name of the route displayed by an infobox
- <code>link</code> specifies the target of a link generated, if any
- <code>abbr</code> determines the displayed abbreviation.  
Other common fields in road data tables
- <code>shieldmain</code> is used when a different shield is desired at the top of an infobox, such as for county roads.  
<syntaxhighlight lang="lua">
USA.CR = {
shield = "CR %route% jct.svg",
shieldmain = "[county||%county% |]County %route%.svg",
name = "County Road %route%",
link = "",
abbr = "CR %route%"
}
</syntaxhighlight>  
- <code>shieldlist</code> is used when a different shield is desired in lists that utilize the series of templates.  
- <code>base</code> can be used for aliasing different types that have a similar base structure, such as U.S. Highway special routes.  
- <code>banner</code> stores the name of the special route plate, such as <code></code>. Can be omitted when unused.
- <code>width</code> stores a code representing the width of the shield. It is most often helpful when used with <code>banner</code>. Can be omitted entirely when unused; common values are <code>square</code> and <code>expand</code>.  
- <code>section</code> stores the specific section number for those routes that are defined by law.  
- <code>translation</code> specifies the native language name of the route displayed by an infobox
- <code>lang</code> is the ISO 639-2 code of the native language; this code is used by and Lang-<i>xx</i> templates.  
<syntaxhighlight lang="lua">
PER.RN = {
shield = "PE-%route% route sign.svg",
name = "National Route %route%",
link = "Peru Highway %route%",
abbr = "PE-%route%",
translation = "Ruta nacional %route%",
lang = "es-pe"
}
</syntaxhighlight>  
Once a type is defined, it can be referenced later in the code. As seen here, it is common to define all parameters for main types like <code>US</code> and then to use aliases for subtypes such as <code>US-Alt</code>.  
<syntaxhighlight lang="lua">
MO.US = {
shield = "US %route%.svg",
base = "U.S. Route %route%",
link = "U.S. Route %route% in Missouri",
abbr = "US&nbsp;%route%",
}  
MO["US-Alt"] = {
shield = MO.US.shield,
link = MO.US.base .. " Alternate ([dab||%dab%, |]Missouri)",
abbr = MO.US.abbr .. " Alt.",
banner = "Alternate plate.svg",
}
</syntaxhighlight>