Board Thread:TrainStation Wiki News/@comment-26185947-20150413212416/@comment-15636815-20150419200358

Yes, the new Template:Cost-de looks much better. Most important, it now works! LOL

I recommend a few changes and tweaks. On the surface, each of the items below has a different reason. Underneath everything, all of them have the same reason. When people want to display as much information as our Wiki displays, and make it look good, and add to it constantly, they have a complex site, and they must decide how to deal with the complexity. If the users and editors have reasonably complex knowledge, then the templates can be simple. Most of our users don't want that level of knowledge; therefore, our templates are complex so that our users can use what's comfortable for them--or even screw up a little bit--without affecting the output.

The solution provided by the forum members (using #replace to change parameter names) works only if all template calls always use the same parameter names, always in the same order, no matter what. Of its many positive attributes, the best and most important feature of Template:Cost is that it allows users to send parameters in any order they choose, plus it forgives the most obvious mistakes ("gem" for "gems", "nail" for "nails", etc). It then produces output in a 100% consistent order--the levels at which the materials become available.

Since you've made the current version of Template:Cost-de bilingual (which I like), I recommend moving the German parameter names to their appropriate locations between the English names. It's your decision whether "Holz" should come before "wood" or after "wood", but it definitely belongs next to "wood". Otherwise, if someone decided to send parameter names in two languages within one template call (I've seen things much stranger), the output would not keep its consistent sorting.

To help with data entry, I added to Cost alternate parameter names that use only the first four characters. This also provided some consistency with Infobox wagon, which had a new-at-the-time ability to accept only four characters for the wagon type. You may find that having long and short versions of the German parameter names within Template:Cost-de works well, too.

in addition, parameter names are case-sensitive, including the first character. Although all nouns in German are capitalized, is it possible that someone may decide to construct a template call using "holz" or "gummi" instead of the correct "Holz" or "Gummi"? If so, or if you merely wish to allow for someone's keyboard not working properly, you could add lower-case versions of the German parameter names, too. Obviously, you would place them in the template code next to (probably after) the correct spellings. It's up to you whether you think that's important or even necessary. I'm just giving you information, which you may use as you see fit.

If you used the idea from the Forum, you would have to allow for the fact that you can control only the output. Since users can enter named parameters in any order they choose, their short  also would need to test for the other 35 parameter names that Cost allows. That's right. It can output only 18 types of resources (the 16 materials, gold, and gems), but it allows users 36 ways of referring to them. So your #replace function just got huge. When you're done with that, you get to do it all over again, for parameter, then again for parameter. If you stop there, and someone sends more than three parameters, then may the gods help you, because no one else will. I think now you understand why our template is far too complex to allow the Forum's simple solution to work. ;-)

Variable names. These are internal to the template. While the values assigned to variables can leave the template, the names of the variables cannot. Therefore, using something like  and. That would further "Germanize" the template, plus make it easier to understand for those who come after you, who presumably will speak German but may or may not speak English. Just a thought.

While you're at it, I'm sure your German user base would appreciate German versions of the three new optional parameters, as well:
 * line - produces output on one horizontal line
 * cont (short for contractor) - formats output for use in a contract list
 * qty (abbreviation for quantity) - for use in contract lists; multiplies input (for one of given item) and gives output for total number of items required by contract

Finally, I see that when the template accepts a parameter in English, it sends the data to a template in English, and so for German. One on level, this makes sense. On the other hand, it may make more sense for all output to go to templates in one language, regardless of the input language. Even if one language redirects to the other, it may give the template code a cleaner look. It works either way, though, and we can make strong arguments either way. Ultimately, it's a judgment call, and I'll leave it to the German admin to make it.