Template talk:Val

From WikiProjectMed
Jump to navigation Jump to search

bnwiki

Hi, on bnwiki, this module does not gives result in Bengali digit, so i did this. It works but not fully, see bn:Module talk:Val#উদাহরণ for examples. And for bnwiki, {{val|1234567.1234567|fmt=commas}} should be 12,34,567.1234567 instead of 1,234,567.1234567. Please help to fix. Thanks. আফতাবুজ্জামান (talk) 21:30, 18 December 2023 (UTC)[reply]

@আফতাবুজ্জামান: Module:Val is quite complex and I never got around to providing much localization. As you can see, numdot and numsep were added for the Italian Wikipedia, and likewise mtext allows easy customization of the error messages. However, there is no method to change digit translation or digit grouping. Module:Convert has a lot more and can group digits 2,2,3 but I would be reluctant to copy that tricky code into val and test it. Regarding translating the output, why not use bn:Module:EnDigitConverter that I wrote 8 years ago? I see it's now bn:Module:ConvertDigit. Maybe bn:Template:ConvertDigit which uses the module could be put in whatever template you are using for bn:Template:Val. Johnuniq (talk) 04:16, 19 December 2023 (UTC)[reply]
@Johnuniq, If i use bn:Template:ConvertDigit, for example {{val|1234.5678|1.23|4.56|e=3|u=deg}} won't work correctly. I was trying to use Module:Num Converter and was half successful. As you can see examples here, i am getting half Bengali and half English digit (e.g. 1২৩৪.5678°±1.23°). I was wondering if you could tell me which part (line) in the module produce that 1 & 5678 & 1.23 etc, so that i can just add "convert('bn', tostring(...))" to them. If you want, please directly edit the bn:Module:Val, it's not live yet. আফতাবুজ্জামান (talk) 23:34, 19 December 2023 (UTC)[reply]
I'll try to look at the issue maybe over the weekend. Feel free to post here and remind me next week if I forget to respond. Johnuniq (talk) 09:05, 20 December 2023 (UTC)[reply]
I have started looking and translating the digits won't be a problem. I should be done in a couple of days. Johnuniq (talk) 04:29, 27 December 2023 (UTC)[reply]
I put a preliminary version at bn:Module:Val. Johnuniq (talk) 08:30, 27 December 2023 (UTC)[reply]
@Johnuniq, Thank you. আফতাবুজ্জামান (talk) 20:06, 27 December 2023 (UTC)[reply]

Bug in unit apply to both numerator and denominator for inch/ft/min/sec (single/dbl quote)?

Compare:

  • {{val|1|/|2.3|u=m/s}}1/2.3 m/s
  • {{val|1|/|2.3|u=ft}}1/2.3 ft
  • {{val|1|/|2.3|u=in}}1/2.3 in

vs.:

  • {{val|1|/|2.3|u="}}1″/2.3″
  • {{val|1|/|2.3|u='}}1′/2.3′
  • {{val|1|/|2.3|u=°}}1°/2.3°
  • {{val|1|/|2.3|u=deg}}1°/2.3°

 — sbb (talk) 01:36, 24 January 2024 (UTC)[reply]

Are you referring to how the second group repeats the unit while the first doesn't? That is an intentional feature that applies to ranges. It makes more sense when using a dash or to.
  • {{val|1|-|2.3|u=ft}}1–2.3 ft
  • {{val|1|to|2.3|u=ft}}1 to 2.3 ft
  • {{val|1|-|2.3|u='}}1′–2.3′
  • {{val|1|to|2.3|u='}}1′ to 2.3′
Johnuniq (talk) 02:09, 24 January 2024 (UTC)[reply]
(Sorry for the late reply, I don't think I was notified of your response to me).
I understand that it makes sense for ranges. But I'm not specifying a range, I'm specifying a vulgar fraction, and it seems to be supported (if only notionally) by {{val}}. If I want 1/2.3 in (as in, the sensor size, 1/2.3 in), it works. But other unit codes as noted, repeat. What is the rationale for treating different units differently? Or perhaps better asked, what is the set of units that don't repeat (such as "m/s", "ft", "in", ...) and what is the set of units that do repeat?  — sbb (talk) 03:30, 11 February 2024 (UTC)[reply]
@Sbb: In val, a slash is a range, not a fraction. It might end up looking like a fraction but val treats it as a range. That is for usage where the slash sort-of means "or". Units are repeated if the range is x or × (that's a WP:MOS issue) or if the unit is flagged with ANGLE at Module:Val/units. You might not need {{val}}. Just write out what is needed. Val is to replace tricky wikitext. Johnuniq (talk) 05:07, 11 February 2024 (UTC)[reply]
Where in WP is a range designated by a slash? I can't think of anywhere. {{val}}'s docs only mention a single example using slash, but does not prescribe slash as a range. It is merely a conjoining (conjunction) format, one of several, including range-types (hyphen, "to", "and") as well as product/area types (×, "by"). I understand that in the Lua code, "/" is treated like a conjunction, but that doesn't mean it's appropriate syntax as a conjunction.
But there's an obvious need for fractional values, and it seems slash should provide that.
And again, what is the MOS range rule that produces only the single unit label of "ft" for {{val|1|/|2.3|u=ft}} (1/2.3 ft) but the repeated unit label of "°" for {{val|1|/|2.3|u=deg}} (1°/2.3°)?
You might not need {{val}}. Just write out what is needed. I need to represent 1/2.3 in, which works with {{val}} just fine.
Val is to replace tricky wikitext. I disagree with that. Templates like {{val}} are especially useful to consistently and cleanly represent a combined value and unit, rather than having a hodge-podge of numbers that were forgotten to be wedded to a unit label with {{nbsp}}.
My point in this comment is that there's no logical reason angle unit labels should be treated any differently than other unit labels with "/". I understand that {{val}} does, but there appears to be no logic for that. And nowhere in MOS does slash indicate a sort-of range like "or".  — sbb (talk) 08:15, 11 February 2024 (UTC)[reply]
I'm just reporting how it is which has been unchanged since at least August 2015 when the template was switched to using Module:Val. Slash is handled the same way by {{convert}}. At any rate, I just added unit degree which does not repeat:
  • {{val|1|/|2|u=degree}}1/2°
That might be adequate for your use case. Johnuniq (talk) 08:54, 11 February 2024 (UTC)[reply]

Template-protected edit request on 21 March 2024

Hi, I intended to add the {{val}} template to this article. Therefore I suggest the addition of the CGS-but-commonly-used unit of luminosity in particle colliders, cm-2·s-1. Thanks, sware🗣🏲 22:03, 21 March 2024 (UTC)[reply]

@Swaare: No edit request is needed—a unit can be added at Module:Val/units. That's a bit daunting and I'm happy to do it but some details are needed. The units are sort-of grouped logically. Do you see a place where the wanted unit would go? Each unit has an easy-to-type code to identify the unit. Any suggestion? If the unit is linked, what article should it link to? Bear in mind that there is not much point adding a unit to val if the unit will only be used in one or two places. Johnuniq (talk) 04:36, 22 March 2024 (UTC)[reply]

Template-protected edit request on 27 March 2024

The unit "fb-1" currently links to Barn (unit). I propose that it would be better to have it link to the section Barn (unit)#Inverse femtobarn. It provides specific information on that unit and would be more helpful to readers. Also, many other units link to specific sections within an article for the same reason, so this would be justified. Purplemountainmantalk contribs 21:21, 27 March 2024 (UTC)[reply]

Done. Johnuniq (talk) 03:19, 28 March 2024 (UTC)[reply]

Spacing

This is causing spacing issues on articles. See for example the usage on K2-18b in the "Evolution" section. Is there any way to shrink the numbers so that it fits within the line without enlarging the surrounding space? Viriditas (talk) 20:55, 3 April 2024 (UTC)[reply]

Not really. There is an accessibility guideline somewhere saying that text should not be too small. If that format is considered undesirable, perhaps some manual wikitext could be used to say +this -that? Johnuniq (talk) 05:34, 4 April 2024 (UTC)[reply]