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

message: __TOC__

message:  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)
replies: text: @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:

text: *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.

text: *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.

text: *3 Shepperd's Dell is a small canyon in the Columbia River Gorge in Oregon, located at  which is less than one-third mile (500 m) southeast of Rooster Rock State Park.

text: A solution would need to handle the common fractions and the general case of fractions such as  and  that may never be used. Johnuniq (talk) 10:01, 27 December 2015 (UTC)
replies: text: :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:

text: :* "a third of a mile ()" to show"a third of a mile ()", or

text: :* {convert|1/3|mi|km|spell=in|disp=preunit|of a } gives "".

text: Several co-templates for phrases, such as , 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 "". Fortunately the old Convert is still correct, so {convert/old|105|-|106|F|C}} gives "" 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)
replies: text: :  →  -DePiep (talk) 07:29, 3 January 2016 (UTC)

text: :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)
thread_title:  Spelling fractional quantities 

message: 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)
replies: text: 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)

text: 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)
replies: text: : great, can someone take care of this?  I tried, but was reverted. Frietjes (talk) 14:57, 5 January 2016 (UTC)
replies: text: ::Done. -DePiep (talk) 17:03, 5 January 2016 (UTC)
thread_title:  Testcases 

message: I've discovered a problem with the conversion of long tons to kilograms. The following options give different results:
* converts to  instead of 11,200 kg
Half of 11LT, or 5½ LT, however, result in:
* converts to 
* converts to 
* converts to  - André Kritzinger (talk) 18:13, 6 January 2016 (UTC)
replies: text: 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:  → . Peter coxhead (talk) 18:53, 6 January 2016 (UTC)
replies: text: :Ah, got it. Fixed by adding "|sigfig=3". - André Kritzinger (talk) 20:04, 6 January 2016 (UTC)
thread_title:  Hiccup with long tons to kilograms 

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