Разговор о шаблону:Convert/sandbox

Садржај странице није подржан на другим језицима
С Википедије, слободне енциклопедије

Корисник:MiszaBot/config

Често постављена питања (ЧПП)
П:
О:

Разговор о шаблону:Convert/Archives

Spelling fractional quantities[уреди извор]

{{convert|1/3|mi|spell=in}} outputs "one-third mile (0.54 km)", but I think it should output "one third of a mile (0.54 km)" or ideally "a third of a mile (0.54 km)". That way, it would fit better in prose, for example, "The road runs a third of a mile (…) from A to B." Not sure if the change would have to happen in Module:ConvertNumeric or Module:Convert. – Minh Nguyễn 💬 06:23, 26 December 2015 (UTC)

@Minh Nguyễn: There may be nothing general that convert can do about details like that because there would probably be lots of exceptions and English-variety issues with some preferring one style, and others another. When developing the spelling of fractions I worried about cases like the one you mention, but I gave up because a large amount of research would be needed to work out how fractions are spelled in articles, and what varieties exist. A search shows many examples where editors have apparently wanted "one-third mile"; three examples:
  • 1 Pemberton had already started after the supply trains and was on the Raymond-Edwards Road, with his rear at a crossroads one-third mile south of the crest of Champion Hill.
  • 2 The main body of Kuskulana Glacier is about 11 miles long and slopes from east to west with an average width of about one-third mile.
  • 3 Shepperd's Dell is a small canyon in the Columbia River Gorge in Oregon, located at 45° 32′ 54″ С; 122° 11′ 42″ З / 45.54833° С; 122.195° З / 45.54833; -122.195 which is less than one-third mile (500 m) southeast of Rooster Rock State Park.
A solution would need to handle the common fractions and the general case of fractions such as 1 23 and 4 56 that may never be used. Johnuniq (talk) 10:01, 27 December 2015 (UTC)
Perhaps it's a matter of opinion, but I would find "a third of a mile" more natural in all three cases. Normally I would arrange a sentence to fit the template's "one-third mile" phrasing, just to take advantage of the automatic conversion, but sometimes it sounds awkward. – Minh Nguyễn 💬 10:26, 27 December 2015 (UTC)
  • Use disp=out or disp=preunit for custom wording: For many years, the easiest tactic for free-form text has been to just show the output conversion only, or use disp=preunit, as in:
  • "a third of a mile ({{convert|1/3|mi|disp=out}})" to show
    "a third of a mile (0,54 km)", or
  • {convert|1/3|mi|km|spell=in|disp=preunit|of a } gives "one-third of a mi (0,54 of a km)".
Several co-templates for phrases, such as {{convert/words}}, have been developed but were deleted to force extra complexity into the Lua script Convert which has derailed fixes of core errors such as the nonsense range "41-41" for 3 years in {convert|105|-|106|F|C} showing "105—106 °F (41—41 °C)". Fortunately the old Convert is still correct, so {convert/old|105|-|106|F|C}} gives "Шаблон:Convert/old" correctly as in 2013. Meanwhile, just use "disp=out" and allow focus on fixing numeric bugs in the Lua Convert. -Wikid77 (talk) 05:27, 3 January 2016 (UTC)
{{convert|105|-|106|F|C|sigfig=3}} → 105—106 °F (40,6—41,1 °C) -DePiep (talk) 07:29, 3 January 2016 (UTC)
re Wikid77: "For many years, the easiest tactic for free-form text has been to just show the output conversion only". That may be, but here you argue that "In general, we try to avoid hard-coding the generated output numbers because they often change". Either way to choose from then. -DePiep (talk) 19:18, 4 January 2016 (UTC)

we should probably change the broken tests in Template:Convert/testcases/range to use convert and convert/sandboxlua? or, just remove the broken tests ... Frietjes (talk) 14:01, 4 January 2016 (UTC)

Agree. These tests are not valid or functional any more. They were created in 2013 to prove that the Lua {Convert} could replace parsed {Convert}. More such testcases pages exist. By now, we don't need any reference checking with old {Convert} any more. My line with parsed Convert is that it should never bother mainspace nor Lua Convert ever anywhere. -DePiep (talk) 19:12, 4 January 2016 (UTC)
The only testcases I look at (apart from many thousands of tests on a local computer) are the four pages listed at Template:Convert/testcases#Sandbox testcases. The many other test pages may as well be kept in case ever wanted, but the tests they perform are incorporated in one of the four pages mentioned. I agree the ranges page should be cleaned up, at least by removing the broken tests, or for simplicity it could just be blanked with a note that it was used to compare the old/new systems, and the history can be examined if needed. Johnuniq (talk) 21:57, 4 January 2016 (UTC)
great, can someone take care of this? I tried, but was reverted. Frietjes (talk) 14:57, 5 January 2016 (UTC)
Done. -DePiep (talk) 17:03, 5 January 2016 (UTC)

Hiccup with long tons to kilograms[уреди извор]

I've discovered a problem with the conversion of long tons to kilograms. The following options give different results:

  • {{convert|11|LT|kg|abbr=on}} converts to 11 long tons (11.000 kg) instead of 11,200 kg

Half of 11LT, or 5½ LT, however, result in:

  • {{convert|5|LT|10|lcwt|kg|abbr=on}} converts to 5 long tons 10 cwt (5.600 kg)
  • {{convert|5.5|LT|kg|abbr=on}} converts to 55 long tons (56.000 kg)
  • {{convert|5+1/2|LT|kg|abbr=on}} converts to 5 12 long tons (5.600 kg) - André Kritzinger (talk) 18:13, 6 January 2016 (UTC)
This is due to the different default precision of conversion and is perfectly correct and reasonable. "11" and "5.5" have two significant figures, so the conversion results in two significant figures, "11,000" and "5,600" respectively. Exactly the same will happen with other conversions. Note that the following converts as it should, since the source has three significant figures: {{convert|11.0|LT|kg|abbr=on}} → 110 long tons (110.000 kg). Peter coxhead (talk) 18:53, 6 January 2016 (UTC)
Ah, got it. Fixed by adding "|sigfig=3". - André Kritzinger (talk) 20:04, 6 January 2016 (UTC)

Forumshopping[уреди извор]

Looks like forumshopping started at Jimbo's talkpage [1], re deleted parsing templates. -DePiep (talk) 05:40, 12 January 2016 (UTC)