Template talk:Currency

From Guild Wars 2 Wiki
Jump to navigationJump to search

Deletion[edit]

I think it's obvious it's best to have a single template that handles all the objects from the same type, isn't it? between other things, if we ever want to change the layout, we have to edit this single template, and not one template for each currency. Also, this template makes the icon link to the page (and in a minute or two, will have displayable optional text). I think this isn't the one needing deletion :P.--Lon-ami 18:43, 2 May 2012 (UTC)

Personally I feel using individual templates (as we already do) is more intuitive and user friendly, ultimately. - Infinite - talk 18:45, 2 May 2012 (UTC)
I'd like to settle for a compromise. Make this a generic template as it is now, where you can just do {{currency|gold}}. Then modify all the specific templates to point to this one. That way we get the simplicity of typing {{gold}}, but with the added benefit of easily being able to change all currency templates in one go. — Rhoot User Rhoot sig.png 18:48, 2 May 2012 (UTC)
I am in favour of that. - Infinite - talk 18:50, 2 May 2012 (UTC)
I don't see non-intuitiveness here, but if you're worried, just make those other templates call this one?
The only thing I would change from your suggestion, Rhoot, is making it be {{currency|coin|gold}} instead, so the icon links to "coin". The 3 coin icons would need to be moved, though.
By the way, text feels ugly, and I've a better plan... :P.--Lon-ami 18:52, 2 May 2012 (UTC)
(Edit conflict) I dunno. That seems like a performance hit, first for a nested template call and then for sifting out which currency you want. --JonTheMon 18:51, 2 May 2012 (UTC)
Keep in mind transclusion only happens on page edit. After that it's cached. The performance hit wouldn't be noticable at all. Also, I'd prefer it to be {{currency|gold|coin}} instead of the other way around. The reason being for consistency with currencies that don't link to some other page, as I expect {{currency|karma}} wouldn't. — Rhoot User Rhoot sig.png 18:56, 2 May 2012 (UTC)
Addition: Actually, I just took a look at the order of parameters and realized you were thinking of it the other way around from how I was. Now I'd prefer if your version instead. — Rhoot User Rhoot sig.png 18:58, 2 May 2012 (UTC)
I think the template is perfect now. Might add colors to the text depending on the currency (first need to decide which colors are the best, and if they're the ones from the game, then better). To work fine, these 3 icons need to be moved:
Don't worry about breaking anything, redirects should stay around.
PS: Documentation is always better outside the code, to make it easier to see; I know this one has a small code, but still, it's not a problem :P.--Lon-ami 19:28, 2 May 2012 (UTC)
Didn't notice I could move them myself. Everything is working as intended now.
Don't tell me you don't love the template :P.--Lon-ami 19:31, 2 May 2012 (UTC)
I disagree with those moves - "Bronze coin" et al follow our naming scheme for images, but your proposal uses capital letters for each word and omits the space between them, both of which we tend not to do for any naming scheme, be it for images or articles. I think we also generally go for intuitive names that reflect, or copy, the in-game names/general English; "bronze coin" does this better than "CoinBronze". pling User Pling sig.png 19:33, 2 May 2012 (UTC)
What's first? Coin, thus it's a coin. What's next? Bronze, so it's a bronze coin. Anyway, users aren't supposed to use [[File:...]] anymore if they have this template and the others. Also, making this template work with the previous file name is a pain, would need 3 ifeq or a switch :S. And anyway, the old names redirect to the new ones.--Lon-ami 19:42, 2 May 2012 (UTC)
Whilst that system may work on other wikis, the consensus here is not that of other wikis. Our image formatting attempts to be as clear and accurate as possible. In this case the image formatting is accurate; File:Gold coin.png depicts a gold coin. - Infinite - talk 19:45, 2 May 2012 (UTC)
I could live with File:Gold.png, but File:CoinGold.png both looks off and feels off. — Rhoot User Rhoot sig.png 19:50, 2 May 2012 (UTC)
I can make it work with Gold.png or GoldCoin.png if you prefer those versions. The only things necessary are no spaces and all words starting in capital letters.--Lon-ami 19:58, 2 May 2012 (UTC)
Actually, based on your formatting and parameter descriptions, CoinGold wouldn't have made any sense anyway, since usually you have a sub-type before a type. Bear is a type, Polar Bear is a sub-type. --JonTheMon 20:03, 2 May 2012 (UTC)
Not for templates where you have many subtypes. "Polar" depends on "Bear", so you put it after; but yeah, I know what you mean. Don't want to move anything again without consensus, but I think you would be fine with any of the 2 alternatives above.--Lon-ami 20:12, 2 May 2012 (UTC)
Anyhow, our convention is to have the names in proper order with spaces between the parts. And while it might be fine to drop coin from the title, the fact that it links back to coin is a bit against that. Might need an image override *shudders* --JonTheMon 20:16, 2 May 2012 (UTC)
(Edit conflict) Irregardless of what the name would like to be, we have an image formatting guide for the purposes of keeping it standard. Inventory icons are to be named to match the inventory icon. Thus a gold coin should be gold coin, a sliver coin should be silver coin, etc. Venom20 User Venom20-icon-0602-sm-black.png 20:18, 2 May 2012 (UTC)
What about "Gold Coin"? the formatting of the wiki seems to accept that one. The spaces aren't a problem for this case. Whatever you decide, please "Coin" instead of "coin", or the template will be a mess :S.--Lon-ami 20:36, 2 May 2012 (UTC)
Capitalization follows standard English rules, thus only propoer nouns are capitalized. So coin should be lowercase. Venom20 User Venom20-icon-0602-sm-black.png 20:40, 2 May 2012 (UTC)
I was taking Ghastly Sword as the reference. Anyway, seems the function needed to make it work with the old filename works after all (should be fine with just one exception, and I don't think they'll add any new currency with subtypes soon).
Moving the icons back to their original place (guess there should be no problem).
Hey, at least I got to know the policy (Trial error FTW). Sorry for the trouble :P.--Lon-ami 20:51, 2 May 2012 (UTC)
Seems they were already moved (redirect tricked me). Feel free to delete the unused ones now.
Aaand now, do you like the template? xD. Feel free to suggest colors for the text (seems switch is installed, so I shouldn't have any problem adding it).--Lon-ami 20:56, 2 May 2012 (UTC)

(Reset indent) If you use a #switch to translate the coin types, you could reduce the input to 1 required parameter and optional text.

 {{#if:{{{text|}}}|{{{text}}} |}}[[File:{{#switch:{{lc:{{{1|}}}}}|bronze=Bronze coin|silver=Silver coin|gold=Gold coin|#default={{{1|error}}}}}.png|link={{{1|}}}]]

For currency, accepted input values would be (bronze, silver, gold, karma, glory, influence, gem). —Dr Ishmael User Dr ishmael Diablo the chicken.png 20:57, 2 May 2012 (UTC)

You would need another switch for the Coin link, nope?--Lon-ami 21:03, 2 May 2012 (UTC)
 {{#if:{{{text|}}}|{{{text}}} |}}[[File:{{#switch:{{lc:{{{1|}}}}}|bronze=Bronze coin|silver=Silver coin|gold=Gold coin|#default={{{1|error}}}}}.png|link={{{2|{{{1|}}}}}}]]
This would probably work. I'm still not sure about the "text=" parameter, it just feels a bit awkward. I might actually want parameter 2 to be the text and use "link=" for the different target. --JonTheMon 21:05, 2 May 2012 (UTC)
It's not necessary if Gold, Silver, and Bronze are all redirects to Coin (Gold already was, and I just created Bronze and Silver).
The way I've seen "cost" templates like this work is {{cost|amount|currency}}, e.g. {{cost|3|bronze}}, such that it reads naturally. So I'd actually rewrite this as:
 {{#if:{{{1|}}}|{{{1}}} |}}[[File:{{#switch:{{lc:{{{2|}}}}}|bronze=Bronze coin|silver=Silver coin|gold=Gold coin|#default={{{2|error}}}}}.png|link={{{2|}}}]]
It still allows displaying just the icon by providing a blank first parameter, {{cost||bronze}}.
Individual currency templates would accept the amount as parameter 1, pass it to this as parameter 1, and hard-code parameter 2 to whichever currency that template is for ({{bronze}} would have the code {{currency|{{{1|}}}|bronze}}). —Dr Ishmael User Dr ishmael Diablo the chicken.png 21:14, 2 May 2012 (UTC)
Note that the template should work with no text, too, just to show the icon, so the text field must be last or have a specific name. Having to leave empty space on purpose is ugly, lol. And anyway, isn't currency put before the quantity in English?
Are you ok in GW2W with linking to redirects? pretty much all wiki editors I've met dislike it, and encourage linking directly to the specific page. Redirects are left for quick access from the url only. Guess Gold, Silver and Bronze can be an exception, because they could redirect to a section inside of coin some day.
Any idea about colors for the text?--Lon-ami 21:31, 2 May 2012 (UTC)
Currency symbols aren't a good basis, since they can be before or after the number, but when you write it out, you always write "3 dollars" or "15 euros", number is first.
If the currency-specific templates are set up like I suggested, then simply calling {{bronze}} would produce the icon. That's easier to remember than having to pass it as a parameter to a different template. In general, it should be intended that this template is rarely used directly, and you use the currency-specific templates instead.
For links typed in wiki text, they should avoid redirects because it's easy to pipe the text with the "true" name. For links generated by templates, most of the time it's accepted since it's more difficult to get the true name within the template. —Dr Ishmael User Dr ishmael Diablo the chicken.png 21:39, 2 May 2012 (UTC)
The game puts them after the text, so there they stay.
Template updated to fill the new role, with updated documentation as well.--Lon-ami 22:06, 2 May 2012 (UTC)

Lowercasing to accept errors[edit]

Do we really need to lowercase the switch to fix the typos of whoever is using the template? Letting {{Currency|23|BroNZe}}: {{Currency|23|BroNZe}} work fine feels wrong. People should write right, in my opinion.--Lon-ami 22:29, 2 May 2012 (UTC)

It's an error-avoidance feature: since you can't control what the user will enter, you convert the input to a specific case structure (usually lc, but uc works too) that matches the options you code in the switch block. With the previous version, the completely lower-case "bronze," which is the most common way of entering template parameters, would not work properly. This way, "bronze," "Bronze," "BRONZE," and, yes, "BrOnZe" will all work. —Dr Ishmael User Dr ishmael Diablo the chicken.png 22:59, 2 May 2012 (UTC)
I know how it works, but isn't everyone supposed to use "Show preview" before saving? It's not just bad syntax-wise, if we ever decide to change how the template works, we'll have to deal with those multioptions :S.--Lon-ami 08:57, 3 May 2012 (UTC)
No, it's simply best practice to always assume users will make mistakes. Maintain consistency within your code, but don't force it on the user. —Dr Ishmael User Dr ishmael Diablo the chicken.png 12:46, 3 May 2012 (UTC)
That's not the point. Users must write correctly, whether it's orthography or template syntax. It's not forcing, it works like it works. They'll make mistakes? yes, and that's why "Show preview" and template documentation exist, so they can fix them by themselves, instead of writing like they want and making future template maintenance a problem.--Lon-ami 14:35, 3 May 2012 (UTC)
Users *must* nothing. With that approach we isolate experienced wiki users from inexperienced wiki users and that should never be the primary focus. This practise is in place to catch the odd formatting some users find natural; but as long as it works it doesn't harm us. There will never be a lot of articles using the odd spelling "BrONzE," per example. We can catch those manually. - Infinite - talk 15:08, 3 May 2012 (UTC)
Users "must" not respect English grammar when they write? this is just the same, just like you need to write "Category:" to categorize something instead of "CATEGORY:". For this template it won't be a problem, because I don't see how it could change to affect it, but you'll have a lot of problems with more complex templates with that mentality...
For example: {{Currency||GOLD}}: Gold coin, see where the icon links. Guess it's better to apply a ucfirst over a lc rather than making people respect the syntax. And then it wouldn't be fair if {{Currency||KARMA}}: Karma.png doesn't work, would it?
Users make mistakes, and they won't fix them because the template "seems to work".--Lon-ami 15:36, 3 May 2012 (UTC)
The mentality, however, is that users must not be forced to type in a specific way if we can make things work without having to contact them about it (user talk pages can always be utilitised to contact the user who "TYpesS EVERYTHING LikE THIs" in order to prevent future edits that way). If "Bronze" can be typed where users would actually have to type "bronze," should we be as rude to tell them no? We can't tell users who are unfamiliar with wikis how to format it. You can make things common practise all you want; unfamiliar users will trial and error to find out what appears to work the best. - Infinite - talk 15:46, 3 May 2012 (UTC)
(Edit conflict) Not all wiki-users use english as a first language. It would be silly to believe so and would only show discrimination towards non-english people. Coding something that takes into consideration all forms of data entry is just very good practice. For instance, I noticed that in the above paragraph you started a sentence without a capitalization. Should be draw and quarter you for that? Probably not. Some people enjoy typing with sticky caps and as such, a lc command would just make everyone else's life easier. Venom20 User Venom20-icon-0602-sm-black.png 15:51, 3 May 2012 (UTC)
Generally I agree with you Lon-ami, people should just type it correctly. GWW and GW2W both get a vast majority amount of their edits from anons however. Users who aren't very likely to be familiar with wiki workings and our policies but just want to fix something they found lacking. Some will do {{currency|bronze}}, some will do {{Currency|Bronze}}, the majority will probably just link it directly. I admit very few will do {{Currency|BrOnZe}}. Having to manually go through each edit and correct capitalization is a maintenance hazzle and if we can do it automatically it's a lot easier for everyone. Also, it helps with consistency.
In this particular case it's not that much of an issue since the generated [[bronze]] works just as well as [[Bronze]], but regardless I don't see a reason why it's bad to have it there. — Rhoot User Rhoot sig.png 16:01, 3 May 2012 (UTC)
Thanks for those examples Lon-ami, they pointed out deficiencies in the template that I've corrected. Now it is even more flexible with regards to user input.
Best practice for coding anything is to assume the user is stupid and to try to cover every conceivable way they could break your code. I agree that trying to teach people better grammar/etc. is a noble goal, but not one that should be achieved by making your code inflexible. Also, a template call is not prose text, and the usual standards of grammar and style can't really apply there. —Dr Ishmael User Dr ishmael Diablo the chicken.png 16:03, 3 May 2012 (UTC)
You shouldn't have corrected it while we're still discussing if they're really necessary, but well.
@Infinite: WTF? It's EVERYTHING explained here: {{Currency}}. You don't need to contact anyone to tell them how to use a template, documentation pages exist for that reason, so they check them before using templates and learn how they work.
@Rhoot: It's easier if they write it well, because then there's nothing to fix. Users aren't stupid, they just don't know how things work, and they learn by trial error and reading guides and documentation.
I repeat this template won't give problems, but keeping that mentality for complexer templates will make them outright inviable :S.--Lon-ami 19:06, 3 May 2012 (UTC)
Honestly, LC and UC actually make templates easier since you don't have to deal with multiple cases for the same result. As for the changes being prematurely applied to the template, it's not like the template is in widespread use and being changed without discussion. And while documentation is helpful, not everyone reads it or benefits from it; not the ideal situation, but it's what we have to deal with. And instead of makign them get it right the first time through trial and error, why not just deal with it and make it work for similar input? --JonTheMon 19:15, 3 May 2012 (UTC)
I've been working on GuildWiki for over 5 years now. Trust me, the majority of wiki users do not read documentation until you point it out to them. If they think they're using a template right but it returns an error, they're not going to try-try-again or seek out documentation, they're going to give up, and you've lost a potential editor. —Dr Ishmael User Dr ishmael Diablo the chicken.png 19:28, 3 May 2012 (UTC)

General coinage calculation?[edit]

I know it will take a little work, but could a 'coin' option be added. It should take a number like 1000 and figure out that that is equivalent to 10 {{silver}} (10 Silver coin). 'coin' should be the default media, so {{currency|1}} (which is currently broken) would generate 1 {{copper}} (1 Copper coin). --Max 2 05:24, 16 June 2012 (UTC)

I think that a different template handles this well: Template:Coin. Redshift 10:08, 16 June 2012 (UTC)
{{coin|1000}} does this. Edit: Heh, misread Redshift's comment. Oops. --Eerie Moss 10:11, 16 June 2012 (UTC)
I'm used to it ;). Redshift 11:10, 16 June 2012 (UTC)

Making this template useful[edit]

I have some plans, but I'd rather see your opinion first than get reverted while I'm on it.

  • Warn this template isn't supposed to be used directly.
  • Change syntax to {{Currency|<Image name>|<Link>|<Quantity>}}.
  • Make this template usable through Template:Gold, Template:Karma, Template:Experience...
  • Those other templates would stay the same, except for a new optional field, to display a number.

Well, opinions? I think it's pointless to use this directly, when we have the other more-intuitive templates, and this change could give this some usefulness.--Lon-ami 14:10, 2 July 2012 (UTC)

Making this template the core of the other templates is something that was thrown around, but no consensus was really reached on it. As for changing the order of the parameters, I think the agreed-upon order above was quantity-type-link. --JonTheMon 13:22, 6 July 2012 (UTC)
Right - the parameter order should match the display order, even if this template isn't used directly. —Dr Ishmael User Dr ishmael Diablo the chicken.png 14:02, 6 July 2012 (UTC)
It's the logic order, considering templates calling this template only have 1 editable parameter: text. Going back to the previous one would be confusing and inefficient with its current incarnation. Also, text is an optional parameter, while the other two aren't. And anyway, this template should never be used directly, which means we care about efficiency, and not about "it looks nice", since it doesn't need to look like anything at all.--Lon-ami 14:48, 6 July 2012 (UTC)
Also, reverting you Jon, since I plan on using this to simplify {{Value}} later, and anyway, anyone should be able to use {{Gold}} if they want a simple way to represent something.--Lon-ami 14:53, 6 July 2012 (UTC)
I doubt any changes here will simplify Template:Value. Also, the gist of the templates is to show icons. Extending the functionality beyond that is something that needs consensus. And while the other templates will be simpler invocations of this template, this template still needs to be usable and parameter order needs to be logical. --JonTheMon 17:07, 6 July 2012 (UTC)
There's many "don't reference it directly" templates around, why this one being another is a problem? I think it's better to use {{Gem|quantity}} rather than {{Currency|...}}. Anyway, using this just to show icons is... well, we don't need a template for that, do we? And I know you could write "100 {{Gold}}" instead of "{{Gold|100}}", but I did it with formatting options in mind.
As for parameter order, when you use the concrete version (the one you're supposed to use) you write the quantity after the type. Back to Currency, making it change, and making quantity go before type, when it's the only optional field (meaning it would force you to write it empty all the time you use the template without quantity) doesn't make too much sense. Obligatory fields should always go before optional ones, in my opinion.
The simplification part is relative, yes, but I don't think you should be forced to use value if you just want to output "10 gold". When you want to do that, theres nothing easier and simpler than writing {{Gold|10}}.--Lon-ami 19:28, 6 July 2012 (UTC)
I mostly don't understand why you felt all the other templates needed to be changed so that they relied on this template, when they were all working fine as they were. —Dr Ishmael User Dr ishmael Diablo the chicken.png 18:05, 6 July 2012 (UTC)
They're working fine now, nope? And now you don't need to edit them one by one, you only need to edit this one. There was code redundancy, since all of them did the same, and now there isn't. Also, now all of them link to their pages, and you can add a quantity. How is that exactly problematic? Improving stuff is always good.--Lon-ami 18:23, 6 July 2012 (UTC)
Just 'cause you can make a template do something doesn't mean it should be done. It may seem like improvement, but it may just make things worse overall. That's why we talk it through and figure out the best use together. --JonTheMon 18:56, 6 July 2012 (UTC)

(Reset indent) I worry that we haven't given any thought to how this template is used in infoboxes. For DPL queries, it's important that any currency values be listed consistently, e.g. always {{value|102}} instead of 1{{silver}} 2{{copper}} — those might appear the same on screen, but they return very different results from DPL. – Tennessee Ernie Ford (TEF) 17:30, 7 July 2012 (UTC)

Current revision[edit]

I'm not sure what you're going for, but right now this template isn't properly displaying the amount of currency in use, since you no longer have a third parameter. --JonTheMon (talk) 18:32, 13 May 2013 (UTC)

The template shouldn't have had that second parameter anyways.--Relyk ~ talk > 18:39, 13 May 2013 (UTC)
I don't think that's justification for just changing this template outright, especially since it's in use. Anyhow, this template is a bit of a placeholder, since the help text itself says "use these other templates". --JonTheMon (talk) 18:42, 13 May 2013 (UTC)
There isn't any place you use the template itself since we have templates for all the currencies. The second parameter should be the link parameter if you wanted a generic icon link. I'll switch it to the reverse approach (same as my icon suggestion) so it at least doesn't break.--Relyk ~ talk > 18:50, 13 May 2013 (UTC)
"There isn't any place you use the template itself" The wiki begs to differ. I'm guessing you mean "any place you should use the template" —Dr Ishmael User Dr ishmael Diablo the chicken.png 18:54, 13 May 2013 (UTC)
If you look closely, most of that is a guy copypasting laurel code on items instead of using {{laurel}}. So yes? I honestly find this quite useless since the practice is to implement any currency or token in it's own template and we end up replaces all instances of the currency template.--Relyk ~ talk > 19:09, 13 May 2013 (UTC)

formatting[edit]

So the currencies can use a formatting parameter like {{coin}} so we can have it line up on {{vendor table row}} and the like. We only need ~5 character spaces since no number goes above 5 digits for a single cost or ever will. The only defined currency templates this is need for would be glory and influence.--Relyk ~ talk < 08:53, 8 August 2013 (UTC)