Template talk:To USD round

Latest comment: 3 months ago by Chidgk1 in topic Documentation for how to add new year?

Category for invalid value

edit

Probably a single category should be used for this template, as well as Template:To USD, in the case of an invalid param value passed to either of them. I see no reason for each to have their own category. Mathglot (talk) 11:15, 13 December 2019 (UTC)Reply

Changed per this discussion[perma] at WT:CATP. Mathglot (talk) 17:09, 14 December 2019 (UTC) edited; Mathglot (talk) 19:30, 25 June 2023 (UTC)Reply

Add 'current' option

edit

Conversions are to USD of the given year, but often one might want to know the amount in current USD. I think we should add new param |current=yes which would do the conversion into current USD amount, by multiplying the original conversion by the ratio of USD now (or latest year available) to USD in the given year. Mathglot (talk) 19:34, 25 June 2023 (UTC)Reply

Maybe not 'current' because the abbreviation 'cur' is used for 'currency' and could lead to confusion. Perhaps 'now' or 'latest' or something. Mathglot (talk) 19:43, 25 June 2023 (UTC)Reply

Country Code Instead of Currency Code?

edit

Why does this template use country codes to refer to currencies, when there are already three letter currency codes in common use for all current, and past, currencies (e.g. USD, EUR, FRF).

It seems quite counter-intuitive that we have to invoke ISO 3166-1 country codes, when there is not a 1-to-1 correspondence between them, and currencies (some countries share currencies, some countries have or have had multiple currencies, etc.), whereas ISO 4217 currency codes are standardised and do have a 1-to-1 relationship with currencies.

I don't want to start poking around and breaking things, so I'm leaving this note instead, perhaps someone has some information I lack. --Tomatoswoop (talk) 02:30, 28 August 2023 (UTC)Reply

update: I see that this (and other similar templates) have an optional additional "cur" parameter to workaround this for Eurozone countries (so you would put in the country code and the currency code in that instance). This seems like a bit of an unnecessary kludge to me, surely we should just be using currency codes from the get-go? --Tomatoswoop (talk) 02:37, 28 August 2023 (UTC)Reply

Good idea - I think you should do it Chidgk1 (talk) 06:22, 14 August 2024 (UTC)Reply

Documentation for how to add new year?

edit

Not volunteering to do it all but is there any documentation about how to add a new year of data please? Chidgk1 (talk) 11:11, 7 August 2024 (UTC)Reply

@Trigenibinion Well editing this template was simple but I cannot document adding a year as I don’t know how you created the 2023 subtemplate. Could you possibly document adding a year or is it already documented somewhere? Chidgk1 (talk) 06:32, 14 August 2024 (UTC)Reply

Seems to be something wrong with test procedure

edit

When I added 2023 to sandbox it works in my sandbox but not for the test cases. Or did I misunderstand something as I know very little about templates? Chidgk1 (talk) 12:33, 7 August 2024 (UTC)Reply

What I'm seeming is that none of the test cases exercise the functionality you added (the default year is 2019 in both the live and the sandbox versions), and thus of course it doesn't show your changes, as it should. * Pppery * it has begun... 18:17, 12 August 2024 (UTC)Reply
@Pppery The test cases I added are right at the end of Template:To USD round/testcases. Are you saying there is something wrong with the test cases I added? Also I don’t understand why the default year is 2019. Chidgk1 (talk) 05:49, 13 August 2024 (UTC)Reply
They don't work because they need to be passed as a named parameter rather than a numbered parameter. The default year is 2019 because that was the highest when the template was created, I think. Anyway, the first line of code is {{#switch:{{{year|2019}}}, which explains both issues. * Pppery * it has begun... 12:36, 13 August 2024 (UTC)Reply
Great thanks that worked Chidgk1 (talk) 06:23, 14 August 2024 (UTC)Reply