Template:Nihongo/doc

&#x3c;!-- Categories go where indicated at the bottom of this page, please; interwikis go to Wikidata (see also: Wikidata). --&#x3e;

Usage
This template marks the &#x3c;code&#x3e;kanji&#x3c;/code&#x3e; segment as being in Japanese kanji and/or kana, which helps user agents (web browsers and so on) to display it correctly.

Syntax: Parameters:
 * &#x26;lt;english&#x3e;. Optional. The word as translated into English. Note that this will sometimes be the actual Japanese word due to it being adopted into English.
 * &#x26;lt;kanji/kana&#x3e;. Required when &#x26;lt;rōmaji&#x3e; is empty or omitted. The word as written using Japanese script (kanji, kana).
 * &#x26;lt;rōmaji&#x3e;. Required when &#x26;lt;kanji/kana&#x3e; is empty. Transliteration of the Japanese word, using Hepburn Romanization.
 * lead=yes. Optional. This should be used for the first instance of Japanese, usually in the lead. It gives the reader an idea what kind of non-English writing they are viewing.
 * &#x26;lt;extra&#x3e;. Optional. Can be used to add a gloss (particularly if there is no English form). Can also be expressed as a named parameter, &#x3c;code&#x3e;extra=&#x3c;/code&#x3e;
 * &#x26;lt;extra2&#x3e;. Optional. Can also be expressed as a named parameter, &#x3c;code&#x3e;extra2=&#x3c;/code&#x3e;. It is only useful in ";" definitions (extra2 will be displayed without bold, whereas text following the template will get the bold).

Examples

 * Regular use:


 * Use in lead:


 * Without &#x3c;code&#x3e;English&#x3c;/code&#x3e;:


 * Without &#x3c;code&#x3e;English&#x3c;/code&#x3e;, use in lead:


 * With &#x3c;code&#x3e;extra2&#x3c;/code&#x3e;:


 * Without &#x3c;code&#x3e;extra2&#x3c;/code&#x3e;:

User style
User style can be set by adding code similar to

&#x3c;syntaxhighlight lang="css"&#x3e; @media screen, tv { *[lang="ja"] { color: green; } }&#x3c;/syntaxhighlight&#x3e;

to common.css.

Error messaging
This template emits one error message of its own:
 * &#x3c;span class="error" style="font-size:100%"&#x3e;error: &#x3c;nowiki&#x3e;&#x3c;/nowiki&#x3e;: Japanese or romaji text required&#x3c;/span&#x3e;

One of the positional parameters &#x3c;code&#x3e;&#x26;lt;kanji/kana&#x3e;&#x3c;/code&#x3e; (&#x3c;code&#x3e;&#x3c;nowiki&#x3e;&#x3c;/nowiki&#x3e;&#x3c;/code&#x3e;), the 'Japanese' referred to in the error message or &#x3c;code&#x3e;&#x26;lt;rōmaji&#x3e;&#x3c;/code&#x3e; (&#x3c;code&#x3e;&#x3c;nowiki&#x3e;&#x3c;/nowiki&#x3e;&#x3c;/code&#x3e;) is required for proper operation of this template. Articles with these errors are collected in.

This error often occurs because the template is malformed:
 * &#x3c;code&#x3e;&#x3c;nowiki&#x3e;東京タワー&#x3c;/nowiki&#x3e;&#x3c;/code&#x3e; instead of &#x3c;code&#x3e;&#x3c;nowiki&#x3e; (東京タワー)&#x3c;/nowiki&#x3e;&#x3c;/code&#x3e;; 東京タワー is in &#x3c;code&#x3e;&#x3c;nowiki&#x3e;&#x3c;/nowiki&#x3e;&#x3c;/code&#x3e; (&#x3c;code&#x3e;&#x26;lt;english&#x3e;&#x3c;/code&#x3e;) instead of &#x3c;code&#x3e;&#x3c;nowiki&#x3e;&#x3c;/nowiki&#x3e;&#x3c;/code&#x3e; (&#x3c;code&#x3e;&#x26;lt;kanji/kana&#x3e;&#x3c;/code&#x3e;). To resolve this error, add the missing pipe (&#x3c;code&#x3e;|&#x3c;/code&#x3e;) or consider using  or

Because this template uses and  which emit their own error messages, see the help text for those at:
 * – for error messages emitted by
 * – for error messages emitted by

Limitations
This cannot be used within a Wikilink in an article or in any template or other page that is transcluded into an article.

Template data
&#x3c;templatedata&#x3e; {	"description": "This template is used to display Japanese text, applying the correct code and formatting.", "params": { "1": {			"label": "English text", "type": "string", "description": "The word as translated into English. Note this will sometimes be the actual Japanese word if it has been adopted into English." },		"2": {			"label": "Kanji/kana text", "type": "string", "required": true, "description": "The word as written in Japanese (kanji, kana, Roman letters, and possibly other marks)." },		"3": {			"label": "Romanized (rōmaji) text", "type": "string", "description": "Transliteration of the Japanese word, using Hepburn Romanization." },		"4": {			"label": "Extra text inside parentheses", "type": "string", "description": "Adds extra text inside the parentheses. ", "aliases": [ "extra" ]		},		"5": {			"label": "Extra text outside parentheses", "type": "string", "description": "Adds extra text outside the parentheses. It is only useful in \";\" definitions (it will be displayed without bold, whereas text following the template, will be bolded). Literal translations and linguistic glosses must use single quotation marks, not double.", "aliases": [ "extra2" ]		},		"lead": { "label": "Lead formatting", "type": "string", "description": "If set to yes, changes formatting style for the first instance of Japanese, usually in the lead. It gives the reader an idea what kind of non-English writing they are viewing.", "suggestedvalues": [ "yes" ]		}	},	"paramOrder": [ "1",		"2",		"3",		"lead", "4",		"5"	],	"format": "inline" } &#x3c;/templatedata&#x3e;

&#x3c;includeonly&#x3e;&#x3c;/includeonly&#x3e;