ব্যবহারকারী:Johnuniq/sandbox: সংশোধিত সংস্করণের মধ্যে পার্থক্য

উইকিপিডিয়া, মুক্ত বিশ্বকোষ থেকে
বিষয়বস্তু বিয়োগ হয়েছে বিষয়বস্তু যোগ হয়েছে
Johnuniq (আলোচনা | অবদান)
tweaks
Johnuniq (আলোচনা | অবদান)
have narrowed down problem
১ নং লাইন: ১ নং লাইন:
Demonstration of problem using mw.loadData using [[Module:Convert/sandbox]].
[[Module:Convert]] has a problem at line 90:
*<code><nowiki>{{#invoke:convert/sandbox|main|TEST}}</nowiki></code> → {{#invoke:convert/sandbox|main|TEST}}
<pre> text = ustring.gsub(text, '%d', to_en_table)</pre>
*<code><nowiki>{{#invoke:convert/sandbox|main|TEST|require}}</nowiki></code> → {{#invoke:convert/sandbox|main|TEST|require}}
Before the above is the code <code>local ustring = mw.ustring</code>. The above is supposed to translate bn digits to en digits, but it makes no change to text.
*<code><nowiki>{{#invoke:convert/sandbox|main|TEST|load}}</nowiki></code> → {{#invoke:convert/sandbox|main|TEST|load}}


A test system is in the module to brute-force the translation. To view the results, edit the above module, then preview it using this page <code>User:Johnuniq/sandbox</code> as the target.


:Test 1 uses a local table (correct result).
*<code><nowiki>{{convert|123.4|m|mm}}</nowiki></code> → {{convert|123.4|m|mm}}
:Test 2 uses a table accessed with "require" (correct result).
*<code><nowiki>{{convert|১২৩.৪|m|mm}}</nowiki></code> → {{convert|১২৩.৪|m|mm}}
:Test 3 uses a table accessed with "loadData" (bug).


The above is working because ustring.gsub is currently not used, but when using the code shown above for line 90, the second convert gives the following because the input number is not converted to en digits:
:Conversion error: Value "১২৩.৪" must be a number

Paste the following into the debug window to see the mw.log output:
<pre>
=p.convert{ args = {}, getParent = function(f) return { args = {'TEST','mm','m'} } end }
</pre>

It shows:
<pre>
=p.convert{ args = {}, getParent = function(f) return { args = {'TEST','mm','m'} } end }
mw.ustring.gsub(১২৩৪৫৬৭৮৯০, '%d', to_en_table) → ১২৩৪৫৬৭৮৯০
loop string.gsub → 1234567890
<span style="color:black; background-color:orange;">[[Module talk:Convert|Conversion error]]: Value "TEST" must be a number[[Category:Convert error]]</span>
</pre>

The "mw.ustring.gsub" line shows that the input number is not translated. [[User:Johnuniq|Johnuniq]] ([[User talk:Johnuniq|আলাপ]]) ০৪:২৬, ৪ জুলাই ২০১৩ (ইউটিসি)

০৯:২৩, ৪ জুলাই ২০১৩ তারিখে সংশোধিত সংস্করণ

Demonstration of problem using mw.loadData using Module:Convert/sandbox.

  • {{#invoke:convert/sandbox|main|TEST}}স্ক্রিপ্ট ত্রুটি: ফাংশন "main" নেই।
  • {{#invoke:convert/sandbox|main|TEST|require}}স্ক্রিপ্ট ত্রুটি: ফাংশন "main" নেই।
  • {{#invoke:convert/sandbox|main|TEST|load}}স্ক্রিপ্ট ত্রুটি: ফাংশন "main" নেই।


Test 1 uses a local table (correct result).
Test 2 uses a table accessed with "require" (correct result).
Test 3 uses a table accessed with "loadData" (bug).