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

বিষয়বস্তু বিয়োগ হয়েছে বিষয়বস্তু যোগ হয়েছে
Johnuniq (আলোচনা | অবদান)
test to show a problem calling mw.ustring.gsub
Johnuniq (আলোচনা | অবদান)
tweaks
৩ নং লাইন:
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.
 
A test system is now 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. In the following tests, the argument 'TEST' logs output to the debug console.
 
*<code><nowiki>{{convert|123.4|m|mm}}</nowiki></code> → {{convert|123.4|m|mm}}
*<code><nowiki>{{convert|১২৩.৪|m|mm}}</nowiki></code> → {{convert|১২৩.৪|m|mm}}
*<code><nowiki>{{convert|TEST|m|mm}}</nowiki></code> → {{convert|TEST|m|mm}}
 
 
UsingThe 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
 
When the brute force loop is used, the second convert works. [[User:Johnuniq|Johnuniq]] ([[User talk:Johnuniq|আলাপ]]) ০৪:০৬, ৪ জুলাই ২০১৩ (ইউটিসি)
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>
 
WhenThe the"mw.ustring.gsub" bruteline forceshows loopthat isthe used,input thenumber secondis convertnot workstranslated. [[User:Johnuniq|Johnuniq]] ([[User talk:Johnuniq|আলাপ]]) ০৪:০৬২৬, ৪ জুলাই ২০১৩ (ইউটিসি)