User:Johnuniq/translate

This page is to discuss translations required for Module:Convert as used to implement fa:Template:Convert.

Links
The following should be at fa:User:Johnuniq but I can't get a reasonable result, even with LTR marks at various places.


 * fa:Template:Convert • Template that invokes the module.
 * fa:Module:Convert • Module doing the work for unit conversion.
 * fa:Module:Convert/text • Output text and input parameters.
 * fa:Module:Convert/data • Definitions of units.
 * fa:Module:Convert/extra • Extra units temporarily added without using makeunits.
 * fa:Module:Convert/makeunits • Create wikitext to be pasted into Module:Convert/data from conversion data.
 * fa:Module:Convert/documentation/conversion data/توضیحات • Master list of units.
 * en:Help:Convert • Usage documentation.
 * fa:Help:Convert messages • If a convert gives an error, the message links to this page (should be copied/translated from en:Help:Convert messages
 * fa:Category:یکای نادرست الگوی تبدیل • Articles with an invalid unit in a convert are listed here.
 * fa:Category:گزینه نادرست الگوی تبدیل • Articles with an invalid option in a convert are listed here.
 * fa:Special:PrefixIndex/User:Johnuniq • Current user pages.
 * fa:Special:PrefixIndex/Module:Convert • Current module pages.
 * User talk:Yamaha5 • Discussion with fawiki editor.

Sandbox
I put updated code in the following sandbox pages, but could not make it work. When I tried to paste tests using the sandbox template into an edit window, the wikitext broke. If wanted, these pages could be deleted as far as I am concerned.
 * fa:Template:Convert/صفحه تمرین
 * fa:Module:Convert/صفحه تمرین
 * fa:Module:Convert/text/صفحه تمرین
 * fa:Module:Convert/data/صفحه تمرین

I put the new code in the main modules, and I made a new template (because the main template is protected), and I made a short test page.
 * fa:Template:Convertlua • New template that should be used to replace fa:Template:Convert.
 * fa:User:Johnuniq/صفحه تمرین • Some tests.

As an example, the second line on the test page has the wikitext shown on the left, and the output shown on the right (although it is slightly broken here; see the fawiki page for how it appears there). The unit definitions need to be fixed, but apart from that I think this is correct.
 * → ۱٬۲۳۰٫۴۵۶۷۸۹ متر (۱٬۲۳۰٬۴۵۶٫۷۸۹۰ mm)

Updated modules
I updated fa:Module:Convert and fa:Module:Convert/text. Please check the diff although it won't make much sense because it's a big change—fawiki may as well have the current version of the code which is in use at a couple of wikis, but which I have not yet uploaded to enwiki. For Module:Convert, I think the only change you did was to add the ToENconvert function—I replaced that with the procedure built-in to the module (although I had to enhance that to properly deal with the Unicode characters). A couple of other tweaks made were to adjust per_word and plural_suffix—I reverted that and put the required text in convert/text.

The diffs in convert/text are much easier to follow. I added the translation_table and did some adjustments to the aliases for ranges, and added tables to translate digits.

I also updated fa:Module:Convert/makeunits because that has had some massive changes recently to make translations of error messages easier, and to remove some assumptions regarding how SI prefixes work.

'''The new convert module may not work with the convert template currently being used. That template needs to be edited as at above.'''

Error messages
Convert can display a variety of error messages as outlined at Help:Convert messages, which includes examples. It was decided that the messages should be rather subtle to not unduly disrupt the article for readers. Editors who want to fix errors use the tracking category to find articles with a problem, then search that page for "convert" (or "convert:" if the page happens to contain a lot of text saying "convert"). Hovering the mouse over the error message shows more detail. For example, if "xyz" is used as an input number to a convert, the following message appears:
 * [convert: invalid number ]
 * [convert: invalid number ]

The second of the above has been edited to link to a non-existent page to show that the pop-up message still occurs.

There is currently an error at fa:کریم‌نگر, but something is blocking the pop-up message (no message is shown on mouseover). Why? If there is no easy workaround, the format of the error message could be changed so that it does not rely on mouseover. Ideas?

Unit names
Units are defined in a human-friendly table which can be at any page. At enwiki, these pages are used:
 * Module:Convert/documentation/conversion data/doc • Master list of units.
 * Module:Convert/makeunits • Program: input = master list of units; output = wikitext to be pasted into Module:Convert/data.

The program is run by clicking "purge" at Module talk:Convert/makeunits. That talk page contains:

Here are examples of pages with translations:
 * ilo:Module:Pagbaliwen/dokumentasion/pangibaliw a datos/dok • master list (most names translated)
 * ilo:Module talk:Pagbaliwen/makeunits • makeunits output
 * sl:Module:Convert/documentation/conversion data/dok • master list (only the names used have been translated)
 * sl:Module talk:Convert/makeunits • makeunits output

It looks like there is no master list of units at fawiki. Do you want to construct one? It might be possible to generate most of it from the names that have been translated. Redundant information can be omitted from the master list. For example, if a unit has the same singular and plural name, the plural name can be omitted. Also, I imagine fawiki has no use for US units names, so they can all be blank. You do not have to omit redundant information—makeunits will omit anything it thinks is not needed.

Before makeunits can be successfully used, Module:Convert/text has to be correctly configured. For example, makeunits learns whether plurals are formed by appending "s" (the default) from that module. I have fixed Module:Convert/text so it is ready for use.

Unit aliases
You probably want to keep the existing en units so that if an article is copied from enwiki in the future, any converts that it contains will work. It's easy to add aliases for units so translated names can be used in converts, where wanted. For example, enwiki length units defines unit "mi" (mile)—the first column is "Unit code", and looking down that for "mi" shows a row with the complete definition of a mile. Scrolling down to the end of the Length section shows a row consisting of two columns saying "mile =mi". That defines an alias—if the unit "mile" is encountered in a convert, "mi" will be used. Therefore, to define an fa unit for mile, you would add a row with whatever is wanted in the first column and "=mi" in the second column.

I noticed a convert error at fa:کاستریس (check my edit at that page!). Someone had probably used a script to replace all the en digits, but that changed "km2" (square kilometers) to "km۲". You could define an alias for that: "m۲ =m2".

Discussion
Please put comments/questions/answers here, or in a new section. Johnuniq (talk) 05:14, 29 March 2014 (UTC)
 * please take a look on User_talk:Yamaha5 Yamaha5 (talk) 20:21, 31 March 2014 (UTC)

Abbreviations off
Per request from User:ZxxZxxZ, the module now accepts " " or " " in Template:Convert. The first line following shows what is in fa:Template:Convert now. The second and third lines show two alternatives.

Johnuniq (talk) 05:55, 1 April 2014 (UTC) Thank you now it is ok (test case) Yamaha5 (talk) 22:18, 2 April 2014 (UTC)
 * Using "off default" means that every convert will default to, but if   or   or   is used in a convert, the specified setting will be followed.
 * Using "off always" means that every convert will use  regardless of options in a convert.

bug
In fa:الگو:Convert2/test_case2, why it shows character � ? I checked fa:پودمان:Convert/data and it doesn't have this character! It is appeared after you changed the code for km۲ Yamaha5 (talk) 22:16, 2 April 2014 (UTC)
 * I noticed that and hoped that it was a glitch in my software. I haven't looked now, but when I saw it the problem occured at the ZWNJ character, and I assumed that my software has no way of handling that. I have to go elsewhere for a while, but will have a look later. Johnuniq (talk) 06:03, 3 April 2014 (UTC)

I've looked at that, and there is a simple explanation. As explained and as mentioned in the comments in the module, people are not supposed to edit convert/data. The data is supposed to be generated by running makeunits, and that program generates the correct data from the unit definitions. At enwiki, there are two units (m2 = square meter and m3 = cubic meter) which require  values that specify where an SI prefix is to be inserted (SI units with no   assume the prefix should be inserted before the unit, which is position = 1). fa:Module:Convert/data had this data: To construct the name for km2 the module inserts the name for "kilo" before byte position 8 in the name for "m2". That gave broken Unicode, which resulted in the � replacement character. I guess that fawiki needs the SI prefix inserted before the m2 and m3 units, so I edited the data to remove. Then I purged your tests page, and I think it is showing the correct result. Please let me know if it is OK! Johnuniq (talk) 10:28, 3 April 2014 (UTC)
 * m2  = "مترمربع",   = 8
 * m3  = "متر مکعب",   = 7
 * thank you that is ok! should I remove every  from the fa:پودمان:Convert/data? Yamaha5 (talk) 10:09, 7 April 2014 (UTC)
 * I removed all the  (there were only two, square meter and cubic meter). Johnuniq (talk) 11:27, 7 April 2014 (UTC)

convert: unknown unit
where can i translate convert: unknown unit ? Yamaha5 (talk) 22:20, 2 April 2014 (UTC)
 * fa:Module:Convert/text has all the output messages. Search that page for "unknown unit" to see that it is in the all_messages table. You may want to also translate the cvt_format line, although you can leave that for later if wanted. I am preparing some documentation which I'll post in a day or two, and I will let you know when it is done. See above for a related issue. If you do not want to translate Help:Convert messages soon, you might change "Help" to ":en:Help" so the link at least goes to a working page, even if it is the wrong language. When translating messages, I suggest changing only text in the "Mouseover title text" and "Link text" columns. If text in the "Anchor" column is changed, the anchors used on the Help:Convert_messages page would need to be changed to match. Johnuniq (talk) 05:58, 3 April 2014 (UTC)

I have created the documentation that I mentioned. Please see Template:Convert/Transwiki guide which links to a new "translate" page with more information. Johnuniq (talk) 03:46, 4 April 2014 (UTC)

Must be number error
fa:کاربر:Yamaha5/صفحه تمرین shows wrong error! it should be OK Yamaha5 (talk) 10:34, 7 April 2014 (UTC)
 * That is an ugly problem that needs work. In brief, the problem is that convert is configured with knowledge of numbers for the local language, and it can handle group separators and decimal mark in the local language. However, it does not try to account for the fact that people copy converts from enwiki—converts that may contain English numbers like "1,234.5". Such a number gives an error because the module configured for fawiki has no knowledge that it should remove commas.
 * At viwiki, mxn added a  function (see vi:Module:Convert and archive). I have looked at it, but haven't yet decided what to do. My current plan is to get a couple more wikis to use the modules reasonably successfully because I usually find something extra is needed at each wiki. When that is somewhat stable, the next thing on my to-do list is to decide about decimalPoint.
 * I guess I should just add a kludge to the fawiki convert so it removes commas. That would fix the immediate problem. Johnuniq (talk) 11:27, 7 April 2014 (UTC)
 * OK, I added the kludge. I forgot to add in my edit summary that I have recently done some more tweaks to the module, and I included them in what I saved. It is unlikely that you will notice any effect from those changes, but it will remove commas from input numbers. Johnuniq (talk) 11:44, 7 April 2014 (UTC)