Japanese Template misuse by MewBot

Japanese Template misuse by MewBot

There are three types of Japanese kanji categories that normally show up in Wanted Categories:

  1. [[Category:Japanese terms spelled with <kanji> read as <hiragana>]]. The category takes takes {{ja-readingcat}} with three numbered parameters:
    1. The kanji (required)
    2. The hiragana (required)
    3. The type of reading- normally either "on" or "kun". It can be left blank, but it gets added to a cleanup category.
  2. [[Category:Japanese kanji read as <hiragana>]]. The category takes {{ja-readascat}}, with only one parameter:
    1. The hiragana (required)
  3. [[Category:Japanese terms spelled with <kanji>]]. This isn't a Japanese-specific type of category- I've always just used {{charactercat}}, which takes two parameters for these entries:
    1. The language code (ja)
    2. The kanji

The first category is added by a template to the entries themselves. {{ja-readingcat}} in the first category adds the other two categories to that category. All three category types should be very easy to automate: all of the information needed to populate the template parameters is included in the category name in a very consistent pattern. The third parameter for {{ja-readingcat}} is an exception, since it's completely unpredictable- but it's optional

Haplology never got around to putting much error-checking in these, so bad input creates categories that look deceptively normal. In the 28 categories of the second type that I just fixed, {{ja-readingcat}} is the wrong template for such categories and "kanji" is the wrong first parameter, but it sort of works. For example, in the original version of Category:Japanese terms spelled with kanji read as ゆみ, the first line reads "This category lists Japanese terms spelled with kanji read as ゆみ." It's only when you check the linked word that you find that it's linking to "kanji#Japanese" as if kanji were the entry for a CJKV character. All three categories at the bottom of the page are bogus, but look real. The first should be something like Category:Japanese terms spelled with 弓, but is instead [[Category:Japanese terms spelled with kanji]]. The second is a self-reference, and the third shouldn't be there at all.

Before I started using the Japanese templates, I spent a good bit of time looking at existing categories and the entries that referenced them to see what the current practice was, and how everything worked. You should have, too. Please be more careful.

Chuck Entz (talk)07:31, 19 July 2014

I suppose that rather than considering this an error, we could adjust the template so it handles the case where the first parameter is "kanji" properly?

CodeCat10:59, 19 July 2014

Why? {{ja-readascat}} and {{ja-readingcat}} do different things. If you want a template to do both, you don't need a parameter to tell which one- it's all there in the category name:

  1. "Japanese terms spelled with " + <character>:
    1. Nothing following: {{charactercat|ja|<character>}}
    2. Followed by " read as " + <hiragana>: {{ja-readingcat|<character>|<hiragana>}}
  2. "Japanese kanji read as " + <hiragana>: {{ja-readascat|<hiragana>}}

It would be nice to have something with a name like {{ja-readcat}}, having one optional parameter for the reading type, which would only be used in cases now covered by {{ja-readingcat}}. This would make it extremely easy for humans to use and require no decisions by bots beyond recognizing the categories that use it. Using the new name rather than either of the old ones would mean not having to allow for the old parameters.

The simplest thing would be to just have the new template behave as above, acting as a front end to call the correct template with the correct parameter(s). If you want to merge the templates, then incorporate the logic of the two ja templates in the new template, but don't mess with the charactercat part of it, for compatibility with all the other languages.

Chuck Entz (talk)18:14, 19 July 2014