Template:Ja

<!-- This is a series of logic tests that analyses a short, specifically-arranged string containing Japanese characters, and:
 * 1) Transforms it into a link to the Japanese Percival Wiki on Wikia
 * 2) Automatically adds a standard interlanguage link at the bottom of the page

Usage
If using in an template, use it in this fashion in the output field by calling on Template:Langdecide x =

How it works

 * Note no matter what the first string is, if the second override string is stated, that override string is used directly as the link which bypasses parsing the first text string, while displaying the first string as the viewed text. This is useful if the target page does not and will probably not exist, and one wishes to manually disable or redirect the resultant link, for example.

" , so it's a catch-all
 * 1) First it takes the string up to the first "(" sign which marks the start of the English literal translation if applicable, or, if the symbol is absent, it takes the whole string. The Japanese name should not contain the "(" sign.
 * 2) Second, it takes that string, right up to  ", which is part of the HTML breaking tag denoted by  " "  or  "
 * 1) Third, it takes that string, analyses it for a "/" symbol, which is used to separate alternative Japanese names. This is where the pos field comes in. If not entered, it gives a value "0", which means to use the first part, before the "/" sign. Give it the value "1" and it uses the second part. If there are multiple "/" characters, higher values can be used to output sections after each "/".
 * 2) Finally, it takes that string, analyses it for whitespace i.e. spacebar characters, substitutes these with "_", and concatenates the rest of the address onto the Japanese string.

Limitations

 * 1) It assumes that all Japanese characters are in front of all other characters.
 * 2) It assumes that Japanese characters are separated from all other characters by a "(" sign
 * 3) It assumes no "(" characters are contained within the Japanese text string
 * 4) It assumes that alternate Japanese names are separated by "/"
 * 5) It cannot check whether the link gives an article or a red link on the target wiki

If the string or usage conditions cannot satisfy all five conditions, then this template will not provide the proper link or the complete solution. In that case, specify the link directly within the second parameter of langdecide so the string is not parsed.