Japanese is a module used to display Japanese characters and pronunciation.
Features[]
- Highly customizable with classes, inline styles, and portable/modular CSS.
- Highly performant and backwards compatible with previous incarnations of the template.
- Uses semantic markup and modern CSS for SEO, accessibility, and mobile-friendliness.
- Optional features such as left- and right-aligning the pull quote. The template breaks silently and elegantly when not all parameters are provided, giving it flexibility.
How to install[]
Module[]
First thing is the module itself. You don't need to copy the code. Just create a module titled Module:Japanese (or any other—just remember to adjust #invoke calls) and put this in the code
return require('Dev:Japanese')
CSS[]
CSS for this template is entirely optional, and provides minor formatting to the output. To do this, copy and paste from the following:
.jTemplate {
font-weight: normal;
font-style: normal;
}
.jTemplate .romaji {
font-style: italic;
}
.jTemplate .lit:before {
content: '“';
}
.jTemplate .lit:after {
content: '”';
}
.jTemplate .help {
font-size: 9px;
font-weight: bold;
line-height: 0;
vertical-align: super;
}
Template[]
The module is designed to be used as a regular template. To do that just create a template (ex: Template:J) with following content:
{{#invoke:Japanese|initJ}}
Now the template you created will accept parameters documented below.
Usage[]
| Type | {{J|Japanese|Rōmaji|Literary meaning}} |
|---|---|
| Result | (Japanese, Rōmaji?, lit. Literary meaning) |
For example:
| Type | '''Necron''' {{#invoke:Japanese|initJ|永遠の闇|Eien no Yami|Darkness of Eternity}} |
|---|---|
| Result | Necron (永遠の闇, Eien no Yami?, lit. Darkness of Eternity) |
An optional fmt parameter allows the display text to be changed. The default is (j,r). Below are examples of alternatives, j(r), r(j), j, and j,r.
| Type | {{J|リヴァイアサン|Rivaiasan|fmt=j(r)}} |
|---|---|
| Result | リヴァイアサン (Rivaiasan?) |
| Type | {{J|リヴァイアサン|Rivaiasan|fmt=r(j)}} |
|---|---|
| Result | Rivaiasan (リヴァイアサン?) |
| Type | {{J|リヴァイアサン|fmt=j}} |
|---|---|
| Result | リヴァイアサン? |
| Type | {{J|リヴァイアサン|Rivaiasan|fmt=j,r}} |
|---|---|
| Result | リヴァイアサン, Rivaiasan? |
fmt can contain any string. Instances of j are replaced with the input Japanese, r with the rōmaji, and l with the lit. translation. If l is not used and there is a lit. translation given then it always goes after either the Japanese or rōmaji, whichever is used second (although both would be required).
Spacing is ignored and handled automatically. To preserve spacing and to print "j", "r", or "l" characters, square brackets can be used and their contents remain. Square brackets can be printed literally inside of square brackets, however the "j", "r", and "l" values cannot appear inside them.
| Type | {{J|リヴァイアサン|Rivaiasan|Leviathan|fmt=[Japanese [katakana]: ]j[, Rōmaji: ]r[, Lit. translation: ]l}} |
|---|---|
| Result | Japanese [katakana]: リヴァイアサン, Rōmaji: Rivaiasan?, Lit. translation: Leviathan |