Template talk:Currency

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
WikiProject iconEconomics Template‑class
WikiProject iconThis template is within the scope of WikiProject Economics, a collaborative effort to improve the coverage of Economics on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
TemplateThis template does not require a rating on Wikipedia's content assessment scale.

Danish krone[edit]

The Danish krone is not displaying correctly. Example:

DKr 500,000 = {{currency|500,000|DKK}}

It should look like:

kr 500,000

Thanks. Green Cardamom (talk) 17:00, 29 June 2011 (UTC)[reply]

Fixed (updated ~Currency/Types). Green Cardamom (talk) 17:13, 29 June 2011 (UTC)[reply]

I think it would be appropriate to allow for an alternative display of at least the krone currencies. Domestically it is common, at least in Norway (and I assume Denmark) to display the currency as is done above, however when addressing an international audience I believe the display is more common as is presented with the currency template {{NOK}}, i.e.
500,000 kr = {{NOK|500,000}}
Would it be a good idea to implement a switch that allowed for the alternative display format, somehow? __meco (talk) 18:37, 14 April 2012 (UTC)[reply]
OK.. I just added a new type to Currency/Types called NOK2 so how about {{currency|1,000|NOK2}} = 1,000 NOK. Green Cardamom (talk) 19:00, 14 April 2012 (UTC)[reply]
That's good with me. Of course, it should be documented somehow also. Otherwise I'm the only one who will be making use of this :-) __meco (talk) 20:06, 14 April 2012 (UTC)[reply]
Ok added an example. The template isn't much used, but hopefully in the future it will. Green Cardamom (talk) 21:38, 14 April 2012 (UTC)[reply]
BTW do you know what, or if, the alts are for the Danish DKK and Swedish SEK currencies? Are they sometimes presented as SEK 1000 or DKK 1000? Green Cardamom (talk) 21:41, 14 April 2012 (UTC)[reply]
I couldn't tell you for a fact, but I believe so. I would take the chance and simply copy the procedure you made with regards to NOK. __meco (talk) 21:49, 14 April 2012 (UTC)[reply]

Nowrap feature request[edit]

When the currency type has a space between the symbol and number, like the Danish krone above, it would be better if there was no line-wrap between them. Demonstrate:

This is an example line of text, with a sample of kr
500,000 to demonstrate awkward line-wrapping.

I think it would be easy to fix, but maybe not. Green Cardamom (talk) 17:18, 29 June 2011 (UTC)[reply]

This feature exists in Template:INRConvert, should be easy to copy into this one. Is anyone maintaining this template? Green Cardamom (talk) 04:51, 5 July 2011 (UTC)[reply]

Template:nowrap provides this feature also, as an example to copy from. Green Cardamom (talk) 05:33, 19 July 2011 (UTC)[reply]

OK, no one's responded, and the template is open to edit, so I just added some simple code to enable nowraping. If this breaks anything I apologize, please revert, but it does appear to prevent line wrapping without breaking anything I can see. Green Cardamom (talk) 05:50, 19 July 2011 (UTC)[reply]

I just stumbled across this template after finding a strange line break in an article using it. I think I've fixed it, but please report any problems that are seen cropping up. I'm watching this template now. Huntster (t @ c) 09:45, 10 January 2012 (UTC)[reply]

Supporting Format price[edit]

Calling {{Currency|{{Format price|123E6}}|EUR}} can be a bit unreadable. Therefore I added internal Format price support to the Currency Template. You can find my version here. If there are no objections then I'd merge the changes to the official currency template. The use of Format price can still be prevented by adding the noformat=yes option. --Wikieditoroftoday (talk) 13:26, 29 September 2011 (UTC)[reply]

Would it break existing instances of "currency" since it's an opt-out feature? Green Cardamom (talk) 14:41, 29 September 2011 (UTC)[reply]
I don't think so. It has a fallback if the amount is not a number (and Format price would display NaN)
1,000,000,000
It would however change how some amounts are displayed
1,234,567,891
--Wikieditoroftoday (talk) 10:50, 30 September 2011 (UTC)[reply]

On checking What links here only shows 50 or 75 articles using this template, shouldn't cause too much disruption, and better for the alpha display to be default going forward. One article I used it lot in is List of the world's richest literary prizes, I'll probably need to go back and add the noformat=yes to the second column to keep it consistent. Tables are where numerical display is usually preferred over alpha, may need to check the articles for those cases. Also perhaps instead of "noformat", call it "display=alpha" or "display=num" is more descriptive. Green Cardamom (talk) 19:44, 30 September 2011 (UTC)[reply]

Rounding of LARGE currency values[edit]

I like the idea in the previous section of a single currency template that would be able to properly format VERY LARGE currency amounts; i.e., amounts with 6 to 15 zeros. For example, US$280,000,000 would show up as US$280 million rather than 9 digits. But I can't figure out how to use the (two different???) currency templates to do so without all the nested "Format" falderal. And documentation help would be great! Is this capability being planned by those of you editors who care about currency templates and know how to write the code? Thanks. N2e (talk) 20:53, 10 November 2011 (UTC)[reply]

Is anybody there? Anybody reading this willing to help me with this problem? N2e (talk) 22:19, 4 December 2011 (UTC)[reply]

"kr" placed before the number[edit]

Why is the "kr" of the krone (or krona, for Sweden) currencies placed before the number? In normal usage, it is always written after, and read as such: using Norwegian as an example, 5 kr = "fem kroner", not "kroner fem", which is what "kr 5" seems to imply. These currencies don't ever have a symbol before them, so it seems odd to place the "kr" before the number, like currencies which do have such a symbol.  dalahäst (let's talk!) 22:56, 14 June 2012 (UTC)[reply]

Limitation of the way it's programmed. Alternative use code SEK2 ie. "1,000 SEK". Green Cardamom (talk) 23:12, 14 June 2012 (UTC)[reply]

Fails to show UAH[edit]

Only the number is returned, no hyperlinks or currency at all. Please fix. Ukrained2012 (talk) 02:02, 10 September 2013 (UTC)[reply]

Currencies have to be listed in Template:Currency/Type and Template:Currency/LongType - I know nothing about it so will leave to someone who knows for this particular currency. The templates can be edited by anyone. -- Green Cardamom (talk) 03:47, 10 September 2013 (UTC)[reply]
 Fixed  Stepho  talk  05:33, 10 September 2013 (UTC)[reply]

"Teuro"[edit]

Re. this, I don't quite understand: why does it say "Teuro", and not "Euro"? It Is Me Here t / c 23:13, 7 March 2014 (UTC)[reply]

From wiktionary: 'Blend of teuer (“expensive”) and Euro (“euro”), first used by the German satire magazine Titanic in 1997'. So it is a made up, pejorative term invented when people thought the change from the German mark to the Euro would make everything more expensive. I will leave it in the list of currencies handled by the template but I will change the examples to use the ordinary euro.  Stepho  talk  23:45, 7 March 2014 (UTC)[reply]
I have removed "Eumeln", "Knaak", "Teuro" and "The Single Currency" from the list of supported parameters. At least Eumeln and Teuro were just kind of "jokes" in some German-speaking countries. There is no point to allow them as valid input into the template on Wikipedia source code level, in particular since the template will not display these strings, anyway. --Matthiaspaul (talk) 10:52, 6 February 2020 (UTC)[reply]
Thank you.  Stepho  talk  11:19, 6 February 2020 (UTC)[reply]

Ambiguity with Japanese Yen and Chinese Yuan[edit]

There is a discussion at Wikipedia talk:WikiProject Japan#Currency templates about how to disambiguation between "¥" for Japanese yen and "CN¥" for Chinese yuan. Please feel free to contribute on that page.  Stepho  talk  10:03, 12 October 2014 (UTC)[reply]

There is a follow-on discussion at Template talk:CNY#Ambiguity with Japanese Yen about whether the {{CNY}} template should display '¥100' or 'RMB 100'. Please feel free to discuss it there.  Stepho  talk  13:13, 2 December 2014 (UTC)[reply]

Possible changes[edit]

Possible changes

According to Wikipedia:Manual of Style (dates and numbers)#Currencies, the names of currencies should be not be capitalized unless they are the first words in the sentence. In the long form output "1,000 Euros" and "1,000 Renminbi", the currencies should probably be lowercase "euros" and "renminbi".

In Template:Currency/LongType

In Template:Currency/LongType

  • The list of synonyms for EUR has THE SINGLE CURRENCY|EGE|EUMELN|KNAAK|QUID|TEURO. I really doubt that any of these are being used on English Wikipedia. EUMELN is slang from one part of Austria, TEURO is an old German joke, EGE is Finnish, and I don't know what the others are. I guess there's not any harm in leaving them, but they do take cycles to process. QUID is reportedly Irish slang, but if this is going to included shouldn't it be included as the age-old slang for Pound Sterling, not for euros? I would rather delete all of these slang terms and add EUROS, in case anyone wants to enter that.
  • Could we add synonyms for YUAN and YEN?

There seems to be one bug in parameter parsing.

  • {{Currency|1000.00|eur}} OK
  • {{Currency|1000|eur|first=yes}} OK
  • {{Currency|Amount=1000|eur|first=yes}} Displays US$
  • {{Currency|Amount=1000|type=eur|first=yes}} OK
  • {{Currency|1000|type=eur|first=yes}} OK

– Margin1522 (talk) 16:49, 12 October 2014 (UTC)[reply]

@Margin1522: There is no one maintaining the template. If you see anything to change, go for it. I don't see anything wrong with your suggestions to change to lower case for Long format. Re: the bug I don't know. The template would ultimately be better converted to Lua. -- GreenC 12:50, 24 January 2015 (UTC)[reply]

Create module?[edit]

This template is getting popular. Transclusion count is 700+. Shall "Module:Currency" be created? --George Ho (talk) 10:01, 24 January 2015 (UTC)[reply]

A Lua module would be nice. -- GreenC 12:55, 24 January 2015 (UTC)[reply]
Um... I don't know how to create one. Can you do it? --George Ho (talk) 19:14, 24 January 2015 (UTC)[reply]
Yes I have created Lua Modules on Wikipedia. When I have some time for a new project I will keep this in mind. But this is not a promise so if someone else wants to. -- GreenC 22:09, 24 January 2015 (UTC)[reply]
I have been maintaining this template. I'm also a professional programmer. But I don't know how to do Lua modules on WP. Can you point me to any how-to essays to get me started?  Stepho  talk  00:04, 25 January 2015 (UTC)[reply]
Wikipedia:Lua :) Lots of docs and other template modules. This one is unique because of the databases, but there are other modules that use database files. -- GreenC 01:39, 25 January 2015 (UTC)[reply]
Ok, thanks. I'll see what I can come up with over the next few weeks.  Stepho  talk  22:32, 25 January 2015 (UTC)[reply]

Module:Currency pursuant to a conversation at WT:LUA. The module and its data Module:Currency/Presentation are incomplete but enough of it works that you can play around with it and suggest changes and improvements. The data module is especially in need of work and is something that can be done by anyone; no Lua expertise required.

{{currency/new}} is the template that calls the module.

Trappist the monk (talk) 12:46, 7 April 2016 (UTC)[reply]

Nice work! Lua is definitely the way to go here. We need testcase pages to compare the old and new to make sure they work for all currencies. There's a lot of detail in the data and a testcase makes it easy to see how it will render. -- GreenC 15:24, 7 April 2016 (UTC)[reply]
Template:Currency/new/testcases
Trappist the monk (talk) 19:13, 10 April 2016 (UTC)[reply]
Wow excellent. A lot of this I wouldn't know where to begin on what the correct format should be (spacing, symbol, location of symbol). With emphasis on "correct" since it's probably often a matter of opinion and custom depending on the source. -- GreenC 21:00, 10 April 2016 (UTC)[reply]
Nor do I. For what is there, I took clues from the currency's article.
I've just added |linked= which if set to no does not link the symbol or the currency name (if |first= is set).
Since it can always be reverted, I'm inclined to replace {{currency}} with {{currency/new}}.
Trappist the monk (talk) 22:06, 10 April 2016 (UTC)[reply]
Trappist the monk - The only issue with reverting is that is there is a severe backlinks database lag which means that when doing template reverts it can take weeks or even sometimes months for the original template to be restored in certain articles, unless there is null (or other) edit done on effected articles. See the last thread on this page to see what happened the last time this happened. A not-well-known problem but real (the more backlinks to the template, the worse the problem is). Also, do you think it would be a good idea to replace the red "currency – invalid code" with the given currency amount? It would be a more gentle way to fail, though wouldn't notify of trouble. Other than those thoughts it's looking pretty good. -- GreenC 16:33, 12 April 2016 (UTC)[reply]
I know all about the server lag. That's why I keep updates to Module:Citation/CS1 and its companion modules to about once a month. According to this, there are 950-ish transclusions of {{currency}}. If it becomes an issue, I can load the list of transcluded articles into AWB and do that many null edits relatively quickly.
Error messages are a funny thing. They are useful to those who pay attention to what it is that they are doing but are, astonishingly enough, often ignored by the very editors who did the wrong thing that made the error message in the first place – and this, even when the error message links to explanatory text. Still, I think it better to have an error message so that readers, who know nothing about what is going on under the bonnet, can see that there is something wrong; and that responsible editors can see and fix.
Trappist the monk (talk) 16:55, 12 April 2016 (UTC)[reply]

So, to move forward, I propose to do this:

  1. move Template:Currency without its talk page to Template:Currency/old; this creates a working archive of the template as it now exists
  2. create Template talk:Currency/old as a redirect to Template talk:Currency (this page); no need for two separate talk pages
  3. move Template:Currency/doc to Template:Currency/old/doc; this maintains the link between the old template and its documentation
  4. move Template:Currency/sandbox to Template:Currency/old/sandbox; this maintains the link between the old template and its sandbox
  5. move Template:Currency/new to Template:Currency over the redirect; this implements the module version of the template
  6. move Template:Currency/new/doc to Template:Currency/doc over the redirect; this maintains the link between the new template and its documentation

Subtemplates of what will become Template:Currency/old shall not be moved.

Trappist the monk (talk) 12:14, 17 April 2016 (UTC)[reply]

That looks good. Aslo Template:Currency/new/testcases. -- GreenC 13:38, 17 April 2016 (UTC)[reply]

Done. Report all oddities here.

Trappist the monk (talk) 15:12, 17 April 2016 (UTC)[reply]

Currency convert?[edit]

I'm wondering if it's possible to add to this template (or create a new template with the function) the possibility to convert currencies, like Template:convert for measurement units. This would be very useful as it is sometimes difficult to understand articles citing local currencies. There could be a database with conversions from several currencies to the most common ones such as EUR or USD, updated at regular intervals. This would also solve the problem of fluctuating exchange rates which sometimes make articles outdated. --Ita140188 (talk) 08:01, 10 November 2015 (UTC)[reply]

That would be nice to have but there are a number of problems to watch out for.
  1. The WP servers would need to periodically get the latest currency exchange rates from an external source. This would have to be automatic so that it doesn't just stop when somebody stops doing it.
  2. Articles need to say whether the exchange rate was valid at the historical time, editing time or current time. Ie, the rate at the time that the event happened (eg 1776), the time it was put into the article (eg 2013), or now. This is true of manual conversions but especially true of automatic conversions.
  3. Conversions between common currencies are easy (eg British pounds to US dollars) but conversion between less common currencies may require double conversions. Eg, Converting South African Rands to Mexican Pesos may require converting to US dollars in the middle.
I'm all for putting this one in the too hard basket.  Stepho  talk  09:35, 10 November 2015 (UTC)[reply]
Everything you say is correct, Stepho. I actually know how to do it, and it would be pretty darn useful, but it would also be a lot of work to setup and probably maintain. Basically there would need to be two scripts and new entries at Wikidata. One script on Tools would run via cron, scrape currency conversion rates from the web somewhere and then upload those to Wikidata. Then convert this script to Lua, and have it download the conversion info from Wikidata and render into the article. That's one method that would work, in broad outline. It would only work for current conversion rates. -- GreenC 14:54, 10 November 2015 (UTC)[reply]
The major problem is that once started, for this to be useful it must remain updated regularly ad infinitum or articles will also fall out of date, and at worse these conversions become actively detrimental. Long-term editors know that tools have a habit of coming and going based on the activity of their authors. I feel like this is one of those perennial requests that should be closed as "not going to happen". Huntster (t @ c) 04:54, 11 November 2015 (UTC)[reply]

Position of currency symbol[edit]

Unless I am mistaken (in which case the doc could make it clearer; I've looked at the template source) this template only allows for currency values where the symbol is prefixed, rather than suffixed. For example {{currency|1234|HUF}} (Hungarian Forint) givesgave:

Ft1,234

Whereas it should be written:

1,234 Ft

I think we need more metadata subtemplates to make it easier to control the spacing of currency symbols and their position (for example, the space between "1,234" and "Ft" above. I'd be inclined to add a parameter to the main template, pos= which can take values "first", "sep" (or "dp" or "middle", i.e. in place of the decimal point) and "last". If absent, it should default to the value in a lookup template (Template:currency/Position, say), arranged similarly to the one for Template:Currency/Type.

Although of course most transclusions would use the default, this should be able to be overridden. For example, the euro symbol varies its position (and spacing) from country to country, largely depending on how national currencies were written before its introduction. (€15.49 vs. 15.49€ vs. 15€49). While in English Wikipedia we might follow one style, that can sometimes become incongrous when articles are heavily oriented to one country.

I'm quite happy to create the "position" lookup template (later, my wife is dragging me shopping...) but should like to hear of others' views; I think I'll create it then we can play with variations in (a draft/sandbox of) the daddy template. Si Trew (talk) 07:40, 29 November 2015 (UTC)[reply]

I guess the question which you raise is how it appears in most English-language sources, or how it's done within the country itself, and is there a difference. -- GreenC 14:03, 29 November 2015 (UTC)[reply]

Yes and no. MOS:CURRENCY says "Do not place a currency symbol after the accompanying numeric figures (e.g. 123$, 123£, 123€) unless that is the normal convention for that currency when writing in English". That sentence is followed by a {{clarification needed}} tag, but there's nothing on the talk about it. For Hungarian forints, which is the particular use I wanted, "Ft" always appears (spaced) after the amount in English and in Hungarian. This is the case for other currencies too such as "DM" (Deutsche mark), I think: in no way are Hungarian forints some unique exception.
Unfortunately our article Currency symbol is silent on the matter (it would be nice to have a column in the list at that article, for reference); but implies that e.g. "Ft" is considered a symbol, not just an abbreviation, so we don't have to worry about that distinction. ISO 4217#Position of ISO 4217 code in amounts says that within the EU the position of the symbol should be written depending on the native language of the document (not the currency); however, Wikipedia is not the European Union, and sometimes it would make sense to follow the form used in the source document.
At the very least we need to enhance the template to add the (non-breaking) space between alphabetic symbols and the corresponding number. Rather than make another lookup table, perhaps we could do this somehow by examining the last character of the symbol and seeing if it is alphabetic, if so, inject a space. I'll see if I can knock up a template that does that (and then no doubt find we have one already, which is usually what happens...).
I'm not trying to make this template more complicated! Rather more correct while not requiring onerous additions of parameters by editors for the default/normal case for a given currency. Si Trew (talk) 08:10, 30 November 2015 (UTC)[reply]
It would be nice, too, if we could pass through the literal value of the currency parameter ("HUF"), "GBP" etc. as (piped) text. I think that's probably deprecated in running text but can't find that it is. That's easy to do and, again, it may be the case that it makes sense sometimes to want "3,500 GBP" instead of "GBP 3,500" (and "for these we always need the  ). Again, we can just add a iso=y or something to do this generically. You may ask what is the point instead of just writing it in the article longhand, and you would be kinda right, except it still automatically adds the link to the article about the currency (i.e. it implies first=yes). Si Trew (talk) 08:23, 30 November 2015 (UTC)[reply]
We don't seem to be able to crack the last character (without Lua, which seems overkill), so I'm making the lookup table at Template:Currency/Position, at the moment I am setting them all to "bs" (before, spaced) or "b" (before, unspaced). A few (I'm copying it from Template:Currency/Type such as LE (Egyptian pound) already include a space (but not a no-breaking space); others have a non-breaking space after the piped link: Once tested, I'll remove those from Template:Currency/Type because my intent is that the Template:Currency/Space will do the actual spacing using this lookup. At the moment, those that end in fullstops (periods) I am assuming need a space.Si Trew (talk) 08:54, 30 November 2015 (UTC)[reply]

There's also I think an oddity in that in Type, PESETA and PIASSE produce Canadian dollars. Si Trew (talk) 08:59, 30 November 2015 (UTC)[reply]

Well, I was a bit WP:BOLD and with [1] I've changed the daddy template to use Template:Currency/Position (for whether the symbol should be fore or aft) and Template:Currency/Format (to splice a symbol + amount appropriately). All seems to work. There's two edits to Template:Currency but both work; the second is just a bit nicer in that it saves an #if switch. No behaviour is changed (as far as I know) except that:
  • for HUF it is placed after (:Template:Currency/Position returns "as" for "after, with [no-breaking] space
  • for other currencies, I've taken the coded space (in pipes) or   (outside of the pipe) out of Template:Currency/Type and essentially coded that information into Template:Currency/Position.
  • We might want better names for these. As far as I am aware, unless I have introduced any bugs, all should work as before with the exception that spaces are now no-breaking spaces (that should make little differences as Format puts it in a {{nowrap}}) and HUF is displayed after the currency: my original motive but also acts as a test case:
{{currency|1234.56|HUF}}
now gives:
Ft 1,234.56
Which I believe is nearer real life, but if we decide that even for HUF they should by default be before the amount, that's easily changed in the template. @Green Cardamom: have you any comments? Si Trew (talk) 11:28, 30 November 2015 (UTC)[reply]
I should appreciate any comments. Si Trew (talk) 11:32, 30 November 2015 (UTC)[reply]

If not already, can setup a sandbox + testcases page with 10 or 20 different currency examples using the option switches? Good idea anyway to make sure it works with all possibilities before rolling out. Here's an example testcases page that uses the {{testcase}} template etc. -- GreenC 15:30, 30 November 2015 (UTC)[reply]

I've kinda already done that by putting test cases into the documentation. Can you give me some examples on where it's failing? Articles, for example. Each subtemplate has doc which seems to work... I'm sorry about this, but it's kinda an unavoidable integration problem, I tested each of the subtemplates individually with what I thought were a reasonable set of examples. As it stands I don't know where it is "failing"; I did all the subtemplates before I merged them into the existing "public" templates, so no problem with reverting those and leaving the subtemplates stand while I work it out, but failure cases would be very helpful. Si Trew (talk) 15:58, 30 November 2015 (UTC)[reply]
A testcases page will show failure points. If not, keep adding testcases :) There's a log somewhere where transclusion errors are reported so they will show up there, ask Wbm1058. But it's still useful to have a testcases + sandbox page, not only for yourself but other editors to monitor and add their own testcases when working on new code. -- GreenC 16:04, 30 November 2015 (UTC)[reply]

SimonTrew, still generating transclusion errors. They are visible on this talk page for one, with NOK2. Recommend setup a sandbox and testcases page so that we can see the problem, instead of having to make it live in order to see the problem and then revert etc.. -- GreenC 16:10, 30 November 2015 (UTC)[reply]

Oh I agree, I created the template documentation partly to serve as testcases until I got around to doing it more fully. At some point one has to bite the bullet and reintegrate it. And it was all going so smoothly....
@Green Cardamom: I think partly the manifestation is because in one place it deliberately uses {{error}} when the input parameter for currency is unknown. I can try to set up a sandbox but in the meantime I have added some more examples. Thanks for your good faith here as my ultimate aim is to get all the info into one table rather than having the various templates all listing different switch statements; I think part of the problem is that cases have been added to e.g. Type and not LongType. I thought that NOK was broken on purpose because of what it says, that it's ambiguous. Si Trew (talk) 16:21, 30 November 2015 (UTC)[reply]
I'm going to have a little rest as I have been hammering at this for quite a few hours, I'll come back to it after a breather. Thanks for your help and good faith (and User:Wbm1058 too). At least the subtemplates are kinda documented and serve kinda one purpose each now rather than several as a separation of concerns; sorry for the integration problems. Si Trew (talk) 16:42, 30 November 2015 (UTC)[reply]

Wikipedia database update lag causing transclusion errors[edit]

@SimonTrew: See List of the world's richest literary prizes. Note the red transclusion errors being generated by the currency template. This is because there is a lag in the Wikipedia transclusion updates due to server load (it can take days to clear). The template is being rendered according to the new version (the one you made), even though it's been reverted back to the old version. The only way to fix is a null edit on the article. I expect there are others with the same problem, showing the red errors, the template has 867 transclusions. I think the sooner we can get it to the final state the better. So far it looks like problems with type UK, CAD, NOK and NOK2.. are those exceptions or should every country be tested? -- GreenC 05:00, 1 December 2015 (UTC)[reply]


@SimonTrew:, I wrote a script to search the 801 mainspace articles which are using {{currency}} to find which ones still had red transclusion errors (due to the transclusion database lag still using the version of the template you wrote). I then issued a WP:NULLEDIT to clear the error, and log which articles per below. This took about 2 hours to write, debug and run. I hope this list of articles and currency types which are causing errors are useful to you in debugging what the problem was. -- GreenC 16:35, 2 December 2015 (UTC)[reply]

To avoid this problem again, I have created a new template {{CurrencyTest}} and its helpers {{CurrencyTest/Type}} and {{CurrencyTest/LongType}}. Please experiment with this new template. When it is operating correctly then I will apply the changes to the original templates and delete the Test templates.  Stepho  talk  08:47, 3 December 2015 (UTC)[reply]

Errors[edit]

The new version of the template has broken a large number of instances of the template where there's anything other than a plain number without commas provided. (I fixed one at South Korean legislative election, 2016, just came across more at JYJ, and there's more on this page and the template documentation.) While it's possible to go through and fix all of these, is there no way to make the template function with numbers written with commas ("15,000,000") or in text ("15 million") ? I would also prefer to use 15 million rather than 15,000,000 at the election page, but this doesn't seem possible at the moment, or at least it's not documented. Paging Trappist the monk. —Nizolan (talk) 15:28, 19 April 2016 (UTC)[reply]

The documentation at Template:Currency/old/doc proscribes commas in the |<amount> parameter. I suspect that this is because the magic word {{formatnum:}} used by {{currency/old}} doesn't play well with commas in what is supposed to be an 'unformated' number. For example,
{{formatnum:10,00}} → 10,00 so:
{{currency/old|10,00}}{{currency/old|10,00}}
The new version of {{currency}} simply enforces the rule that was already in place:
{{currency|10,00}}{{currency}} – invalid amount (help)
The text version, 15 billion, is not a documented feature of {{currency/old}} so is not supported by {{currency}}. The question then is, what is the list of appropriate 'words' that can follow the number in the |<amount> parameter?
thousand, million, billion, trillion. What others? Is there a similar list of words that can appear before the number?
{{formatnum:rabbits 10000 rabbits}} → rabbits 10,000 rabbits – doesn't care; should {{currency}} similarly not care?
Should I turn off the no-comma checker? What about when the formatted number is clearly wrong (10,00)?
Trappist the monk (talk) 16:03, 19 April 2016 (UTC)[reply]
The original template treated the "number" as just text - it didn't try to interpret the number in any way. So we could use it for US$10 million, AUD 1.5 trillion or 10 baht with no trouble. Commas can be stripped out with a bit of string manipulation. Thousand/million/billion/trillion is harder but not impossible. Is there a LUA function or a template which takes text numbers (including million/etc) and converts them into pure numbers - eg takes "1.23 million" and converts to 1230000 or 1.23×1000000 or 1.23e6 ?  Stepho  talk  01:24, 20 April 2016 (UTC)[reply]

From an editor perspective, it's hard to read templates like this {{currency|10000000|NK}} Is it 1, 10 or 100 million? Easy to make a mistake. That's why commas for numbers were invented along with paragraph breaks, periods and other punctuation (the Romans had none). Less work for editors if it displayed with commas, if it's not too much programming work. The expanded word version should be an optional switch. For malformed numbers (10,00) it should give an error since the program can't determine if that should be 1000 or 10,000 or 10.00 -- GreenC 03:05, 20 April 2016 (UTC)[reply]

I spent half an hour at lunchtime teaching myself the basics of LUA and created ConvertStringToNumeric as a LUA module and a wrapper template to convert such things as 'million/billion/etc'

  • '1000' → {{ConvertStringToNumeric|1000}}
  • '10 million' → {{ConvertStringToNumeric|10 million}}
  • '10 billion' → {{ConvertStringToNumeric|10 billion}}
  • '1.23 million' using #expr → {{#expr:{{ConvertStringToNumeric|1.23 million}}}}
  • {{currency|{{#expr:{{ConvertStringToNumeric|1.23 million}}}}|SGD}}{{currency}} – invalid amount (help)

Sadly, my knowledge of LUA is still at the beginner stage and I don't know how to make the existing LUA currency module call ConvertStringToNumeric .  Stepho  talk 

I will be away for most of the day so won't be able attend to this until tomorrow. This works but there is the issue of symbol position:
{{currency|1.23|SGD}} million
S$1.23 million
but:
{{currency|1.23|PLN}} million
 1.23 million
When written out like this, is the symbol after the digits correct or do we need to override the normal positioning for this case?
Trappist the monk (talk) 09:29, 20 April 2016 (UTC)[reply]
I'm pretty sure that '1.23zł million' is wrong, it should be '1.23 million zł'. Which means that 'million' must be handled within the template or the LUA code.
I think these examples are working correctly:
  • {{currency|{{#expr:{{ConvertStringToNumeric|1.23 million}}}}|SGD}}{{currency|{{#expr:{{ConvertStringToNumeric|1.23 million}}}}|SGD}}
  • {{currency|{{#expr:{{ConvertStringToNumeric|1.23}}}}|SGD}}{{currency|{{#expr:{{ConvertStringToNumeric|1.23}}}}|SGD}}
  • {{currency|{{#expr:{{ConvertStringToNumeric|1.23 million}}}}|cve}}{{currency|{{#expr:{{ConvertStringToNumeric|1.23 million}}}}|cve}}
  • {{currency|{{#expr:{{ConvertStringToNumeric|1.23}}}}|cve}}{{currency|{{#expr:{{ConvertStringToNumeric|1.23}}}}|cve}}
  • {{currency|{{#expr:{{ConvertStringToNumeric|1.23 million}}}}|PLN}}{{currency|{{#expr:{{ConvertStringToNumeric|1.23 million}}}}|PLN}}
  • {{currency|{{#expr:{{ConvertStringToNumeric|1.23}}}}|PLN}}{{currency|{{#expr:{{ConvertStringToNumeric|1.23}}}}|PLN}}
If we agree that the above is correct (or at least better than it is currently), then I can copy the ConvertStringToNumeric LUA code into the Currency LUA code. I'd like to fix this ASAP. But with a bit more work I'm sure I can get it to display 'million'/etc in the output if it is present in the input.  Stepho  talk  01:29, 21 April 2016 (UTC)[reply]
I'm not sure about this. If |amount= has a quantifier (is that the right term?) should that not remain as part of the rendered output? The quantifiers are often used to make large numbers more readable, right? Why then would we want to convert a readable form into one that is arguably more difficult to read, even when that converted form is properly formatted?
If someone writes:
{{currency|1000 million|gbp}}
then shouldn't the output be:
£1,000 million
I can imagine the utility of converting such amounts to £1 billion but not to £1,000,000,000
And what is the correct placement of a symbol relative to an amount that uses a quantifier? When the symbol precedes the numeric portion the answer is obvious. But, when the symbol normally follows digits or replaces a decimal point, where should the template place the symbol?
1.23zł million or 1.23 million zł or zł1.23 million?
1.23 $ million or 1.23 million $ or 1$23 million or $1.23 million (cve is the only currency that replaces the decimal with the symbol)
Or, do we abandon symbols and use the ISO 4217 code as a prefix of the numeric portion:
GBP1.23 million
CVE1.23 million
Trappist the monk (talk) 14:45, 21 April 2016 (UTC)[reply]

I have created {{currency/sandbox}} and Module:Currency/sandbox. To the latter I have added code that allows the module to accept properly formatted, comma-separated numbers in the template's |amount= parameter:

{{currency/sandbox |1000}} – no commas
US$1,000
{{currency/sandbox |1000.00}} – no commas
US$1,000
{{currency/sandbox |1,000,000,000}} – properly placed commas
US$1,000,000,000
{{currency/sandbox |1,000,000,000.01}} – properly placed commas
US$1,000,000,000.01
{{currency/sandbox |$1,000,000,000}} – extra text
{{currency}} – invalid amount (help)
{{currency/sandbox |,1000}} – misplaced comma
{{currency}} – invalid amount (help)
{{currency/sandbox |1000,}} – misplaced comma
{{currency}} – invalid amount (help)
{{currency/sandbox |1000,.00}} – misplaced comma
{{currency}} – invalid amount (help)
{{currency/sandbox |10,00}} – misplaced comma or missing digit
{{currency}} – invalid amount (help)
{{currency/sandbox |1000,000,000}} – missing comma
{{currency}} – invalid amount (help)

Trappist the monk (talk) 13:07, 21 April 2016 (UTC)[reply]

The problem is that we have existing uses of 'currency' that are broken today. There are plenty of uses that already have the word 'million' and it displays an absolutely awful red message. Some editors are converting them to pure numbers and some are simply removing the use of 'currency' and replacing them with plain text. My proposal for a quick fix is to accept inputs with 'million'/etc, convert it to a number and display appropriately. Otherwise editors will remove uses of 'currency'. The long term fix is like what you want ('million' in the input will also have 'million' in the output) but that will take a bit longer. So this will be a 2 stage process. I might be able to put an output filter on it that converts big numbers into 'million'/etc if it detects it in the input.
For currencies with the sign as the decimal point, I believe it should format as '1,230,000$00', '123$', '1.23 million$', '1$23'. Ie, at the end except when there are cents/subunits involved and always after 'million'/etc (because 'million'/etc implies there are no cents/subunits).  Stepho  talk  23:32, 21 April 2016 (UTC)[reply]
Sandbox:
{{currency/sandbox |1.23 thousand}}
US$1,230
{{currency/sandbox |1.23 million}}
US$1,230,000
{{currency/sandbox |1.23 BILLION}}
US$1,230,000,000
{{currency/sandbox |1.23trillion}}
US$1,230,000,000,000
{{currency/sandbox |1.23 rabbits}}
{{currency}} – invalid amount (help)
Trappist the monk (talk) 00:26, 22 April 2016 (UTC)[reply]

Looks good! I've never heard of money spoken of in quadrillions (or rabbits). -- GreenC 00:41, 22 April 2016 (UTC)[reply]

(actually the world's derivative market is estimated at 1.2 quadrillion dollars). -- GreenC 02:38, 26 April 2016 (UTC)[reply]
Excellent. Nice use of regexp in convert_string_to_numeric(). Can you copy that into the live module so that articles stop throwing errors?
I have an idea for formatting the output. We could modify convert_string_to_numeric() to return a second value that shows whether quantifiers[] was triggered. We can then use that value in make_short_form_name() and make_long_form_name() as a flag to say whether to convert to 'million'/etc style output. Something along the line of if the last 4 digits are '0' then divide by 1,000,000 and add ' million' to the output string. Similar for last 7 becomes 'billion, etc. But only if it saw the keywords in the input. Care will need to be taken for currency signs at the end or as the decimal separator but we can manage that.  Stepho  talk  03:52, 22 April 2016 (UTC)[reply]

Error when value is less than 1[edit]

Hi

I'm trying to add this template to text in the article for Phase-out of lightweight plastic bags, I would like to use it where it says '5 pence' but I get an error, I think it is because I'm trying to use a value less than one (0.05).

Thanks

--John Cummings (talk) 16:05, 29 August 2017 (UTC)[reply]

Always it is helpful to provide an example that shows what it is that you are talking about. Kitsel the mind reading cat died so I need your help.
Trappist the monk (talk) 16:14, 29 August 2017 (UTC)[reply]
{{currency|0.05|GBP}} gives £0.05, which is correct. {{currency|0.05|pence}} gives an error because pence is not in the list of currencies.  Stepho  talk  23:09, 29 August 2017 (UTC)[reply]
Thanks very much Stepho-wrs. --John Cummings (talk) 20:23, 4 September 2017 (UTC)[reply]
You're welcome.  Stepho  talk  21:15, 4 September 2017 (UTC)[reply]

Support for formatting numbers with gaps as per MOS:DIGITS?[edit]

Is there any way currency formats numbers with gaps as per MOS:DIGITS? For example, to work in harmony with template:val? Betterkeks (talk) 01:15, 20 July 2018 (UTC)[reply]

I have tweaked the module sandbox to use |fmt= where values assigned to that parameter are the same as at {{val}} with slightly different meanings. At {{currency}}, the default grouping separator is the comma, at {{val}}, the default grouping separator is a gap.
{{currency/sandbox|1234567|euro}}|fmt= omitted
1,234,567
{{currency/sandbox|1234567|euro|fmt=}}|fmt= present but empty
1,234,567
{{currency/sandbox|1234567|euro|fmt=bob}}|fmt=bob is nonsense value
{{currency}} – invalid format (help)
{{currency/sandbox|1234567|euro|fmt=commas}}|fmt=commas included for completeness; does nothing
1,234,567
{{currency/sandbox|1234567|euro|fmt=gaps}}|fmt=gaps replaces default comma grouping separators with narrow gaps
1234567
{{currency/sandbox|1234567|euro|fmt=none}}|fmt=none removes default comma grouping separators
1234567
Test this with a variety of real values and different currencies. Report problems here. If the results are acceptable, I will update the module and template.
Trappist the monk (talk) 11:21, 20 July 2018 (UTC)[reply]
@Trappist the monk: Nice, it works. Thank you! Betterkeks (talk) 11:39, 6 August 2018 (UTC)[reply]

MOS:CURRENCY[edit]

If I understand MOS:CURRENCY correctly, the “first mention of a particular currency should use its full, unambiguous signifier (e.g. A$52), with subsequent references using just the appropriate symbol (e.g. $88), unless this would be unclear”. Is there any way to make your template do this? Betterkeks (talk) 11:48, 6 August 2018 (UTC)[reply]

Probably easiest to create entries in the non-standard table else some sort of new parameter and its supporting code would be required. Given your example, you might add:
['AUD2'] = {page = 'Australian dollar', plural = 's', position = 'b', symbol = '$'},
I suspect that only currencies that use a signifier that is a combination of letters and a symbol would be suitable for this treatment.
Trappist the monk (talk) 13:08, 6 August 2018 (UTC)[reply]

Abstracting into scale[edit]

Is there any way to tell your template to output scale (for example, AU$100 million), where million, billion and so on are “spelled out on first use, and (optionally) abbreviated M or bn (both unspaced) thereafter” as per MOS:CURRENCY? Betterkeks (talk) 11:53, 6 August 2018 (UTC)[reply]

I guess I'm trying to figure out just why this feature would be necessary. For your example, one could write:
{{currency|100|aud}} millionA$100 million
or
{{currency|100|aud|linked=no}}M → A$100M
so where is the need?
If it is 'required', I suppose that we could co-opt |fmt= to add a quantifier:
{{currency|100|aud|fmt=M}}A$100 million
{{currency|100|aud|fmt=m}}A$100M
{{currency|100|aud|fmt=B}}A$100 billion
{{currency|100|aud|fmt=b}}A$100bn
and if we do those two then perhaps we should:
{{currency|100|aud|fmt=K}}A$100 thousand
{{currency|100|aud|fmt=k}}A$100k – probably not this one
{{currency|100|aud|fmt=T}}A$100 trillion
{{currency|100|aud|fmt=t}}A$100tr – is this a correct abbreviation?
Still, where is the need?
Trappist the monk (talk) 13:57, 6 August 2018 (UTC)[reply]
@Trappist the monk: For maintainability it would be better for the template to spell out the first use of million, billion and so on, abbreviating subsequent use. Not sure if it’s possible, but subsequent edits would be safer than manually writing it. Also, template could then make spacing consistent, and avoid A$123M and A$45 M. Have a look at how convert does it: {{convert|{{#expr: (2592300 / 10^6) round 2 }}|e6t|e9lb|abbr=off}} for “2.59 million tonnes (5.7 billion pounds)”.
Betterkeks (talk) 17:42, 29 August 2018 (UTC)[reply]
If you are thinking that this template should know when it is in first-use position and so render differently from subsequent uses, that will not happen. No template has any awareness of anything that exists outside of its bounding {{ and }} markup; it would be nice, but, alas, not possible. This is why I suggested co-opting |fmt=; so that editors can specify how the template renders. There is some merit in your spacing argument. I guess I don't think that we should use e6 and e9 for template parameter values or use exponential notation in template renderings unless they are in common use in articles that would use this template.
Trappist the monk (talk) 00:27, 30 August 2018 (UTC)[reply]
The reason I need this feature is that the input number will be determined by another template, because {{Currency}} is used to format the output after a currency conversion. So I will not know whether the resulting conversion will be $12.1 billion, $1.21 million or $121. Right now, I am trying to solve this problem using a separate template I have created for this purpose, {{INRConvert/Wordify}}, but it would be very helpful if the Currency template had this feature built-in. --Joshua Issac (talk) 21:03, 10 November 2019 (UTC)[reply]
I think I see where you are coming from but I am highly skeptical of currency exchange templates because currency exchange values change on a daily basis. The value used today could be radically different to the value in a few weeks. Do you keep track of at least monthly exchange rates between the Indian Rupee and all major currencies? Will these exchange values be maintained every month for the future? Which currencies will be maintained? If I tell it today about a Rupee figure in August 2017, will it use today's exchange rate or the exchange rate in August 2017? WIll it try to convert it to a USD value for August 2017 or try to adjust it for inflation into a USD value for today. This is a considerably complex topic that is also likely to require maintenance on at least a monthly basis.  Stepho  talk  22:23, 10 November 2019 (UTC)[reply]
@Trappist the monk, Betterkeks, Joshua Issac, and Stepho-wrs: Did this ever go anywhere? I could use it as well. I'm being fed a dollar amount in the billions from another template and I'd like to format it nicely as e.g. $4.7 billion, rather than having it display as $4,712,345,678. This situation doesn't seem all that unusual; I'm surprised that this isn't already coded somewhere (or maybe I'm just missing it, in which case the documentation needs improvement (or I'm just being dumb)). {{u|Sdkb}}talk 22:07, 14 July 2020 (UTC)[reply]
Moribund discussions rarely result in anything except that they occupy space. As I see it, there are at least two problems for which a solution is sought. The definitions of those problems (the gozintas and the gozoutas) seem to me to be a bit vague.
Trappist the monk (talk) 22:33, 14 July 2020 (UTC)[reply]

Icelandic króna: Íkr?[edit]

Why does {{currency|6,000,000|ISK}} return IKr 6,000,000? I've never in my life seen "Íkr" used. The English currency abbreviation is ISK. In Icelandic, the abbreviation is "kr". I guess you might write "Íkr" if you were writing, in Icelandic, abbreviations of many different types of krónur in the same place - e.g. listing some prices in "Íkr", others in "Dkr", others in "Nkr", etc. But that's anything but common. -- Rei (talk) 08:54, 14 August 2019 (UTC)[reply]

Íkr was added to Module:Currency/Presentation with this edit. At the time, Icelandic króna listed Íkr as a symbol in the infobox. I suspect, memory has faded, that I did that, as you suggest, to distinguish it from various other kr.
Trappist the monk (talk) 11:28, 14 August 2019 (UTC)[reply]
I have asked at Wikipedia_talk:WikiProject_Iceland#Icelandic_króna:_Íkr? what symbol they would like.  Stepho  talk  06:13, 17 August 2019 (UTC)[reply]
I've changed it to ISK, being the common standard in English. – Thjarkur (talk) 12:27, 17 August 2019 (UTC)[reply]
No other Icelanders have voiced an opinion, so I thank you for your changes.  Stepho  talk  00:57, 18 August 2019 (UTC)[reply]

Historic currency support[edit]

Hi, is it intentional that this template doesn't support any historic currencies, even ones that do have ISO 4217 codes?

If it is, then this should probably be noted in the documentation, as it's nowhere there currently.

If not, well, the Spanish peseta with code ESP doesn't work :)

Cheers, Naypta ☺ | ✉ talk page | 22:13, 2 May 2020 (UTC)[reply]

We normally don't add something until there is a need. Helps to keep things manageable.
I have added ESP. {{currency|1000|ESP}} displays as 1,000 Pts
'Pts' is displayed as a single Unicode character. I am hoping that most people have that character in their computer's fonts.  Stepho  talk  00:06, 3 May 2020 (UTC)[reply]
A similar request, as it is much needed in historical referencing - the euro is still rather recent - could the Irish pound, ISO 4217 IEP, be added? The symbol was the same pound sign as used for the pound sterling. Given the reach of Wikipedia in history, I would suggest to seriously consider to have at least the defunct currencies with ISO codes on the list. Many thanks for a very useful template. SeoR (talk) 08:41, 23 April 2021 (UTC)[reply]
Done. {{currency|1000|IEP}} gives £1,000  Stepho  talk  23:25, 23 April 2021 (UTC)[reply]

Non-alphabetic ‘₨’ sign for PKR[edit]

The currency template for Pakistani Rupee uses the alphabetic symbol ‘Rs’. It would be more appropriate if the character was used. The space between the currency sign and the amount should also then be absent. Idell (talk) 11:24, 4 June 2020 (UTC)[reply]

{{currency|100|PKR}} now gives PRs. 100.  Stepho  talk  13:26, 4 June 2020 (UTC)[reply]
Ah thank you Idell (talk) 13:30, 4 June 2020 (UTC)[reply]
@Stepho-wrs: Referring to your edit to the template parameters of PKR upon my request, please note that you also changed its plural form parameter. However, I’ve since changed it back to the correct value. Idell (talk) 17:11, 5 June 2020 (UTC)[reply]
Thank you for correcting my mistake.  Stepho  talk  20:56, 5 June 2020 (UTC)[reply]

"Template:Currency/new" listed at Redirects for discussion[edit]

An editor has identified a potential problem with the redirect Template:Currency/new and has thus listed it for discussion. This discussion will occur at Wikipedia:Redirects for discussion/Log/2022 January 7#Template:Currency/new until a consensus is reached, and readers of this page are welcome to contribute to the discussion. Gonnym (talk) 11:33, 7 January 2022 (UTC)[reply]

Sterling[edit]

I find it unusual and disheartening that the abbreviation "STG" for sterling is not supported by this template's list of ISO code aliases, even though "RMB" and even "US$" are supported and unlike many ISO codes "GBP" is not even an accurate abbreviation of the currency's name. Could this be rectified please?

I would like to propose the following additional parameters, not necessarily replacing any existing ones, which I consider inappropriate for many applications, particularly for historical references from before the ISO standard even existed.

{{currency|1,000|STG}} Producing:

STG 1,000

and:

{{currency|1,000|STERLING}}

Producing:

£stg.1,000

TheCurrencyGuy (talk) 13:41, 12 June 2022 (UTC)[reply]

{{currency|1,000|STERLING}}£1,000
{{currency|1,000|STG}}£1,000
Trappist the monk (talk) 14:32, 12 June 2022 (UTC)[reply]
The financial industry often uses the 3 letter ISO 4217 code GBP but this confuses normal people. Normal people use just £. But it's also common in the industry to disambiguate common symbols by using the ISO 3166 country code (GB) and the symbol £. In this case, we are disambiguating against currencies like the Egyptian pound. I'm not dead set against simplifying GB pound to just £ but we do need to be aware of the other currencies sharing the same symbol - see Pound (currency) and Pound sign. Using 'STERLING' or 'STG' as a parameter for the template is okay (as Trappist as just added) but definitely should not be displayed like that as they are no longer in common use and will definitely confuse people from other countries.  Stepho  talk  23:20, 12 June 2022 (UTC)[reply]
"£ [...] stg" (with the numerals between the notation, which I'm uncertain how to code, I'm sure its possible as the inverse is possible: the one for the Cape Verdean escudo places the currency sign within the numerals) is more widely recognised and used (by style guides and the like) than "GB£", which is completely non-standard and we have not been able to find any reliable source use to even mention it in the sterling article. Provided the parameter links to the sterling article it will not be any more confusing than any other abbreviation (or even an unfamiliar ISO code) on Wikipedia, a simple hover over the link will bring up the introduction of the article.
£1,000 stg
I would like to suggest using this as an option in the GBP template for when disambiguation is necessary, with the option of using either the links (for first use) or not, but using an unqualified pound sign unless the option is chosen. TheCurrencyGuy (talk) 03:53, 26 June 2022 (UTC)[reply]
Does anyone know how I can experiment with coding this? I would be very interested to make it a proposal. TheCurrencyGuy (talk) 00:33, 1 July 2022 (UTC)[reply]
That's what sandboxen are for. This template is implemented by Module:Currency which depends on Module:Currency/Presentation. Be sure to sync Module:Currency/sandbox from Module:Currency and you should create Module:Currency/Presentation/sandbox and then modify Module:Currency/sandbox to use Module:Currency/Presentation/sandbox. Also, update {{currency/sandbox}} from {{currency}} and make sure that {{currency/sandbox}} invokes Module:Currency/sandbox. Use Template:Currency/testcases to see if your updated sandboxen template and modules are working. When everything is working as it should, then you can do your experiments.
Trappist the monk (talk) 14:05, 1 July 2022 (UTC)[reply]
I'm afraid I'm not very good at coding, I worked out how the standard Wikipedia coding works through trial and error, but this is a bit over my head. I've absolutely no idea where to start. TheCurrencyGuy (talk) 21:09, 1 July 2022 (UTC)[reply]
I can do the coding part. I can do that after the discussion has determined what we want to display.
This discussion in multiple places is awkward. Can we agree to keep the discussion in a central place at Template talk:GBP. Once we know what we want to display, then I will alter both templates to match.  Stepho  talk  23:25, 1 July 2022 (UTC)[reply]

Portuguese escudo[edit]

Would it be possible for someone to add a modified version of the Cape Verde escudo code for use with the Portuguese escudo which used the same notation ($ in place of the decimal point), thanks. TheCurrencyGuy (talk) 19:07, 5 July 2022 (UTC)[reply]

South African rand needs a space?[edit]

Reading the Manual of Style for MOS:CURRENCY, I think there is an issue with how the South African rand (code ZAR) is displayed. Because the currency abbreviation is entirely alphabetic and contains no numeric characters, shouldn't it have a space between the currency abbreviation R and the amount of currency as per the MOS? If so, there is a typo on the MOS:CURRENCY page. Please correct me if I'm wrong, as I don't have much experience working with templates. Somers-all-the-time (talk) 12:14, 3 August 2022 (UTC)[reply]

{{currency|500|ZAR}}R 500
Trappist the monk (talk) 12:53, 3 August 2022 (UTC)[reply]
Now that looks better. Was there actually something wrong that was fixed? Or, did my eyes play a trick on me while I was reading MOS:CURRENCY and I didn't see the space earlier? Somers-all-the-time (talk) 19:17, 3 August 2022 (UTC)[reply]
Special:Diff/1102117449
Trappist the monk (talk) 21:54, 3 August 2022 (UTC)[reply]

Suggestions for a standard set of options for each template[edit]

Many of the templates have only limited sets of options, so I would like to propose a basic standard for them (each currency could of course have its coding tailored to its own peculiarities). I have already prepared a possible set for each current template.

ANY CURRENCY

Basic use

{{XXX}} produces ¤ (simple currency sign)

{{XXX|123.45}} produces ¤123.45

Basic w/link

{{XXX|link=yes}} produces ¤ (simple currency article link)

{{XXX|123.45|link=yes}} produces ¤123.45

Include disambiguating abbreviation

{{XXX|123.45|long=no}} produces ¤123.45 an.cur.

{{XXX|123.45|long=no|link=yes}} produces ¤123.45 an.cur.

Verbal representation

{{XXX|123.45|long=yes}} produces ¤123.45 any currency

{{XXX|123.45|long=yes|link=yes}} produces ¤123.45 any currency

ISO code

{{XXX|123.45|ISO=yes}} produces 123.45 XXX TheCurrencyGuy (talk) 07:11, 6 August 2022 (UTC)[reply]

Negative amounts[edit]

Please contribute to the discussion at Template talk:US$#minus sign.  Stepho  talk  00:33, 30 December 2022 (UTC)[reply]

Ambiguity with Japanese Yen and Chinese Yuan - redux[edit]

The ¥ symbol has for a very long time been construed in the west as the Japanese yen, without a second thought. When Stepho-wrs first raised this (above) nearly ten years ago, that was the widespread assumption. Increasing prominence of its use for the Chinese yuan makes it timely, I think, to raise the question as to whether this template should disambiguate it invariably: always and only JP¥ or CN¥. This would be consistent with the way the template currently handles eg USD and AUD (US$1,000 , A$1,000). I suggest that it is time that we do.

Do we need a discussion at talk:MOS around an update to MOS:CURRENCY first? I'm thinking of something like the current text about the $ sign, but without any equivalent of the USD as default meaning in non-national contexts.

Comments? 𝕁𝕄𝔽 (talk) 10:33, 20 August 2023 (UTC)[reply]

The current module renders:
  • {{currency|1000|CNY}}RMB 1,000
  • {{currency|1000|JPY}}¥1,000
  • {{currency|1000|¥}}¥1,000
Before banned editor TheCurrencyGuy had his way with Module:Currency/Presentation, ¥ appeared in three places:
TheCurrencyGuy changed CN¥ to RMB at this edit. I get the impression from Wikipedia talk:WikiProject Japan/Archive/November 2014 § Currency templates that RMB is not commonly used in China but is appropriate for currency trading and the like. Seems to me that this template should support RMB as well as CN¥.
In the module, ¥ is an alias of JPY; what happens to that?
Trappist the monk (talk) 13:48, 20 August 2023 (UTC)[reply]
RMB is an abbreviation like STG, not a currency code. It doesn't surprise me that TheCurrencyGuy was responsible for changing it since "anything but ISO" seems to be his obsession (not always easy to tell).
Right now, to be consistent with most other outputs of this template, {{currency|1000|CNY}} should produce 1000 CNY. Maybe a new {{currency|1000|CNY2}} could produce 1000 CN¥?
My proposal is that we handle ¥ just like we handle $. If at present an unqualified $ defaults to USD, then it makes sense for an unqualified ¥ to default to JPY. My feeling is that this is the appropriate line to take right now: in ten years time, who knows but for now we really should at least get started down the road of equal treatment and add support for CN¥.
It is probably a new topic but maybe we need to think about support for the native symbols 円 (JPY) and 元 (CNY). 𝕁𝕄𝔽 (talk) 23:12, 20 August 2023 (UTC)[reply]
As an aside, I thought that the example quoted at talk:MOS (TSD09, since changed) had TCG's hoofprints all over it and sure enough, that's how it is. He changed {{CNY}} so that, instead of outputting CN¥nnnn, it produced ¥nnnn RMB. Gross! I have reverted it. 𝕁𝕄𝔽 (talk) 07:31, 21 August 2023 (UTC) revised --𝕁𝕄𝔽 (talk) 07:46, 21 August 2023 (UTC)[reply]
My question would be do CN¥ and JP¥ enjoy any widespread use or recognition? As a lay person, my experience is that ¥ represents the Japanese yen in almost all general English sources. When I see renminbi represented the word "yuan" is used in full with no abbreviation or symbol. Carrying over from the discussion at the MOS page my position is that Wikipedia should follow the lead of major English publications and reserve ¥ for the yen and not use a symbol for renminbi. 𝔖𝔱𝔬𝔩𝔦𝔱𝔷 (talk) 13:26, 21 August 2023 (UTC)[reply]
Going through a bunch of receipts from travel to Shanghai, most typically they use "RMB", sometimes "CNY", and less commonly ¥. Based on a survey of co-workers who deal with Chinese contractors, and NPR's feelings, Americans talking about the currency typically say "yuan" out loud though "RMB" is not unfamiliar. Apparently only "yuan" is correct when referring to a specific quantity "7 yuan", but renminbi is the name for an unquantified amount. So "7 renminbi" is incorrect in the same way "7 silver" is incorrect but "7 pounds of silver" is correct: [2][3] -- Beland (talk) 17:54, 21 August 2023 (UTC)[reply]
(But, just to be clear, "RMB 7.00" is common on receipts and presumably correct, because it's symbolic and not a grammatical sentence. Presumably if someone asked how much you paid and the receipt said "RMB 7.00", you'd reply "I paid seven yuan" because "I paid seven renminbi" is incorrect. -- Beland (talk) 18:06, 21 August 2023 (UTC))[reply]
I agree "¥" is most commonly interpreted by English speakers as "Japanese yen", so I would recommend changing all instances of "¥" to "CN¥" when referring to yuan, especially in infoboxes. I wouldn't rely on the context of an article being about China. Though in that context, "¥" for yuan is probably fine if currency amounts occur over and over again in prose if "Chinese yuan" is given at first mention. English speakers who deal with China do recognize "¥" as the currency symbol, and "CN¥" should clearly indicate to those unfamiliar with China at the very least that this is not Japanese yen. English Wikipedia generally prefers the style of country code plus symbol, like "US$", even though "USD" is more commonly seen when converting monetary amounts (and that's personally how I think of the currency in ambiguous contexts). We make an exception for "GBP" and avoid "GB£", so there would be precedent for using "RMB". I think CN¥ is a lot more commonly seen than "GB£", so that exception seems less necessary. -- Beland (talk) 18:26, 21 August 2023 (UTC)[reply]
I did some searching on Google Books for intel.
"US$" greatly pre-dates ISO codes, I found uses as far back as the 1940s[4]. Didn't find much conclusive on CN¥; but I did find something interesting: page 3 of this document uses "CN$" for the pre-renminbi Chinese currency (then referred to as the "Chinese dollar" because "yuan" was not yet universally assimilated into English) so there is precedent for "CNx" as a representation of Chinese money. My personal preference remains that editors should try to use words instead of symbols for less familiar currencies, but make of this what you will. 𝔖𝔱𝔬𝔩𝔦𝔱𝔷 (talk) 19:34, 21 August 2023 (UTC)[reply]
CN are "the first two letters of the alpha code are the two letters of the ISO 3166-1 alpha-2 country code" (see ISO 4217#National currencies. --𝕁𝕄𝔽 (talk) 23:29, 21 August 2023 (UTC)[reply]
You should be careful not to fall into the trap of anachronism. "US" and "CN" were in use prior to 1974, when the first version of ISO 3166 was published. The sources I provided were from the 1940s. 𝔖𝔱𝔬𝔩𝔦𝔱𝔷 (talk) 23:35, 21 August 2023 (UTC)[reply]
  • @Trappist the monk: Would you revert Module:Currency/Presentation back to what it was before TCG took his crowbar to it, please? I would do it myself but I'm not at all confident that I can do so safely. Stepho-wrs, I see you made an edit, which I think was to mitigate the damage: will you need to reconsider it when (if?) TtM reverts? --𝕁𝕄𝔽 (talk) 23:30, 21 August 2023 (UTC)[reply]
    All of his changes? If I do that, I'll revert to this version and then reapply subsequent edits by other editors as appropriate. Tomorrow (my time).
    Trappist the monk (talk) 23:46, 21 August 2023 (UTC)[reply]
    Just enquiring: this person may have been banned, but surely it would be helpful to consider their changes in insolation rather than ham-fistedly reverting everything; so long as they made them prior to their ban. 𝔖𝔱𝔬𝔩𝔦𝔱𝔷 (talk) 23:55, 21 August 2023 (UTC)[reply]

Canadian dollar doesn't match 4217 style[edit]

Why does {{currency|1|CAD}} produce CA$1 and not CA$1 like it should from the style? That's how the page linked even stylizes it as CAD, matching it's ISO 4217 code. microbiologyMarcus (petri dishgrowths) 20:41, 1 November 2023 (UTC)[reply]

I'll self-reply here. I'm reading the note on Canadian dollar and I can't say I'm convinced but I see the reason. Alas. I'd like see a citation included in the note. In addition, I still don't think it's a good teason to siffer from the ISO codes. microbiologyMarcus (petri dishgrowths) 20:44, 1 November 2023 (UTC)[reply]
I've never personally seen Can$ but I have seen CA$ and C$ a lot. Beware that there are only 2 formal representations. "$" - which is useless in an international context. And "CAD" - which is useless in an informal context. "CA$", "C$", etc are only conventions (not formally agreed upon) but are common enough that they are easily recognisable. If no one objects over the next few days, I will change the currency template to "CA$" to match {{CAD}} and {{CA$}}.  Stepho  talk  22:29, 1 November 2023 (UTC)[reply]
The lead of Canadian Dollar has citations for Can$.

There is no standard disambiguating form, but the abbreviations Can$, CA$ and C$ are frequently used for distinction from other dollar-denominated currencies (though C$ remains ambiguous with the Nicaraguan córdoba).[1][2][a]

so the current practice is not crazy. But has anyone ever seen it "in the wild"? Apart from CAD, the only form that I have ever seen too is CA$ (like AU$, NZ$) but then I live a long way from Canada so what do I know? Maybe it would be wise to invite comment at talk:Canadian dollar first? --𝕁𝕄𝔽 (talk) 00:17, 2 November 2023 (UTC)[reply]
Completely struck out my irrelevant response because I failed to read the question. How to sit an examination, 101. <blush> --𝕁𝕄𝔽 (talk) 11:44, 2 November 2023 (UTC)[reply]
I'm in support of the change to CA$ like the lead says on Canadian dollar. I know that's redundant as I was the one to open the discussion above, but I've come across this again and was reminded by my frustration. microbiologyMarcus (petri dishgrowths) 18:03, 15 November 2023 (UTC)[reply]

Apologies for the late reply - the real world sometimes keeps me busy.
I have asked at Wikipedia_talk:Canadian Wikipedians' notice board#Currency and Talk:Canadian dollar#currency template for comments. After all, they have more skin in this game than me.  Stepho  talk  22:44, 1 December 2023 (UTC)[reply]

I've mostly seen CA$ or CAD, and a bit of CDN. I don't believe I have ever seen Can$ being used, so I'm in support of a change to CA$ or CAD. ARandomName123 (talk)Ping me! 23:20, 1 December 2023 (UTC)[reply]
Came here from Canadian dollar... agree I have never seen Can$. Would support CA$ as a prefix and thus the output from this template. "CAD" I believe is only ever used after the numeral, so for example 20 CAD, since I believe it's short for "Canadian dollar" (like "USD" is "US dollar") and thus "$20 CAD" would be redundant. —Joeyconnick (talk) 06:28, 2 December 2023 (UTC)[reply]

After giving people plenty of notice and time to comment, CA$ seems to be the consensus, so I have changed the template to use this.  Stepho  talk  23:47, 9 December 2023 (UTC)[reply]

References

  1. ^ "Canadian dollar (Symbol) (Linguistic recommendation from the Translation Bureau)". Translation Bureau. October 15, 2015. Archived from the original on February 19, 2020. Retrieved October 2, 2021. In an English document, when you need to specify the type of dollar (Canadian, American, Australian, etc.), the Translation Bureau recommends using the symbol Can$ to represent the Canadian dollar. ... The shorter variant C$ is another symbol frequently used for the Canadian dollar. However, the Translation Bureau does not recommend this symbol, since it has a slight risk of ambiguity: it is also used to represent the Nicaraguan córdoba oro, and occasionally the Cayman Islands dollar as well.
  2. ^ "World Bank Editorial Style Guide 2020 – page 135" (PDF). openknowledge.worldbank.org. Retrieved 2022-08-27. (page 135 is on page 143 of the pdf file and says "Can$".)

Notes

  1. ^ There are various common abbreviations to distinguish the Canadian dollar from others: while the ISO 4217 currency code "CAD" (a three-character code without monetary symbols) is common, no single system is universally accepted. The World Bank, Editing Canadian English and The Canadian Style guide all indicate "Can$". "C$" is the symbol for the Nicaraguan córdoba, and as such is discouraged by The Canadian Style guide. Editing Canadian English also indicates "CDN$"; both style guides note the ISO code.

New Zealand Pound[edit]

Kia ora, the template currently does not support the New Zealand Pound. This is a defunct currency used in New Zealand between 1840 and 1967. Because of the late switch to decimal currency a lot of articles about the history of New Zealand need to express numbers in pounds, but the currency template currently does not support that.

The commonly used short symbols for the currency are £ or £NZ. I would prefer to used NZ£, because this is consistent with the current format for NZ$ that is rendered by the template.

I would suggest that the code should be NZP because this does not appear elsewhere in ISO 4217 and is unlikely to result in future conflicts with the standard. If possible, I think the strings "New Zealand pound" and "NZ pound" should also be acceptable.

I'm happy to contribute any necessary underlying lua code and test cases for this, though I don't know where any of that is hosted or editable. David Palmer aka cloventt (talk) 22:13, 17 April 2024 (UTC)[reply]

Unfortunately we can't just invent an ISO code, so we can't use NZP. I don't see any fundamental problem with NZ£ v £NZ. Anyone else? --𝕁𝕄𝔽 (talk) 22:37, 17 April 2024 (UTC)[reply]