Jump to content

英文维基 | 中文维基 | 日文维基 | 草榴社区

Template talk:To USD

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

It would be great if...

[edit]

It would be great if this template could display a comma (",") whenever the amount goes over $1,000USD. For example, "${{To USD|2000|GBR|round=yes}}[[USD]])" displays (as of 4 June 2016) "$3291USD". But it would be ideal if it displayed it as "$3,291USD" (note the comma between the "3" and the "2") instead since this is how this sort of numbers are handwritten in the U.S. Thanks, Mercy11 (talk) 18:25, 4 June 2016 (UTC)[reply]

I agree that some sort of digit grouping would be nice. There is an issue with which character should be used to group the digits and into what groups. Since this is English Wikipedia, probably the vast majority of readers would be familiar with your suggested method of grouping. However, English is also widely used as an international language, and in many other locales the conventions for digit grouping are different. If I were to try to implement digit grouping of any kind, I would prefer to use a thin space as the separator character. However, my free time has been very limited, and I probably wouldn't have time to implement this anytime soon. If anyone else would like to try, they are welcome. --Greenbreen (talk) 09:16, 25 September 2016 (UTC)[reply]
I agree, have requested this. Please can commas be accepted as input as well as outputted by default as per MOS:DIGITS. {{u|waddie96}} {talk} 13:53, 19 August 2019 (UTC)[reply]
@Waddie96: Since this page is not template-protected, the {{edit template-protected}} template does not function as you intend and instead just puts this request in the {{edit semi-protected}} queue. Any auto-confirmed user can make changes to this template, so there's nothing to do here from an edit request standpoint. If you need technical assistance with making these changes, I suggest raising this at WP:VPT or directly with a user with this expertise. ‑‑ElHef (Meep?) 14:31, 19 August 2019 (UTC)[reply]
ElHef Apologies, I thought I saw the Hatnote that it was template-protected. Will reach out for help at VPT. {{u|waddie96}} {talk} 18:37, 19 August 2019 (UTC)[reply]
@Greenbreen: The template would use formatnum to do digit grouping. Formatnum does automatically use the correct digit grouping based on which wiki language it is on. So, even when this template gets copied to another wiki that wiki, despite being in another language, still gets the correct digit grouping.--Snaevar (talk) 15:09, 20 August 2019 (UTC)[reply]
Requested code edit  Done.--Snaevar (talk) 15:22, 20 August 2019 (UTC)[reply]
This change seems to have caused errors in a number of articles. There are articles which use the "To USD" template as part of an "#expr:" formula, which doesn't accept numbers with a "," in it. While it would be convenient to output numbers with a "," in it, that can be achieved by using either Template:US$ or Template:Formatnum. Maestro2016 (talk) 16:53, 25 August 2019 (UTC)[reply]
Maestro2016 Unfortunately, Template:US$ simply formats a US$ number, it does not convert "to USD" as this template does. Greenbreen, please wouldn't you mind adding a boolean variable called 'format' or something similar that when 'yes' or 'true' the output is formatted using {{formatnum:}}. Thanks in advance! {{u|waddie96}} {talk} 09:01, 4 September 2019 (UTC)[reply]
What I meant is that Template:US$ can be combined with To USD, similar to how Template:Formatnum can be combined with To USD, as the US$ template utilizes formatnum. But yes, it would be better to have optional formatting within this template. Maestro2016 (talk) 15:38, 4 September 2019 (UTC)[reply]

Switch data to 2015

[edit]

The current default is to use data from 2014. I am planning to update to 2015 data, but before I do, I wanted to give an opportunity for comment or review to anyone who is interested. I have already created the data template. For anyone who would like to review it, it is Template:To USD/data/2015. If there are no objections, I am planning to make the switch on or about 3 October 2016. If the switch causes issues on pages which transclude this page, please make me aware of those issues here. --Greenbreen (talk) 09:23, 25 September 2016 (UTC)[reply]

Large numbers

[edit]

Would be nice if this template handled larger numbers and conversions like "40 billion" yen without having to type out all the zeros and deal with rounding them to significant digits. I am no longer watching this pageping if you'd like a response czar 05:02, 20 March 2017 (UTC)[reply]

For posterity, {{format price}} handles rounding in this way czar 21:33, 22 March 2017 (UTC)[reply]

Semi-protected edit request on 19 February 2018

[edit]

To update currency conversion template data to year 2017. AllenYC (talk) 03:37, 19 February 2018 (UTC)[reply]

 Not done for now: Not all years have data. You might instead want to contact the user who entered in the data for the other years. ToThAc (talk) 15:13, 20 February 2018 (UTC)[reply]

Special drawing rights

[edit]

Is it possible to use this template to convert special drawing rights to USD? — BillHPike (talk, contribs) 22:56, 4 August 2018 (UTC)[reply]

Undefined year 2018

[edit]

Using the parameter |year=2018 seems to create an "Undefined year: 2018" error, even though a page for 2018 does exist. |year=2017 works, however. – numbermaniac 04:55, 21 March 2019 (UTC)[reply]

Enabling 2018 in the main template is not hard (cut and paste the 2017 line). But the 2018 page is still using 2016 data. Somebody needs to get 2018 data before we enable it.  Stepho  talk  21:25, 21 March 2019 (UTC)[reply]
I have written World Bank, the source of the data; they responded to my request with an autoresponse which says someone will answer "as soon as possible". —EncMstr (talk) 20:13, 26 March 2019 (UTC)[reply]
Okay, thanks.  Stepho  talk  20:49, 26 March 2019 (UTC)[reply]

Bitcoin

[edit]

Am I correct in concluding that 1) this doesn't support Bitcoin, and 2) there is not a similar template which does? -Jason A. Quest (talk) 16:09, 16 February 2020 (UTC)[reply]

The exchange rate of Bitcoin changes just about every minute. It would be impossible to provide a yearly exchange rate with USD because it's nowhere near as stable as standard national currencies. – numbermaniac 01:16, 21 February 2020 (UTC)[reply]
The exchange rate of everything else also changes every minute, but I take your point. -Jason A. Quest (talk) 03:48, 21 February 2020 (UTC)[reply]

2019 data

[edit]

@EncMstr: I see you obtained 2018 data above. If you have time could you possibly ask the World Bank for 2019 data, as I need it for a featured list candidate? Chidgk1 (talk) 16:23, 16 April 2020 (UTC)[reply]

@Chidgk1: The World Bank referred me to the IMF. They have yet to respond. (Yikes, it has been over a year!) —EncMstr (talk) 19:30, 16 April 2020 (UTC)[reply]

Conversion

[edit]

Would there be any way to, say convert from USD to GBP? — Yours, Berrely • TalkContribs 09:45, 22 April 2020 (UTC)[reply]

Sure. As long as somebody is willing to put in today's conversion rate and to update it at least every week for the rest of eternity. Unfortunately, conversion rates are not static and change at unpredictable times.  Stepho  talk  11:08, 22 April 2020 (UTC)[reply]

Missing years

[edit]

Has the data for all missing years since 2003 been requested? Trigenibinion (talk) 15:12, 8 December 2020 (UTC)[reply]

The data sources maintained by World Bank, IMF, and others have gaps. I have no idea why. Given the difficulty of these entities answering simple questions, I have little confidence in seeing such details answered. —EncMstr (talk) 19:06, 8 December 2020 (UTC)[reply]
I now need data at least from 1998 on (first year here is 2002). Trigenibinion (talk) 20:15, 8 December 2020 (UTC)[reply]

Precision

[edit]

To convert small values in some currencies one needs precision below 1 cent. Trigenibinion (talk) 18:35, 3 January 2021 (UTC)[reply]

I could add an r parameter similar to Inflation without disruption (the default value would be 2 like it is done now). Trigenibinion (talk) 14:38, 4 January 2021 (UTC)[reply]

India

[edit]

I can add the conversion from Indian Rupees from 1970 to 2019 by using Template:INRConvert/HistoricalRate, but I have seen a difference of about 0.01 in the 2002 rate, for example. Is this OK? The rates there have like 5 digits of precision. Or I could only fill the missing years. There's likely a few other currencies that I could handle in a similar way to increase coverage. Thanks. Trigenibinion (talk) 03:59, 11 January 2021 (UTC)[reply]

The Nepalese Rupee could be handled with the same data if the exact peg info is provided. Trigenibinion (talk) 04:41, 11 January 2021 (UTC)[reply]
The template now leverages Template:INRConvert/HistoricalRate for INR and falls back to the subtemplates here. Trigenibinion (talk) 04:17, 12 January 2021 (UTC)[reply]

To EUR

[edit]

{{To EUR}} is leveraging Template:To USD/General. Trigenibinion (talk) 04:56, 12 January 2021 (UTC)[reply]

Do not use yet. Both APIs being assessed. Trigenibinion (talk) 04:01, 14 January 2021 (UTC)[reply]

Non-decimal currencies

[edit]

How are non-decimal currencies supposed to be handled? Trigenibinion (talk) 22:59, 12 January 2021 (UTC)[reply]

Pre-Euro currencies

[edit]

I have added a cur parameter to allow to select historical currencies from a country. This is a an ISO 4217 currency code. This is necessary because for example ESP has been used to ask for an Euro conversion, while ESP is also the code for the Spanish peseta. Currently only the currencies that have been immediately replaced by the Euro are supported (it is also possible to add the redundant cur=EUR parameter for Eurozone countries). I added the documentation, but it was removed, so you can look at the testcases page here or the documentation of {{To EUR}}, which takes the same parameters as {{To USD}}, for examples. Trigenibinion (talk) 00:40, 13 January 2021 (UTC)[reply]

Should we use a third positional parameter instead of cur? It is not documented yet. Trigenibinion (talk) 04:03, 14 January 2021 (UTC)[reply]
Well, {{FXConvert}} now takes a cur parameter (positional are being reserved for ranges). It also seems easier to add the parameter to existing code than finding the exact place where it should go if positional. Trigenibinion (talk) 21:06, 16 January 2021 (UTC)[reply]
Some people were wrongly using the third positional parameter to pass the year (ignored). Something else to think about. Trigenibinion (talk) 01:07, 18 January 2021 (UTC)[reply]
I think it is better to keep cur then and not use the third positional parameter for year or currency. Trigenibinion (talk) 18:39, 3 February 2021 (UTC)[reply]

Bhutan

[edit]

Bhutan and India differ in some data subtemplates. They are supposed to be pegged 1:1 . Trigenibinion (talk) 20:16, 13 January 2021 (UTC)[reply]

Template broken after recent changes

[edit]

Recent changes (edited to add: appear to have) have broken this template in Federal districts of Russia, Economy of the United Kingdom, and Mahboula. – Jonesey95 (talk) 15:43, 17 January 2021 (UTC)[reply]

The template is being wrongly called in those pages passing the year as a third positional parameter, instead of with year=. I don't know if at some point the template supported this. Trigenibinion (talk) 15:58, 17 January 2021 (UTC)[reply]
Fair enough. They came to my attention because there was a misnested tag in the template, which I believe that I have fixed. Is there a way to catch this error using an error-tracking category? – Jonesey95 (talk) 16:02, 17 January 2021 (UTC)[reply]
Category:Pages using a wrong currency in Template:To USD Trigenibinion (talk)
I have started fixing the calls in those pages. Some people were using years for which there is no data for the country or at all. In these cases, the proper error is now shown, so that people can take action. Trigenibinion (talk) 16:29, 17 January 2021 (UTC)[reply]
I think the year in all those calls was always being ignored because I see many cases of unavailable data, including a GBP conversion for 1861. Trigenibinion (talk) 17:52, 17 January 2021 (UTC)[reply]

Unknown country code

[edit]

Tracking category needed in the data subtemplates? Trigenibinion (talk) 18:02, 17 January 2021 (UTC)[reply]

Category:Pages using an unknown country code in Template:To USD Trigenibinion (talk) 21:17, 17 January 2021 (UTC)[reply]

2016 data

[edit]

The Eurozone data is inconsistent for 2016. Trigenibinion (talk) 20:23, 17 January 2021 (UTC)[reply]

I have groped the countries that have adopted the Euro as their currency. Trigenibinion (talk) 00:13, 18 January 2021 (UTC)[reply]
Added Liechtenstein to 2016 (Swiss Franc). Trigenibinion (talk) 00:33, 18 January 2021 (UTC)[reply]

2018 data

[edit]

The Eurozone data is inconsistent for 2018. Trigenibinion (talk) 20:29, 17 January 2021 (UTC)[reply]

I have grouped the Eurozone. Trigenibinion (talk) 23:26, 17 January 2021 (UTC)[reply]
Also grouped the other Euro adopters. Liechtenstein corrected to Swiss Franc. Trigenibinion (talk) 00:22, 18 January 2021 (UTC)[reply]

Liechtenstein

[edit]

Corrected to Swiss Franc in 2018 data. Other subtemplates might be wrong too. Trigenibinion (talk) 00:24, 18 January 2021 (UTC)[reply]

Added it to 2016. Trigenibinion (talk) 00:33, 18 January 2021 (UTC)[reply]
Added more. It should be there everywhere except 2008 and 2009. Trigenibinion (talk) 17:32, 18 January 2021 (UTC)[reply]

Vatican City (VAT)

[edit]

It officially uses the Euro. I have added it to 2016 and 2018, it might also be missing from the rest. Trigenibinion (talk) 00:26, 18 January 2021 (UTC)[reply]

It should there everywhere now. Trigenibinion (talk) 17:34, 18 January 2021 (UTC)[reply]

Latvia, Lithuania

[edit]

Errors? I have marked them with a comment in the 2012-2014 data where they still have an Euro rate before switchover. Trigenibinion (talk) 17:28, 18 January 2021 (UTC)[reply]

Removed. Trigenibinion (talk) 17:05, 23 January 2021 (UTC)[reply]

Singapore

[edit]

Adding the rates for 2008 and 2009 would be quite useful. Trigenibinion (talk) 18:23, 18 January 2021 (UTC)[reply]

They have been added. Trigenibinion (talk) 19:37, 14 February 2021 (UTC)[reply]

Canada

[edit]

I am seeing CAD entered at parity with USD sometimes. Trigenibinion (talk) 14:01, 19 January 2021 (UTC)[reply]

It seems it is just low precision. Trigenibinion (talk) 17:15, 23 January 2021 (UTC)[reply]
The WB data has been re-entered. Trigenibinion (talk) 19:38, 14 February 2021 (UTC)[reply]

Wrong data

[edit]

I think there is a significant amount of data which was just copied from previous years. Trigenibinion (talk) 22:30, 27 January 2021 (UTC)[reply]

I have re-entered the data from the WB. Trigenibinion (talk) 19:33, 14 February 2021 (UTC)[reply]

Weird rates

[edit]

I think the WB is using the latest currencies for all years.

But this does not seem to happen for Euro countries for example. Trigenibinion (talk) 07:44, 4 February 2021 (UTC)[reply]
It also seems to happen in this case with the UN data, so the countries which joined the Euro after 2013 need to be checked from 2014 on. Trigenibinion (talk) 19:41, 14 February 2021 (UTC)[reply]
I have removed Lithuania 2014, which should be the only Euro country problem. Trigenibinion (talk) 19:50, 14 February 2021 (UTC)[reply]

Missing data

[edit]

Taiwan 2012, Russia 2014, and Russia 2016 are needed. Trigenibinion (talk) 19:35, 14 February 2021 (UTC)[reply]

For Russia, it seems everything since 2014 is needed. The 2013 data is not copied anymore. Trigenibinion (talk) 19:58, 14 February 2021 (UTC)[reply]
The problem is that the pages in error are looking for "Russia" and the subtemplates now only handle "Russian Federation". I will add the name. Trigenibinion (talk) 20:14, 14 February 2021 (UTC)[reply]
What is actually missing is Taiwan 2012, 2017, and 2019. Trigenibinion (talk) 21:02, 14 February 2021 (UTC)[reply]
I have restored Taiwan 2012, 2017, 2018, and 2019 which were in the comments. Trigenibinion (talk) 00:46, 15 February 2021 (UTC)[reply]
I see missing data for Taiwan 2011. Grillofrances (talk) 19:01, 18 February 2022 (UTC)[reply]
I see missing data for 2022, at least for Germany, UK and Russia. Grillofrances (talk) 09:12, 19 February 2022 (UTC)[reply]

Israeli new shekels

[edit]

{{currency|1500|ILS}} seems to work OK, producing 1,500. But {{to USD|1500|ILS}} produces "Unknown country code for year 2019: ILS". Am I doing something wrong? —⁠ ⁠BarrelProof (talk) 22:24, 1 September 2021 (UTC)[reply]

BarrelProof, you need to use the country code for Israel, which is ISR, not the currency code ILS: {{to USD|1500|ISR}} Inf-in MD (talk) 23:33, 1 September 2021 (UTC)[reply]
Thank you. I had tried IL, but not ISR. —⁠ ⁠BarrelProof (talk) 00:19, 2 September 2021 (UTC)[reply]

Average

[edit]

Currently, it seems to use rates from the 1st of January. I'd like to have an option to use the average rate from the entire year. The reason is that a rate might be sometimes exceptionally high or low for only a few days or weeks around the 1st of January.

Btw. there could be also some other options available like specifying:

  • an exact date (year/month/day)
  • an exact hour
  • a month (with average)
  • a range (with average)

Grillofrances (talk) 19:11, 18 February 2022 (UTC)[reply]

Yes I use for lira which has varied a lot during the year so would prefer average Chidgk1 (talk) 08:22, 19 February 2022 (UTC)[reply]

Should give error for current year not wrong result - like it used to

[edit]

{{To USD round|400|TUR|2022|sf=2}} gives 71 whereas generally in the past the current year gave an error.Chidgk1 (talk) 09:30, 20 March 2022 (UTC)[reply]

2021

[edit]

Where does the 2021 data com from? Thanks. Trigenibinion (talk) 02:43, 25 June 2022 (UTC)[reply]

How to add 2022 lira?

[edit]

How can I added 2022 lira please? Forest in Turkey is giving an error Chidgk1 (talk) 14:28, 20 February 2024 (UTC)[reply]

Turkish Lira really doesn't seem to working effectively. The value for 500lr converted to USD is returning 56USD which is obviously not correct. Jo Jc JoTalk💬Edits📝 16:59, 7 November 2024 (UTC)[reply]
@Jo Jc Jo TL is not sinking so quickly now. Perhaps you did not specify the year. I don’t know why the default is set to 2021 - suggest you discuss further below at Template talk:To USD#Using most recent data rather than here Chidgk1 (talk) 07:46, 8 November 2024 (UTC)[reply]

Documentation for how to add new data?

[edit]

Not volunteering to do it all but is there any documentation about how to add a new year of data please? Chidgk1 (talk) 14:31, 20 February 2024 (UTC)[reply]

How to add 2023?

[edit]

As you can see there is an error in Forest in Turkey#Forest products.Could someone who knows possibly answer my question above? Chidgk1 (talk) 08:37, 7 August 2024 (UTC)[reply]

Using most recent data

[edit]

When a year isn't explicitely provided, the template seems to use the data from 2021; that seems arbitrary.

For example:

{{To USD|1000|ARG}} 10.53
{{To USD|1000|ARG|year=2021}} 10.53
{{To USD|1000|ARG|year=2023}} 3.38

UltraBatata (talk) 14:05, 6 October 2024 (UTC)[reply]

I suggest you change it to default to the average value for the most recent complete year for which there is data Chidgk1 (talk) 07:49, 8 November 2024 (UTC)[reply]

Using ISO 4217 instead of ISO 3166

[edit]

The conversion into USD always originates from a currency so I see no reason why ISO 3166 (country codes) are used for this template and not ISO 4217 (currency codes).

This is also out of line with other currency templates such as Template:Currency which uses ISO 4217 to list currencies. This is particularly frustrating when used in conjunction with Template:Currency (as is often the case) as both country and currency codes need to be looked up and ensured the correct ISO code is used in the correct template.

I can see no reason as to why there should not be a standardised ISO reference used (ironically...) when dealing with conversion and currency and it seems most appropriate to me that ISO 4217 should be the chosen currency related templates.

Is there any reason as to why ISO 3166 was chosen and is there any object as to why ISO 4217 shouldn't be used? Jo Jc JoTalk💬Edits📝 15:19, 8 November 2024 (UTC)[reply]

Excellent idea - it would be great if you did that I think Chidgk1 (talk) 17:26, 8 November 2024 (UTC)[reply]