Template talk:Val

Test cases

For a while I intend be adding test cases to Template:Val/testcases. There are a lot of instances where the module is in error, and therefore, expect many of these new tests to fail until the module is corrected for these. Feel free to correct the template (or errors in my tests) in the interim, or to leave the corrections for later. An example problem is that the new SI prefixes (Q, R, q, r) are not properly supported by the template. —Quondum 17:16, 12 February 2026 (UTC)[reply]

I just prepared a new section with documentation for how testcases works. I will put it below in a new section to keep it in a convenient place for future reference. Johnuniq (talk) 23:03, 12 February 2026 (UTC)[reply]
Though your description below is convenient, it seems to allow existing errors to go undetected, as was abundantly clear after your recent update of Template:Val/testcases. In particular, if the existing output is bad (invisibly incorrect characters such as the micro sign instead of the Greek mu, and incorrect sorting values), these are simply hidden in this approach. By preparing the tests before updating the module sandbox, correct behaviour can be achieved more directly, even though it is tedious. Sure, it serves as a way to follow changes easily, but that is tracking, not really testing.
As a related aside, {{val}} has become a maintenance nightmare by the way it is designed, relying on another complex template ({{convert}}), and not parsing the syntax of units, giving rise to exponential complexity (in number of prefixes, units, ways of combining) of implementation and testing. I would think that it is getting to be where this module should be entirely rewritten. —Quondum 23:40, 12 February 2026 (UTC)[reply]

Johnuniq, I have made updates to Module:Val/units/sandbox and Template:Val/testcases. These seem good based on the testcases as I expect them to behave. I have not updated any of the codes that use the micro sign, as articles may be using these, pending discussion. If you are comfortable with it, you can copy the sandbox across to the live version, or else we can first discuss any misgivings that you might have and the micro sign. I would even be inclined to eliminate both the micro sign and the mu on input, requiring ASCII 'u' instead (once these have been found and replaced). —Quondum 01:33, 13 February 2026 (UTC)[reply]

Testcases

The system at Template:Val/testcases is obscure. It uses Module:Convert/tester which is intended for hundreds of tests (possibly a couple of thousand before template limits are hit). When I last looked years ago, the other unit test systems would not handle that many.

There is no point making manual changes to the testcases. Instead:

  • Edit the samdbox modules for any wanted changes, for example, to alter units.
  • Edit Template:Val/testcases to make any wanted alterations/additions to the templates at the left margin.
  • For any added template, put nothing after it (no expected output).
  • Do not try to edit the expected output which follows on the same line as each template.
  • Edit Template talk:Val/testcases and replace its contents with
    {{#invoke:convert/tester|make_tests|page=Template:Val/testcases|show=all|template=val/sandbox}}
  • Preview the edit and copy the displayed output. To do that, select the first couple of words, scroll to the bottom of the page, hold down Shift and select the last couple of words.
  • After copying the preview, you can close the edit window to abandon the edit.
  • Edit Template:Val/testcases, select all, paste the preview from talk.
  • You can view changes if wanted, or just publish the edit.

Later, if ever needed, the history of Template:Val/testcases can be used to track what changes have occurred to the way {{val}} behaves.

Johnuniq (talk) 23:04, 12 February 2026 (UTC)[reply]

Making this available in other languages

Can this template be added to other languages like dutch? I see it is available in English since ages but the editors in dutch wikipedia are still manually formatting every number with sticks and stones (dashes and dots).

The page source seems not the real code, only a reference #invoke:val|main, and copying this does not work. Does the actual code file need to be placed on a wikipedia server somewhere, or how do we get this essential function into Wikipedia more broadly than just English?

The table alignment template is also missing, it has to be manually done for every cell in a table. This template also is not a normal source page but a reference to a .css file that I assume regular users can not place on the server. Maybe an admin who sees this can copy that one over too (or make it usable on all of wikipedia instead of duplicating code). (Update: this part is resolved with the help of ItsNyoty.)

80dot171dot93dot89 (talk) 10:04, 17 February 2026 (UTC)[reply]

Volts per metre?

Is it possible to add V.m or similar, linking to electric field? I've found it in dust devil.-- Carnby (talk) 13:35, 11 April 2026 (UTC)[reply]

The wikitext in the article is {{val|10000|ul=volts per metre|fmt=commas}}. All val is doing to putting a comma in 10000 and adding the text "volts per metre" as a wikilink. Since there is an article with that name, the link is blue. Replace the wikitext with what is wanted, namely: 10,000 [[Electric field|volts per metre]] → 10,000 volts per metre Johnuniq (talk) 04:05, 12 April 2026 (UTC)[reply]
I meant to use the SI symbol V‧m in {{val}} linking it to electric field.-- Carnby (talk) 13:11, 13 April 2026 (UTC)[reply]
Why not use the wikitext given in my last comment? Replace "volts per metre" with whatever is wanted. It is linking to electric field. The time to think about adding a unit to val is when a dozen articles need the same thing. Johnuniq (talk) 07:23, 14 April 2026 (UTC)[reply]
I tried this workaround:
10,000{{sp}}[[Electric field|{{Abbr|V‧m|volts per metre}}]]
yielding
10,000 V‧m
Does it look good?-- Carnby (talk) 10:13, 14 April 2026 (UTC)[reply]
Ah, I didn't realize an abbreviation was wanted. It looks good but there are two issues. First, the dot in V‧m is U+2027 Hyphenation Point. Units looking like that normally use U+00B7 Middle Dot. Second, V·m would be read as "volt metre" where the dot indicates multiplication like N·m (Newton-metre). An electric field is V/m (volts per metre). Johnuniq (talk) 11:12, 14 April 2026 (UTC)[reply]
 Done-- Carnby (talk) 12:00, 14 April 2026 (UTC)[reply]

Ohms and omegas

In the realm of electrical resistance, the Greek letter capital omega (Ω) is used, which is inconvenient to type. Can we get some aliases for the relevant units? "Ohm", "ohm", and "Omega" all seem like good options. — LucasBrown 11:08, 8 June 2026 (UTC)[reply]

Content Disclaimer

Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.

  1. The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
  2. There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
  3. It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
  4. Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
  5. Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.