Jump to content

Module talk:Convert

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
(Redirected from Module talk:Convert/data)

Error on Tewiki for a testcase

[edit]

While most test cases on Tewiki are successful, {convert|2|and|5|km|mi|sigfig=3|abbr=off}} gives → Lua error in మాడ్యూల్:Convert at line 1850: attempt to index local 'en_value' (a nil value). Need help to fix this. Arjunaraoc (talk) 04:38, 17 August 2022 (UTC)[reply]

@Arjunaraoc: The reason is that you have the most recent Module:Convert but an old Module:Convert/text. Several other things would also fail, for example fractions. Try this at tewiki (it won't work):
  • {{convert|1+2/3|ft|in}}1+23 feet (20 in)
I'll do some editing possibly in a few hours or possibly in a day or two. Wait for me to contact you again before proceeding. Feel free to remind me if 48 hours passes and it looks like I've forgotten. Johnuniq (talk) 05:32, 17 August 2022 (UTC)[reply]
@Arjunaraoc: I was able to update te:Module:Convert/text sooner than expected. That should fix errors due to inconsistency due to differing versions. For your information, I put some notes at te:User:Johnuniq/translate in 2015. You might like to review that and let me know if anything is wanted. For example, I was told that {{convert|1234567890|m|m}} should display 1,23,45,67,890 for the input number. If that is wanted, I have to add more options to Module:Convert/text. Johnuniq (talk) 07:52, 17 August 2022 (UTC)[reply]
@Johnuniq, Thanks for your quick action. The errors have disappeared. I have reviewed the past discussion notes. Many of the usecases are covered. In Tewiki, we use International and Indian number punctuation depending on the units (Ex:million (International), lakhs (Indian, equivalent to 1/10 of million), in articles. So unless we have a way of specifying that, we may not be able to use that. Arjunaraoc (talk) 12:36, 22 August 2022 (UTC)[reply]
There is no option to sometimes use one numeric style and sometimes another so you might have to put up with how it is. Johnuniq (talk) 08:51, 23 August 2022 (UTC)[reply]

bnwiki

[edit]

Hi, We didn't update bnwiki's Module:Convert since 2014. Can i update it without updating bn:Module:Convert/data, bn:Module:Convert/text? Will it break anything? আফতাবুজ্জামান (talk) 19:15, 17 December 2023 (UTC)[reply]

@আফতাবুজ্জামান: Convert and Convert/text must be updated together. The above section describes a problem due to use of a new Convert with an old Convert/text. Convert/data would generally not be a problem and would not need to be updated. I have prepared a new Convert/text for bnwiki but have no idea where to save it. Johnuniq (talk) 03:56, 18 December 2023 (UTC)[reply]
I worked out the location of the bnwiki module sandbox and created:
I think this will work but there are some very significant changes and it would take hours of examination to be confident about that. You might have to try it and see what happens. Johnuniq (talk) 05:31, 18 December 2023 (UTC)[reply]
In Convert/text, see the two TODO comments that I left for your attention. You will need to also fix the cvt_xxx messages under all_messages. That is because the old convert used %s to identify where substituted parameters need to go, while the new convert uses $1 for the first parameter, $2 for the second, etc. That should be better but it means every %s needs to be replaced. Johnuniq (talk) 05:47, 18 December 2023 (UTC)[reply]
@Johnuniq, {{convert|12|cm|disp=or}} is giving "12 centimetres (4.7 inches)" instead of "12 centimetres or 4.7 inches". Other than that, everything is working as before. Thank you. আফতাবুজ্জামান (talk) 18:33, 18 December 2023 (UTC)[reply]
@আফতাবুজ্জামান: Try my most recent edit at bnwiki. I wondered why "or" was missing from that table while comparing the enwiki/bnwiki versions. You can change the text on the right-hand side but "or" on the left-hand side must be unchanged. If that doesn't work, you would need to set up sandbox modules and a template that I can experiment with and add links to them maybe on my bnwiki talk so I can find them in the future. Johnuniq (talk) 22:30, 18 December 2023 (UTC)[reply]
@Johnuniq, Thanks. আফতাবুজ্জামান (talk) 22:14, 19 December 2023 (UTC)[reply]

 You are invited to join the discussion at Wikipedia:Village pump (technical) § Let's make Template:convert go away.. –Novem Linguae (talk) 07:37, 15 January 2024 (UTC)[reply]

Doubled SI prefix in singular form with varname

[edit]

Now I am working on the Ukranian localisation of Module:Convert and I am faced with the bug of doubled SI prefix that appears if parameter varname is used in translation_table. The module uses the singular form of a unit. If the unit uses a plural or declensed singular form defined in parameter varname, then the SI prefix shows as normal. I tried to delete all the modifications that I have done to the module in the Ukranian wiki, and it seems that the bug also appears on a clean version of the English module. Also, it affects only units that have a specified varname, and units that don't work as normal. For example, unit Mbit shows as megamegabit (мегемегабіт), and Mm2 shows as megasquare megametre (мегаквадратний мегаметр). Repakr (talk) 08:42, 14 September 2024 (UTC)[reply]

@Repakr: Are you working with the uk:Мodule:Convert set of modules or the sandbox modules such as uk:Мodule:Convert/пісочниця? Is there a test page showing the problem? Preferably that would be in a sandbox somewhere with almost nothing else so I can easily see what modules are being used and can experiment. Johnuniq (talk) 08:59, 14 September 2024 (UTC)[reply]
@Johnuniq. I am currently working with the sandbox modules. I haven't created test case for template Convert yet, but there is section in my sandbox: uk:Користувач:Repakr/Чернетка#Тестування convert, where I tested some feature. Repakr (talk) 09:14, 14 September 2024 (UTC)[reply]
@Repakr: That page has dozens of templates and I'm not going to take the time to play with it. If you post a simple test case at uk:User talk:Johnuniq I'll have a look although it might not be for a day or two. In the test, point out what is wrong and what it should display. Johnuniq (talk) 09:24, 14 September 2024 (UTC)[reply]
@Johnuniq, I am sorry, I didn't catch the meaning first time reading it. So, I added a test to your talk page. Repakr (talk) 09:30, 14 September 2024 (UTC)[reply]
@Repakr: I'm looking at function variable_name in uk:Module:Convert/пісочниця and wondering what exp_multiplier is and why the function is so different from my ten-year old code. I'll have to leave it at the moment but will look again in a day or two. Johnuniq (talk) 10:40, 14 September 2024 (UTC)[reply]
@Johnuniq, the function is different because Ukrainian uses a different declension than Polish. Ukrainian also has three field declension (metry, metriv, metra) as Polish, but declension differs based on numbers. It works like this singular form is used if the number is 1 or its combination with tens (except 11; like 21, 31), hundreds (like 101, 121, etc.), thousands, and so on; form metry is used if the number is 2, 3, 4 or its combination with tens (except 12, 13, 14; like 22, 32), hundreds (like 102, 122, etc.), thousands and so on; metriv is used if the number is 0 or higher than 4 (it includes 11, 12, 13, 14) or its combination with tens (like 24, 35), hundreds (like 104, 125, etc.), thousands and so on. Form metra is used for both 1/2 and 1.2 fractions. So for me, it was easier to rewrite a code using a function built in MediaWiki that chose the correct form for Ukrainian.
exp_multiplier stands for expotential multiplier and it stores the value of eng_scales, so the text of eng_scales can be also declened based on forms of numbers, like milion, miliony, milioniv, miliona.
Although I did the modification, I tried without those modifications and a bug was present. Repakr (talk) 13:12, 14 September 2024 (UTC)[reply]

Testing on this problem is at uk:User:Johnuniq/convert with discussion at uk:User talk:Johnuniq/convert. The bug seems to have been present since the original varname used for certain languages was developed more than ten years ago. Johnuniq (talk) 11:05, 15 September 2024 (UTC)[reply]