跳转到内容

User:Johnuniq/translate

维基百科,自由的百科全书

This page is to discuss translations required for Module:Convert which could be used to implement Template:Convert. It is helpful for me to have this page as a central location for discussion, so please discuss any issues here, or add a new section.

Information on what is needed to adapt the module is available at the transwiki guide and the translate page that it links to.

Johnuniq留言) 2014年4月24日 (四) 06:51 (UTC)

Convert/text

Information is available at en:Template:Convert/Transwiki guide/translate#Convert/text. You may like to edit the convert/text module, or describe what is needed here. Johnuniq留言) 2014年4月24日 (四) 06:51 (UTC)

Numbers

It looks like zhwiki is using digits 0123456789 in numbers, with grouping and decimal mark as at enwiki. For example, 123,456,789.1234 might be a number used as input to convert, or displayed as a result. Is anything else wanted? Johnuniq留言) 2014年4月24日 (四) 06:51 (UTC)

It is fine as it is. Modern Chinese writing uses Arabic numbers and the (Western) comma separator freely in the sentence even if the sentence begins with a number. -- 同舟留言

Categories

At enwiki, one of the following error tracking categories is added to any article where invalid input is provided to the convert template:

  • Category:Convert invalid units
  • Category:Convert invalid options

However, two categories are not needed—one category is sufficient and is easier. What name should be used for one error category? Or, if two categories are wanted, what are the two names? Johnuniq留言) 2014年4月24日 (四) 06:51 (UTC)

@同舟: You defined two categories. Are you sure that is a good idea? Experience at enwiki shows that one category might be better. If you decide to use one category, use a suitable name to replace the two categories (at all_categories, the unit and option rows would have the same value). Johnuniq留言) 2014年4月25日 (五) 08:08 (UTC)

Merged. -- 同舟留言) 2014年4月25日 (五) 09:14 (UTC)
Just one question about the bug report category: Does it ignore certain namespaces like user? -- 同舟留言) 2014年5月5日 (一) 08:40 (UTC)
Yes, by default the category is only placed in articles with a convert error. It is easily configurable for other namespaces, but articles are what need to be fixed so the category is most helpful there. Johnuniq留言) 2014年5月5日 (一) 11:21 (UTC)

Ranges

Searching convert/text for "range_types" shows some text where translations are needed. If wanted, edit the module, or add the required text here (add the text on each of the following lines). Some of these may not be used. The last is rare, but can be used as in "from 1 to about 5 meters", in other words, the 5 is an approximate value. Johnuniq留言) 2014年4月24日 (四) 06:51 (UTC)

  • and = 和
  • or = 或
  • by =
  • to = 至
  • to about = 至大約
  • from = 從 (en: "from 1 to 10" / zh: "從1至10")
Need some example in English usage for "by". Also in Chinese, we have a different comma for separating a list of related items. For example, in English: "I am hungry, so I want to eat apple, orange, pear and grape". In Chinese: "I am hungry,so I want to eat apple、orange、pear和grape。" Same usage for "or/或" to replace "and/和" in this example. Also no punctuation should precede 和/或. I added "from" in case it is needed to form the range sentence, the structure is nearly identical to English. -- 同舟留言) 2014年4月25日 (五) 08:44 (UTC)

Yes, I was thinking when posting the above that it is unlikely that a word-by-word translation was appropriate. The way to decide what should be done is to consider the question of what should be displayed if a convert is copied from enwiki. Obviously, material copied from enwiki would need a lot of adjustment to work here, and the same would apply to converts. But before that adjustment is made, what should convert show? It does not have to be perfect. I have edited convert/text to insert the above (please check!), and I used the multiple multiply sign (×) for "by" as that is its meaning, and that has been done at a couple of wikis. In English, you may speak of a room that is 3 by 4 meters (3 meters length on one side, and 4 meters on the other). Many of the ranges are very rarely used, and many of them are probably not used here. Here are examples:

  • {{convert/sandbox|4|+|9|m}} → 4加9米(13加30英尺)
  • {{convert/sandbox|4|,|9|m}} → 4、9米(13、30英尺)
  • {{convert/sandbox|4|, and|9|m}} → 4和9米(13和30英尺)
  • {{convert/sandbox|4|, or|9|m}} → 4或9米(13或30英尺)
  • {{convert/sandbox|4|by|9|m}} → 4乘9米(13乘30英尺)
  • {{convert/sandbox|4|-|9|m}} → 4—9米(13—30英尺)
  • {{convert/sandbox|4|to about|9|m}} → 4至大約9米(13至大約30英尺)
  • {{convert/sandbox|4|and|9|m}} → 4和9米(13、30英尺)
  • {{convert/sandbox|4|and(-)|9|m}} → 4和9米(13—30英尺)
  • {{convert/sandbox|4|and(-)|9|m|abbr=on}} → 4和9米(13—30英尺)
  • {{convert/sandbox|4|or|9|m}} → 4或9米(13或30英尺)
  • {{convert/sandbox|4|to|9|m}} → 4至9米(13至30英尺)
  • {{convert/sandbox|4|to(-)|9|m}} → 4至9米(13—30英尺)
  • {{convert/sandbox|4|to(-)|9|m|abbr=on}} → 4至9米(13—30英尺)
  • {{convert/sandbox|4|+/-|9|m}} → 4正負9米(13 ± 30英尺)
  • {{convert/sandbox|4|+/-|9|m|abbr=out}} → 4正負9米(13 ± 30英尺)
  • {{convert/sandbox|4|x|9|m}} → 4乘9米(13英尺 × 30英尺)
  • {{convert/sandbox|4|xx|9|m}} → 4乘9米(13乘30英尺)
  • {{convert/sandbox|4|*|9|m}} → 4×9米(13×30英尺)
  • {{convert/sandbox|4|和|9|m}} → 4和9米(13、30英尺)
  • {{convert/sandbox|4|或|9|m}} → 4或9米(13或30英尺)
  • {{convert/sandbox|4|至|9|m}} → 4至9米(13至30英尺)

You may want to edit the ranges to fix the text that uses commas, although it may not be worth worrying about them because they are very unlikely to be used here. Also, perhaps some of the spaces should be removed? In November 2013, there were no converts that used ", and" at enwiki, and only a couple that used ", or". Convert has no method of putting "from" in front of the first number—it assumes that if text is wanted before the first number, it can be typed before the convert template. Let me know if there are any big problems with these examples. Johnuniq留言) 2014年4月25日 (五) 11:03 (UTC)

Directly added my mockup after the result. -- 同舟留言) 2014年4月25日 (五) 11:50 (UTC)
Why are the mockup outputs showing symbols? I thought abbr=off was the default, so unit names sh4ould appear. Johnuniq留言) 2014年4月27日 (日) 02:45 (UTC)
The mockup was added before you changed the abbr default from out to off, so these examples now work the way intended on zh.wp. The general rule of thumb is that you use punctuation in place of word when abbr is turned on.
I have an awful feeling that using the hyphen - for "and" can easily be confused with minus. But I don't have much knowledge on advanced maths. -- 同舟留言) 2014年4月27日 (日) 10:43 (UTC)
At enwiki, there are 1.6 million converts in articles. Of those, 16 use "and(-)" so we don't really have to worry about what it precisely does. There will always be a problem if text is copied from enwiki, and if an editor sees that a convert is producing an inappropriate result they will need to fix it.
An example of its use is at en:aardvark which includes
An aardvark's weight is typically between {{convert|60|and(-)|80|kg}}. →
An aardvark's weight is typically between 60和80公斤(130—180英磅).
An aardvark's weight is typically between 60和80公斤(130—180磅). [using convert/sandbox]
Johnuniq留言) 2014年4月27日 (日) 11:48 (UTC)

SI prefixes

Prefixes are used so a unit only needs to be defined once. For example, at enwiki the unit code g (gram) is defined, and that automatically allows units like kg (kilogram) and mg (milligram) to be used in conversions. A translation is needed for each symbol and name. Any blank entries will use the en symbol or name. I will add these to Module:Convert/text but will keep the original values so converts copied from enwiki continue to work. Johnuniq留言) 2014年4月24日 (四) 06:51 (UTC)

Exponent en symbol en name zh symbol zh name
24 Y yotta 堯它
21 Z zetta 澤它
18 E exa 艾可薩
15 P peta 拍它
12 T tera 太拉
9 G giga 吉咖
6 M mega 百萬
3 k kilo 千 (前綴)
2 h hecto
1 da deca
-1 d deci (dab page only. No article yet)
-2 c centi
-3 m milli
-6 µ micro
-9 n nano 納諾
-12 p pico 皮可
-15 f femto 飛母托
-18 a atto 阿托
-21 z zepto 仄普托
-24 y yocto 幺科托
The "zh symbols" can be combined with another unit to form a different scale unit. Again no space should separate between the prefix and the middle unit. -- 同舟留言) 2014年4月25日 (五) 09:12 (UTC)

Hyphenation

At enwiki, the "adj" option (adjectival) can be used to make a unit use the singular name, and to use a hyphen. An optional "mid" word can be inserted. Following are three examples showing text copied from enwiki.

  • {{convert|125|ft}} → 125 feet (38 m)
  • {{convert|125|ft|adj=on}} → 125-foot (38 m)
  • {{convert|125|ft||adj=mid|-long}} → 125-foot-long (38 m)

It is possible to configure the module to disable hyphenation. If that is done, the above would show a space where a hyphen currently appears. What is wanted?

The above is my standard wording, but I guess the answer depends on #Separators below. Johnuniq留言) 2014年4月24日 (四) 06:51 (UTC)

This function is practically redundant in Chinese language. -- 同舟留言) 2014年4月25日 (五) 09:23 (UTC)

Following are two converts copied from enwiki to show the idea. When adj=mid (middle text) is used, an output unit must be specified, even if it is empty to mean that the default should be used. If that is not done, "-long" would be interpreted as the name of output unit (see en:Help:Convert for information about these options).

  • {{convert|125|m|adj=on}} → 125-metre (410 ft)
  • {{convert|125|m||adj=mid|-long}} → 125-metre-long (410 ft)

Following shows how that appears here now that I have disabled hyphenation.

  • {{convert/sandbox|125|m}} → 125米(410英尺)
  • {{convert/sandbox|125|m|adj=on}} → 125-米(410英尺)
  • {{convert/sandbox|125|m||adj=mid|-long}} → 125-米-long(410英尺)

An editor would need to decide what to do about the "-long" in the last example. Johnuniq留言) 2014年4月25日 (五) 11:13 (UTC)

Just void the adj function for zh.wp but don't regard it as an error so it wouldn't confuse the transwiki editors. -- 同舟留言) 2014年4月28日 (一) 11:22 (UTC)
I do not understand because the module has already been configured so that adj=on is ignored. It may be better to provide examples of what is wanted. Are you referring to the {{convert/sandbox|125|m||adj=mid|-long}} example? And you are suggesting the "-long" should be omitted from the result? That does not seem like a good idea because it would change the meaning of the sentence. The "-long" is part of the text which needs to be fixed by the editor. Johnuniq留言) 2014年4月28日 (一) 11:52 (UTC)
Sorry I did mean the "-long" adj in the example. I think if the editor translates this markup from English to Chinese WP, they could be confused and wonder whether the -long adj part should be translated or removed. They could change the markup from {{convert/sandbox|125|m||adj=mid|-long}} to something like {{convert/sandbox|125|m||adj=mid|-長}}「125米-長(410英尺)」 which doesn't make sense in Chinese but they might believe this part should be translated in order to preserve the original context. Maybe you're right about this part should be fixed by the editors themselves. -- 同舟留言) 2014年4月28日 (一) 13:35 (UTC)

Messages

Examples of error and warning messages, with documentation, can be seen at en:Help:Convert messages. Each message links to a section on that page. In due course, you can copy the help page, then translate it, then edit convert/text to change the name to match the local title (search for cvt_format where the link occurs—for now, the simplest might be to insert ":en:" so it links to enwiki).

cvt_format includes "Convert:" which you may want to translate.

At all_messages, the text in the "Mouseover title text" and "Link text" columns needs to be fixed. I suggest leaving the "Anchor" text for now, but that can later be translated as well (it has to match the anchors on the en:Help:Convert messages page). Johnuniq留言) 2014年4月24日 (四) 06:51 (UTC)

Done -- 同舟留言) 2014年4月25日 (五) 09:37 (UTC)

Other

Need translation for "per" as in:

per_word = 'per', -- for units like "liters per kilometer"

customary_units are rarely used; let's forget that for now.

eng_scales are infrequent, although there are easily fixed. That involves translating names likes "billion", and possibly replacing the link. Johnuniq留言) 2014年4月24日 (四) 06:51 (UTC)

@同舟: At eng_scales, you defined a "link" item for each row. That works, but for your information, the result may have too many links (known as "overlinking" at enwiki). It depends on how familiar readers would be with the terms used. That's up to you, and I am just pointing out the effect. Here are some examples:

  • {{convert/sandbox|12.3|e3m|e6ft|abbr=off|lk=on}} → 12.3 × 103(0.040 × 106英尺
  • {{convert/sandbox|12.3|e4m|e6ft|abbr=off|lk=on}} → 12.3 × 104(0.40 × 106英尺

Johnuniq留言) 2014年4月25日 (五) 08:07 (UTC)

It's definitely overlinked. I don't feel it's necessary to link the SI prefix individually. The whole unit should be linked to the unit article itself instead of making SI prefix part link to its own article. -- 同舟留言) 2014年4月25日 (五) 09:40 (UTC)
Just a redundant reminder from me: no space separator between prefix and original unit. -- 同舟留言) 2014年4月25日 (五) 09:42 (UTC)
After some more thoughts, I want to remove some of the eng_scales because some just has no one-word-equivalence in Chinese and the larger scales (from 105 onward) confusingly represent different values in different occasions. But that would be confusing if someone transwikis the English article with such usage of Convert to Chinese Wikipedia. I want to add a new error message for this particular option which tells the editor what kinds of scale are available in the zh version and instructs them they should convert the scale and use another one should they insist. -- 同舟留言) 2014年4月25日 (五) 11:17 (UTC)
I will leave it for you to remove the "link" from the eng_scales that should not have a link if lk=on is used. For example, you might delete "link = '1000'," from the ["3"] row to prevent 千 being linked.
Engineering notation is rare and it appears there are no such units here:
The en link shows the old templates that are no longer used as they have been replaced by the modules. I do not think it is worth putting much effort into a feature that will probably not be used. Following is an example of the error that would be shown if an incorrect prefix is used (you need to hold the mouse over the error message to see the details):
  • {{convert/sandbox|12.3|e12m}} → 12.3 × 1012米(4.0×1013英尺)
  • {{convert/sandbox|12.3|e13m}} → 12.3 × 1013米(4.0×1014英尺)
The e13m is regarded as an invalid unit code, and the message links to en:Help:Convert messages#unknown_unit at enwiki. If wanted, something could be added to the text at that location to link to en:Help:Convert units#Engineering notation.
Again, the main problem to be solved is to make sure that a convert copied from enwiki displays something reasonable here. Johnuniq留言) 2014年4月25日 (五) 11:36 (UTC)
I just removed those pointless scales. -- 同舟留言) 2014年4月25日 (五) 12:00 (UTC)

Separators

Hi. I'm translating this module to Chinese Wikipedia. The current hurdle is that in Chinese writing, there should not be any white space to separate the numeral from any Chinese character or punctuation. I can't figure out how to remove this white space without touching the values of sep1/sep2 (related or not?) because the white space is still needed to separate between the number and the Western alphabetic symbol (abbr=on). Thanks for help. -- Sameboat - 同舟 (talk) 05:21, 24 April 2014 (UTC)

I am likely to be able to think of some fix, but please provide some examples of exactly what is wanted. To make it easier for me, you might like to use examples from enwiki, and we can imagine that the unit symbols and names have been translated. Then you could say what is required. Or, use examples from here if that makes more sense. I need to know exactly what the output should look like for the various options. Johnuniq留言) 2014年4月24日 (四) 06:51 (UTC)
I looked at these examples:
  • {{convert|12.3|m|ft}} → 12.3米(40英尺)
  • {{convert|12.3|m|ft|abbr=off}} → 12.3米(40英尺)
  • {{convert|12.3|m|ft|abbr=on}} → 12.3米(40英尺)
  • {{convert|12.3|hand|in}} → 12.3手距(51英寸)
  • {{convert|12.3|hand|in|abbr=off}} → 12.3手距(51英寸)
  • {{convert|12.3|hand|in|abbr=on}} → 12.3 h(51英寸)
The following appears to be the rule: when a number is followed by a unit symbol or name, the separator between the number and the following text should be a space if the text uses latin characters, but should be nothing if not latin. That is, the English characters a to z would have a space before them, but non-English would not. I'll look at what would be involved in doing that.
It also appears that you want abbr=off to be the default. The standard convert defaults to abbr=out which means that the input unit is not abbreviated and the output unit is abbreviated. That is, the name of the input unit is displayed, and the symbol of the output unit is displayed. It is easy to set the default to be abbr=off if that is what is wanted. Johnuniq留言) 2014年4月24日 (四) 09:50 (UTC)
The original Convert template acts even more unexpected... (I was not in charge of it.)
  • It's true that we prefer abbr=off by default in zh.wp.
  • The parentheses containing the converted output should always be the Asian variants () which is exactly 1em wide. (The Western parentheses () of half the width are only used in zh.wp for disambiguation qualifier and quotes entirely in non-Asian language). No space should precede or trail these parentheses whatsoever. Perhaps the thinner Western parentheses is preserved when abbr=on because all abbreviations/symbols are in Latin characters, but it only causes inconsistency of punctuations when the template is used right in the prose. So I expect these outputs for examples 3 to 6:
    • 12.3 m(40 ft)
    • 12.3 hands(51英寸)
    • 12.3 hands(51英寸)
    • 12.3 h(51 in)
Hope these help. -- 同舟留言) 2014年4月24日 (四) 12:36 (UTC)

Here are the converts above, using the module.

  • {{convert/sandbox|12.3|m|ft}} → 12.3米(40英尺)
  • {{convert/sandbox|12.3|m|ft|abbr=off}} → 12.3米(40英尺)
  • {{convert/sandbox|12.3|m|ft|abbr=on}} → 12.3米(40英尺)
  • {{convert/sandbox|12.3|hand|in}} → 12.3手距(51英寸)
  • {{convert/sandbox|12.3|hand|in|abbr=off}} → 12.3手距(51英寸)
  • {{convert/sandbox|12.3|hand|in|abbr=on}} → 12.3 h(51英寸)

Are the parentheses correct? It will take me a couple of days before I work out a good way to handle the separator. I started with a quick experiment, but much more is needed for complex cases. Consider the following:

  • {{convert/sandbox|1|yd|2|ft|6|in|in}} → 1碼2英尺6英寸(66英寸)
  • {{convert/sandbox|66|in|ydftin}} → 66英寸(1yd2英尺6英寸)
  • {{convert/sandbox|5|to|12|in|mm}} → 5至12英寸(130至300 mm)
  • {{convert/sandbox|5|x|12|x|20|in|mm}} → 5乘12乘20英寸(130 mm × 300 mm × 510 mm)

At enwiki, they wanted hand to automatically link. It is a very strange unit and is handled as a special case. Johnuniq留言) 2014年4月25日 (五) 07:53 (UTC)

My expected (mockup) results for your last examples:
  • {{convert/sandbox|1|yd|2|ft|6|in|in}} → 1碼2英尺6英寸(66英寸)
  • {{convert/sandbox|66|in|ydftin}} → 66英寸(1碼2英尺6英寸)
  • {{convert/sandbox|5|x|12|x|20|in|mm}}: This is a tricky case, because Chinese does not have the equivalence of "by" of such usage. We express it in the form of specifying which figure represents which side of the cube: 長5闊12高20英寸 (literally "length 5 width 12 height 20 in". The unit "英寸" should be more formally added after each single figure, but let's not complicate it.) It would mean new option added to the module for faithful translation into Chinese. -- 同舟留言) 2014年4月25日 (五) 09:56 (UTC)
"乘" is fine here, so it's fixed and doesn't need another function. -- 同舟留言) 2014年4月28日 (一) 11:31 (UTC)

Regarding "we prefer abbr=off by default": See my edit to Template:Convert/sandbox where I added |abbr=off default|warnings=1. The result is that a convert which does not specify abbr will assume abbr=off rather than abbr=out. Also, a convert with an invalid option will show a warning. Examples:

  • {{convert/sandbox|12.3|m}} → 12.3米(40英尺)
  • {{convert/sandbox|12.3|m|abbr=off}} → 12.3米(40英尺)
  • {{convert/sandbox|12.3|m|abbr=on}} → 12.3米(40英尺)
  • {{convert/sandbox|12.3|m|abbr=out}} → 12.3米(40英尺)
  • {{convert/sandbox|12.3|m|abbr=in}} → 12.3米(40英尺)
  • {{convert/sandbox|12.3|m|abbr=bogus}} → 12.3米(40英尺)

Johnuniq留言) 2014年4月25日 (五) 12:00 (UTC)

Is that a big issue? A wrong value is wrong and needs to be corrected, after all. -- 同舟留言) 2014年4月25日 (五) 12:07 (UTC)
The reason that abbr=in/out are not preferred on zh.wp is that that cause 1 unit in Chinese and the other in Latin character which is even more inconsistent than in en.wp. -- 同舟留言) 2014年4月25日 (五) 12:17 (UTC)
No, it's not a problem. I was just letting you know what I have done, and showing examples of the result. You will need to decide what to do about the link. A quick fix (which was done at viwiki) would be to insert ":en:" before "Help:Convert" so error messages link to the enwiki page. The proper fix would be to copy that page and translate it. Johnuniq留言) 2014年4月26日 (六) 07:53 (UTC)

Separator progress

I have started looking at fixing separators. The first issue concerns how the module should determine that sometimes a space is wanted, and sometimes it is not. The rule is that a zh name has no space before it, but an en name does. However, it is not easy for the module to determine which is which. I am wondering whether there is any simple procedure that could be used. For example, if you intend to eventually translate all the unit names, and not translate the unit symbols, the module could use the rule that there should be a space before a symbol (abbr=on), but no space before a name (abbr=off). However, it is likely that there will be exceptions, so that simple rule may not work.

A hack to guess whether a name/symbol is zh would be to measure its length (number of bytes in the UTF-8 string), then use a regular expression to delete all en characters and count the number of bytes in the result. If the ratio of the lengths is above a certain value, the module would decide that the name was zh. Or, the module could just examine the first character and guess from that—looking at the current data suggests that except for some names starting with "12美", just looking at the first character would work.

A complication is that at the place in the module where it would be easiest to decide whether to omit the space, the name/symbol may have been put in a link. In other words the text might be [[name]] or [[example|name]], and the module should work on the first character of "name". Do you have any thoughts on these points? Johnuniq留言) 2014年4月27日 (日) 04:09 (UTC)

I have made a simple and low-overhead change to convert. There will probably be some rare cases that need fixing, but I think most converts should work reasonably well.

  • {{convert/sandbox|1-5|acre|abbr=on}} → 1—5 acre(0.40—2.02 ha)
  • {{convert/sandbox|1-5|acre}} → 1—5英畝(0.40—2.02 ha)
  • {{convert/sandbox|1|acre|abbr=on}} → 1 acre(0.40 ha)
  • {{convert/sandbox|1|acre}} → 1英畝(0.40 ha)
  • {{convert/sandbox|1|angstrom|abbr=on}} → 1 Å(3.9×10−9英寸)
  • {{convert/sandbox|1|angstrom}} → 1埃(3.9×10−9英寸)
  • {{convert/sandbox|1|L/100km}} → 1公升每100公里(280 mi/imp gal;240 mi/US gal)
  • {{convert/sandbox|2|ft|abbr=on}} → 2英尺(0.61米)
  • {{convert/sandbox|2|ft}} → 2英尺(0.61米)
  • {{convert/sandbox|2-5|ft|abbr=on}} → 2—5英尺(0.61—1.52米)
  • {{convert/sandbox|2-5|ft}} → 2—5英尺(0.61—1.52米)
  • {{convert/sandbox|2.5-5|ft|ftin|abbr=on}} → 2.5—5英尺(2英尺6英寸—5英尺0英寸)
  • {{convert/sandbox|2.5-5|ft|ftin}} → 2.5—5英尺(2英尺6英寸—5英尺0英寸)
  • {{convert/sandbox|2.5|ft|ftin|abbr=on}} → 2.5英尺(2英尺6英寸)
  • {{convert/sandbox|2.5|ft|ftin}} → 2.5英尺(2英尺6英寸)
  • {{convert/sandbox|2|ft|6|in|abbr=on}} → 2英尺6英寸(0.76米)
  • {{convert/sandbox|2|ft|6|in}} → 2英尺6英寸(0.76米)
  • {{convert/sandbox|1-5|arpent|acre}} → 1—5阿潘特(0.84—4.22 acre)
  • {{convert/sandbox|1-5|arpent|acre|abbr=on}} → 1—5 arpent(0.84—4.22 acre)

Looking at the converts on this page or elsewhere, do you see anything that needs to be fixed? Johnuniq留言) 2014年4月27日 (日) 09:38 (UTC)

The example of "acre" with abbr=on still shows the Chinese name instead of using the English symbol. Could it be the wave sign before the symbol caused the makeunit to add the usename=1 for the unit? What exactly is the purpose of "usename"? -- 同舟留言) 2014年4月27日 (日) 11:11 (UTC)
Yes, the tilde (~) forces usename=1 and that means the name is used instead of the symbol. It also does some other things for compatibility with the old templates. In the old system, the conversion for a particular unit was controlled by a template specifically for that unit—there was a template for meter and another template for acre, and so on. That means the templates often did things slightly differently, and one of those was the values that were regarded as plural. I forget the exact rules, but for example, for one unit it might be that the value 1 is singular ("acre") and anything else is plural ("acres"). For another unit the rule might be that singular is any value from above 0 to 1. At any rate, those rules are irrelevant here. I don't think there would be any harm in removing all the tilde characters. Or, you could just remove them from particular units when wanted, starting with acre. Johnuniq留言) 2014年4月27日 (日) 11:51 (UTC)
The symbols use double equal sign like {{convert/sandbox|1|mpgus}} → 1英里每美制加侖(240 L/100 km;1.2 mi/imp gal) generate unit text by itself, but the separator issue is not fixed by the Unicode check apparently. I tried to add "name=(Chinese name)" in the unit row but Makeunits reports error. -- 同舟留言) 2014年4月28日 (一) 07:58 (UTC)

Not many specific SI units have an individual article in Chinese Wikipedia. Should I just remove those rows from module:Convert/documentation/conversion data/doc#Links or comment them with <!-- --> to avoid inclusion in Makeunits? -- 同舟留言) 2014年4月25日 (五) 03:29 (UTC)

Delete them. There is no need to complicate the wikitext with comments, and at any rate, makeunits performs a very simple operation when reading the page, and it has no knowledge of html comments. Johnuniq留言) 2014年4月25日 (五) 07:00 (UTC)

Conversion data

Several features of the module were developed to make it compatible with the old templates. One of those is found by searching for "symlink" in the unit definitions. If defined, the symlink specifies the link that should be used for the symbol (if abbr=on). Example:

The symlink used at enwiki is far too complicated, and you probably want to replace the symlink text, or delete it. You will see that &#124; is used in the wikitext to represent | (makeunits replaces "&#124;" with "|"). Johnuniq留言) 2014年4月27日 (日) 02:48 (UTC)

I replaced symlink with link which seemingly works. Now from your examples there is another issues that the Semicolon ; should be replaced with the Asian 1em variant ; without leading or trailing separator. -- 同舟留言) 2014年4月27日 (日) 10:36 (UTC)
OK. I will have to do a little work for that because the semicolon is currently built in. I will add an option to change it (but not right now). Johnuniq留言) 2014年4月27日 (日) 11:56 (UTC)
OK. The translation for "Conversions" and "Links" in module:Convert/documentation/conversion data/doc is basically completed. Very few old English units are left untranslated intentionally. -- 同舟留言) 2014年4月27日 (日) 13:17 (UTC)
Good. Johnuniq留言) 2014年4月28日 (一) 07:35 (UTC)

Progress

I think the semicolon customization is fixed. I took the opportunity to fix an issue that I knew was a minor problem at enwiki, namely that disp=or with an output combination did not look good. Now, instead of using a semicolon between the outputs, it uses "or". Examples:

  • {{convert/sandbox|3|ha|acre m2 sqyd}} → 3公頃(7.4 acre;30,000 m2;36,000 sq yd)
  • {{convert/sandbox|3|ha|acre m2 sqyd|disp=or}} → 3公頃或7.4英畝或30,000平方米或36,000平方碼
  • {{convert/sandbox|3|ha|acre m2 sqyd|disp=or|abbr=on}} → 3 ha或7.4 acre或30,000 m2或36,000 sq yd

Please check everything you can and let me know what problems remain. I suspect that there will be some unusual cases where an unwanted space occurs, and I might get a chance to think about that if you say what is wanted, for example, in:

  • {{convert/sandbox|1|L/100km}} → 1公升每100公里(280 mi/imp gal;240 mi/US gal)

Another issue concerns temperature. At enwiki, temperature units like °C have some special code to avoid displaying "degrees Celsius" unless really wanted. Consider:

  • {{convert/sandbox|100|C}} → 100 °C(212 °F)
  • {{convert/sandbox|100|C|abbr=off}} → 100 °C(212 °F)
  • {{convert/sandbox|100|C|abbr=on}} → 100 °C(212 °F)

At enwiki, these results occur:

  • {{convert|100|C}} → 100 °C (212 °F)
  • {{convert|100|C|abbr=off}} → 100 degrees Celsius (212 degrees Fahrenheit)
  • {{convert|100|C|abbr=on}} → 100 °C (212 °F)

I have not had a chance to look at what you put in SIprefixes in convert/text. Perhaps you could do some tests with SI units and tell me if anything is wanted. Johnuniq留言) 2014年4月28日 (一) 07:35 (UTC)

The temperature unit troubled me quite a while. In Chinese, temperature is expressed in the form of "Celsius/Fahrenheit - number - degree" (攝氏100度). With the separator fix I think it's OK to use the °C than complicating the module. -- 同舟留言) 2014年4月28日 (一) 08:12 (UTC)
New issue: There is no space between the number and °C/°F. If I add &nbsp; before °C/°F it becomes 2 consecutive white-spaces between them. -- 同舟留言) 2014年4月28日 (一) 09:10 (UTC)
I updated the module so it should keep the separator before the following (which I am fairly sure are the only enwiki units that might cause trouble):
  • {{convert/sandbox|100|C}} → 100 °C(212 °F)
  • {{convert/sandbox|100|C|abbr=on}} → 100 °C(212 °F)
  • {{convert/sandbox|100|um}} → 100微米(0.00033英尺)
  • {{convert/sandbox|100|um|abbr=on}} → 100 µ米(0.00033英尺)
  • {{convert/sandbox|100|angstrom|um}} → 100埃(0.010 µ米)
  • {{convert/sandbox|100|angstrom|um|abbr=on}} → 100 Å(0.010 µ米)
I will think about "per" units (double equals) later. Johnuniq留言) 2014年4月28日 (一) 11:09 (UTC)
These are fine. -- 同舟留言) 2014年4月28日 (一) 13:44 (UTC)

Per units

As discussed, per units (defined with double equals) are currently not correct.

  • {{convert/sandbox|12.5|kg/ha}} → 12.5公斤每公頃(11.2磅/acre) → 12.5千克每公頃(11.2英磅每英畝)
  • {{convert/sandbox|12.5|kg/ha|abbr=on}} → 12.5公斤/ha(11.2磅/acre)
  • {{convert/sandbox|12.5|yd|4|ft|6|in}} → 12.5碼4英尺6英寸(12.80米) → 12.5碼4英尺6英寸(12.80米)

What needs to be changed in these examples? Johnuniq留言) 2014年4月28日 (一) 12:02 (UTC)

No problem with the abbr part because all of them are Lain characters. As usual, no space between figure and Chinese character/punctuation. -- 同舟留言) 2014年4月28日 (一) 13:41 (UTC)

Name override request

I guess the "千克" from the kg/ha example is combined by the module automatically from "kilo" (千) and "gram" (克). While this is totally correct and natural, kilogram is more commonly known as "公斤" (metric catty) in Chinese. -- 同舟留言) 2014年4月28日 (一) 13:52 (UTC)


See my edit to the conversion data for how I fixed kg. If a unit is defined, convert will use it. It is only if a unit is not defined that convert will examine whether it might have an SI prefix requiring an automatic name. I also fixed various separator issues. See the examples above on this page, and the following:

  • {{convert/sandbox|12.5|kg/ha}} → 12.5公斤每公頃(11.2磅/acre)
  • {{convert/sandbox|1|L/100km}} → 1公升每100公里(280 mi/imp gal;240 mi/US gal)
  • {{convert/sandbox|1|L/100km|abbr=on}} → 1 L/100 km(280 mi/imp gal;240 mi/US gal)
  • {{convert/sandbox|100|$/acre}} → $100每英畝($250/ha)
  • {{convert/sandbox|100|$/acre|abbr=on}} → $100/acre($250/ha)
  • {{convert/sandbox|50|mpgus|L/100km}} → 50英里每美制加侖(4.7 L/100 km)
  • {{convert/sandbox|50|mpgus|L/100km|abbr=on}} → 50 mi/US gal(4.7 L/100 km)
  • {{convert/sandbox|2|Mach}} → 2馬赫(1,522 mph;2,450 km/h)
  • {{convert/sandbox|2|Mach|abbr=on}} → Mach 2(1,522 mph;2,450 km/h)
  • {{convert/sandbox|1-5|Mach}} → 1—5馬赫(761—3,806 mph;1,225—6,125 km/h)
  • {{convert/sandbox|1-5|Mach|abbr=on}} → Mach 1—Mach 5(761—3,806 mph;1,225—6,125 km/h)
  • {{convert/sandbox|510|mph|Mach}} → 510英里每小時(Mach 0.67)
  • {{convert/sandbox|510|mph|Mach|abbr=on}} → 510 mph(Mach 0.67)

Is there anything on this page that still requires attention? Note that the Mach examples show a minor problem in that "Mach2" with no space is not correct. I might fix that later if you can find a place in an article where it is used! (See Template:Convert/Mach: that unit is not currently used.)

Have there been any discussions with other editors about convert? Johnuniq留言) 2014年4月29日 (二) 05:53 (UTC)

After few failed attempts, I added symbol=&nbsp;km for 100km (length) to force the space before the abbr unit. Should that be done the other way?
I announced your effort at VP:technical, but doesn't seem anyone interested in participating this discussion.
You can check the Chinese article of Mach number which shows the translated unit should be placed after the figure instead of before. I don't have much knowledge of sonic science but can foresee the problem with such convention in Chinese. -- 同舟留言) 2014年4月29日 (二) 06:32 (UTC)

Name problem

Using Special:ExpandTemplates shows the following outputs from the two templates.

{{convert|1234.5|km2|sqmi}} → 1,234.5-{zh-cn:平方千米;zh-tw:平方公里;zh-hk:平方公里;}-(476.6平方英里)
{{convert/sandbox|1234.5|km2|sqmi}} → 1,234.5千平方米(476.6平方英里)

{{convert|1234.5|km2|sqmi|abbr=on}} → 1,234.5 km<sup>2</sup> (476.6 平方英里)
{{convert/sandbox|1234.5|km2|sqmi|abbr=on}} → 1,234.5 km<sup>2</sup>(476.6 sq mi)

I have never previously seen the wiki markup shown in the output, but it does something clever to show particular text to the reader depending on their preferences ("Content language variant"). Looking at the wikitext in Template:Convert/km2 shows that it includes ("n" is the unit name):

|n=-{zh-cn:平方千米;zh-tw:平方公里;zh-hk:平方公里;}-

It appears a lot more complexity might be wanted in the unit names. Also, the module outputs are different for abbr=off and abbr=on.

If the above syntax is wanted, I would have to adapt the module to recognize any name starting with "-{" (or just "-"?) as being Chinese, in addition to what it does now.

If necessary, it would be possible to write a script to extract the name definitions from each template page (I did that at enwiki), but some help might be needed to work out what is wanted. Johnuniq留言) 2014年4月29日 (二) 10:07 (UTC)

I don't think it needs extra script to deal with it as Makeunits doesn't make any error report when I include -{zh:公里;zh-cn:千米;zh-tw:公里;zh-hk:公里;}- in the name entry of conversion_data/doc. It functions correctly. You can test it by changing the "wiki" part of the zh.wp URL of this page to "zh-hant" (Traditional Chinese)/"zh-hans" (Simplified Chinese)/"zh-cn" (Mainland China Simplified)/"zh-hk" (Hong Kong Traditional)/"zh-tw" (Taiwan Traditional). After refresh, the "公里" in {{convert/sandbox|5|km}} (5公里(3.1 mi)) will be converted to "千米" automatically if you choose zh-cn or zh-hans. -- 同舟留言) 2014年4月29日 (二) 10:44 (UTC)
There is also the template:NoteTA which is added to the article if specific variant conversion is desired to override other kind of variant definition. For article with many math units, {{noteTA|G1=單位}} is added to the top of the article to provide all general name variants of math units. (List of units variants) -- 同舟留言) 2014年4月29日 (二) 10:53 (UTC)
The change to the module is minor, but I think it is needed because there is a space after the "5". I'll fix that now. Johnuniq留言) 2014年4月29日 (二) 10:59 (UTC)
I just noticed that too. The variant convertor -{ confused the string check. -- 同舟留言) 2014年4月29日 (二) 11:01 (UTC)
It should be fixed now. Apart from Mach, are there any other problems? It looks like a lot of work will be needed to get the current names. I will do that if you like: that is, I would make a list of the names in the current templates in a sandbox page. Johnuniq留言) 2014年4月29日 (二) 11:06 (UTC)
For Mach I think you can leave it as it is until someone knowledgeable to answer the question. For me it would take quite some time to get the answer by myself. There is a compromise though is to create the new "马赫/馬赫" unit code so it would just follow the number-unit format without messing up with "mach". -- 同舟留言) 2014年4月29日 (二) 11:21 (UTC)
Mach issue aside, the module is almost functionally correct. I will request testing in VP. -- 同舟留言) 2014年4月29日 (二) 11:54 (UTC)

I found a quick fix for mach:

  • {{convert/sandbox|2.5|Mach}} → 2.5馬赫(1,903.0 mph;3,062.6 km/h)
  • {{convert/sandbox|620|mph|Mach}} → 620英里每小時(Mach 0.81)
  • {{convert/sandbox|2.5|Mach|abbr=on}} → Mach 2.5(1,903.0 mph;3,062.6 km/h)
  • {{convert/sandbox|620|mph|Mach|abbr=on}} → 620 mph(Mach 0.81)
  • {{convert/sandbox|1|Mach|m/s km/h mph ft/s}} → 1馬赫(340.3 m/s;1,225 km/h;761 mph;1,116 ft/s)
  • {{convert/sandbox|1|Mach|m/s km/h mph ft/s|abbr=on}} → Mach 1(340.3 m/s;1,225 km/h;761 mph;1,116 ft/s)

Are these correct? Johnuniq留言) 2014年4月30日 (三) 02:41 (UTC)

Yes. I will inform you later if there is anything needed to be changed for the Chinese Mach format. -- 同舟留言) 2014年4月30日 (三) 02:58 (UTC)

Variant names in use

Following are the units (|u=) and names (|n=) from Template:Convert/xxx where xxx is the unit code ("cm" in the first example). These are the only cases that contain -{.


cm
|u=cm
|n=-{zh-hans:厘米; zh-tw:公分; zh-hk:厘米;}-

cm2
|u=cm<sup>2</sup>
|n=-{zh-cn:平方厘米;zh-tw:平方公分;zh-hk:平方厘米;}-

kg
|u=kg
|n=-{zh-cn:千克; zh-tw:公斤; zh-hk:公斤;}-

km
|u=km
|n=-{zh-cn:千米;zh-tw:公里;zh-hk:公里;zh-sg:公里;}-

km2
|u=km<sup>2</sup>
|n=-{zh-cn:平方千米;zh-tw:平方公里;zh-hk:平方公里;}-

m
|u=m
|n=-{zh-hans:米; zh-tw:公尺; zh-hk:米;}-

m2
|u=m<sup>2</sup>
|n=-{zh-cn:平方米;zh-tw:平方公尺;zh-hk:平方米;}-

mm
|u=mm
|n=-{zh-hans:毫米; zh-tw:公釐; zh-hk:毫米;}-

mm2
|u=mm<sup>2</sup>
|n=-{zh-cn:平方毫米;zh-tw:平方公厘;zh-hk:平方毫米;}-

Johnuniq留言) 2014年4月29日 (二) 12:16 (UTC)

All of these have been taken care in my last update of conversion data. -- 同舟留言) 2014年4月29日 (二) 12:35 (UTC)

Comparison

I have put a comparison of the current template with the module at User:Johnuniq/sandbox. The module detects invalid inputs and displays a warning message. Hold the mouse over the message to see more information. Most of the errors are invalid options like using "link=on" instead of "lk=on".

The following units need to be defined (probably just as aliases):

A new area unit with unit code "mu" is needed:

  • symbol = mu
  • name = 亩
  • link = 亩
  • default output = ha
  • scale = 2000/3

I don't know the purpose of units .C and .F but they seem to have a problem because no output unit is shown:

  • {{convert|100|.C}} → 100 °C(212 °F)
  • {{convert|212|.F}} → 212 °F(100 °C)
  • {{convert|100|.C|lk=on}} → 100 °C(212 °F
  • {{convert|212|.F|lk=on}} → 212 °F(100 °C

Perhaps just edit articles to remove these units, or define aliases .C = C and .F = F.

Actually, the standard temperature units seem to have the same problem:

  • {{convert|100|C}} → 100 °C(212 °F)
  • {{convert|212|F}} → 212 °F(100 °C)
  • {{convert|100|C|lk=on}} → 100 °C(212 °F
  • {{convert|212|F|lk=on}} → 212 °F(100 °C
  • {{convert|100|°C}} → 100 °C(212 °F)
  • {{convert|212|°F}} → 212 °F(100 °C)
  • {{convert|100|°C|lk=on}} → 100 °C(212 °F
  • {{convert|212|°F|lk=on}} → 212 °F(100 °C

Johnuniq留言) 2014年4月30日 (三) 10:09 (UTC)

I added .C and .F but that doesn't work, no error report from Makeunits though. I guess the initial dot is causing trouble for the module. -- 同舟留言) 2014年4月30日 (三) 14:04 (UTC)
A lot more than .C and .F were broken! All the temperature units and the fuel efficiency units, and some other stuff stopped working because makeunits has to know which units have special properties. Makeunits uses convert/text to get the specials table in translation_table for that purpose. The problem was that you translated all the unit types, but the specials table was not translated. I have fixed that. You might like to check the edits that I recently performed.
  • {{convert/sandbox|100|C}} → 100 °C(212 °F)
  • {{convert/sandbox|212|F}} → 212 °F(100 °C)
  • {{convert/sandbox|100|.C}} → 100 °C(212 °F)
  • {{convert/sandbox|212|.F}} → 212 °F(100 °C)
Johnuniq留言) 2014年5月1日 (四) 07:53 (UTC)

Messages

To display better error messages, the category page should be defined and the link to the error messages page should be fixed.

Johnuniq留言) 2014年4月30日 (三) 10:05 (UTC)

Chinese metric units combination bug

The Chinese combination of cm2/km2/mm2/cm3/km3/mm3 generated by the module are wrong because in Chinese the unit name is constructed by "square/cubic(平方/立方)-SI prefix(厘/千/毫)-middle unit(米)", so:

  • {{convert/sandbox|1|cm2|m2}} > 1平方厘米(0.00010 m2) > 1平方厘米
  • {{convert/sandbox|1|km2|m2}} > 1平方公里(1,000,000 m2) > 1平方千米 or 1平方公里
  • {{convert/sandbox|1|mm2|m2}} > 1平方毫米(1.0×10−6 m2) > 1平方毫米
  • {{convert/sandbox|1|nm2|m2}} > 1平方納米(1.0×10−18 m2) > 1平方納米
  • {{convert/sandbox|1|cm3|m3}} > 1立方厘米(1.0×10−6 m3) > 1立方厘米
  • {{convert/sandbox|1|km3|m3}} > 1立方公里(1.0×109 m3) > 1立方千米 or 1立方公里
  • {{convert/sandbox|1|nm3|m3}} > 1立方納米(1.0×10−27 m3) > 1立方納米

-- 同舟留言) 2014年4月30日 (三) 12:41 (UTC)

I fixed m2 and m3 by inserting "%s" where the SI prefix is required. The module puts the SI prefix at the beginning of the name by default, but can be told to put the prefix at another position using "%s". The only units requiring that at enwiki are m2 and m3. There is a little information about that at the enwiki documentation page which is linked at the top of the master list of units. However, the information is hard to find. Johnuniq留言) 2014年5月1日 (四) 07:57 (UTC)
It's fixed, although I still have to add overrides for Chinese variants. -- 同舟留言) 2014年5月1日 (四) 08:30 (UTC)

Parameters of the original Convert/3 and /4

User:Cwek is testing the new convert module as well. You can check his testing page which demonstrates some obscure options from {{convert/3}} like "rarely", "almost" and the sentence option similar to the additional text after the adj option from {{convert/4}}. I'm not sure if these are actually useful

-- 同舟留言) 2014年5月1日 (四) 08:30 (UTC)

I briefly mentioned at User:Johnuniq/sandbox#More converts that "convert/3 allows any text whereas the module requires that known range symbols are used". At enwiki, a handful of articles ([1]) still use convert/3 because of that ability (whereas there are 1.6 million converts in articles). I have some long-term plans that might allow the module to do something similar, but that is not going to happen this year. I have already declined to do something like convert/3 because I think it expects too much from an editor—in practice there is only one editor at enwiki who uses convert/3. Another way to look at the issue is that the module does not guarantee to solve all problems, but comparing the old templates with the module shows that the module has far fewer problems. My sandbox shows about 50 errors from the current template, and those errors are currently in articles (and the sandbox is based on about 20% of all converts used here, so there may be something like 250 errors in total).
Has there been any discussion about my sandbox page? The tests by Cwek are good, but in addition it would be very useful to examine the results from my test. Johnuniq留言) 2014年5月1日 (四) 12:25 (UTC)
Convert/3/4 don't really bother me either. Convert/3 is only used in zh.wp in the fashion of {{convert/3|#|x|#|x|#|unit}} and Convert/4 is literally unused. So how will you deal with the remnant parameters of the original Convert template like abbrv/abbrev/avbbr/precision/unit/inabbr, or just let the editor or bot remove them?
I announced our discussion here in VP trice. Since no one else is joining us, I don't expect anyone else would notice your sandbox. I guess Cwek might be interested if I tell him directly. -- 同舟留言) 2014年5月1日 (四) 13:17 (UTC)
Please post at VP and inform Cwek that it would be best to have a look at that page now because if the convert template is switched to use the module, it will not be so easy to compare the results from the old templates and the module. At enwiki, en:Template:Convert/old was created to allow that comparison, but I do not know if there would be complications from trying to do something similar here. Obviously the sandbox is too long to study everything, but even skimming the page should give an indication as to whether the module is satisfactory. I can see that you have done a tremendous amount of work on localization, and you are not getting much assistance. However, it is still important to give people the opportunity to look at the comparison—it's fine if there is no response because that indicates there is no objection.
Regarding the warning messages shown towards the bottom of the convert comparison page, I think the articles should be corrected (link=on should lk=on, abbrev=off should be abbr=off although that can now be omitted, etc). There will be a couple of hundred such warnings in the tracking category, and it's likely that they would all be fixed within a month. After that, there should be only a small number of problems. It is better if people see a consistent set of options, so "lk=on" is always used for link on, rather than also allowing "link=on" because creating choices also creates confusion. If the warnings really are a problem, they can be disabled by removing "|warnings=1" from Template:Convert/sandbox. However, the result would be that "link=on" would be ignored, which is what the old templates are doing.
By the way, the reason the sandbox takes a long time to display is that the old convert template is much slower than the module. The page would still be slow with that many converts using the module, but not that slow. Johnuniq留言) 2014年5月2日 (五) 00:17 (UTC)
I created template:convert/old in preparation of the replacement with the lua module. You may use this one in case template:convert is replaced. -- 同舟留言) 2014年5月2日 (五) 02:01 (UTC)

Negative exponents

Sorry for asking you something not entirely related to the module. I was too lazy to count the zero when adding micro/nano/pico/femto/atto/zepto/yocto-metre overrides due to Chinese name variant issue, so I used negative exponent in the scale entry. The strange thing is that the actual result is 1 power higher than I set in the data module. For example, if I define 10e-9 for nanometre, the actual rendering result will be 1.0×10-8. Eventually I reduced all negative power by 1 to get the desirable result. Is it normal or something amiss? -- 同舟留言) 2014年5月1日 (四) 16:42 (UTC)

Are you aware that 1e-9 is 1×10−9, so 10e-9 is 1×10−8? The scale for mm3 should be 1e-9 (which is the same as 10e-10, but the latter is a bit confusing). I'm happy to discuss anything, so ask whatever you like. Johnuniq留言) 2014年5月2日 (五) 00:34 (UTC)
No, I wasn't. I didn't bother with exponent notation of 10 until I am messing around with the Convert module here XD. But your explanation cleared things for me finally. -- 同舟留言) 2014年5月2日 (五) 01:18 (UTC)

More translations

Some unit codes are ambiguous and give an error if used. Examples (hold mouse over message to see further information):

The text comes from the following unit definitions.

Unit code "Should be" message
mpg !Use %{mpgus%} for miles per US gallon or %{mpgimp%} for miles per imperial gallon (not %{mpg%})
gallon !Use %{USgal%} for US gallons or %{impgal%} for imperial gallons (not %{gallon%})
gallons !Use %{USgal%} for US gallons or %{impgal%} for imperial gallons (not %{gallons%})
pt !Use %{USpt%} for US pints or %{imppt%} for imperial pints (not %{pt%})
qt !Use %{USqt%} for US quarts or %{impqt%} for imperial quarts (not %{qt%})

You could simply delete these definitions, then a convert using mpg would get an "unknown unit" error. Or, you could translate them. The codes are replaced:

  • %{ → "
  • %} → "

The replacement is controlled by unitcode_replace in Module:Convert/text. See vi:Module:Convert/text for an example where they used a different quote character. The %{ and %} are not needed, and you could just remove them if wanted.

The messages end up in a "shouldbe" field in Module:Convert/data.

If wanted, you could also translate the section names used at Module:Convert/documentation/conversion data/doc. If you do that, makeunits needs to be told the new names. It might be simplest if you add the wanted names here, and I'll fix it (it would be easier for me to do it than explain how).

  • Conversions → 換算
  • Input multiples → 多重輸入單位
  • Output multiples → 多重輸出單位
  • Combinations → 組合單位
  • Defaults → 預設輸出單位
  • Links → 單位鏈接
  • Overrides → 覆蓋單位

Or, say if you prefer to not change these. Johnuniq留言) 2014年5月2日 (五) 01:22 (UTC)

I only translated the unit section name because that unit category name will appear in the popup error message. Since the section names are irrelevant to the appearance in the actual article, I will just leave them be, unless you say they ARE relevant. -- 同舟留言) 2014年5月2日 (五) 01:41 (UTC)
There is no problem leaving the section names as they are—they have no influence on what appears in articles. However, the page is quite useful as the ultimate documentation for what units are available, with details. Therefore, it may be appropriate to direct general editors to that page, and you may prefer to translate all the English text. Of course all that can be done later if wanted. Johnuniq留言) 2014年5月2日 (五) 03:54 (UTC)
Translation provided. -- 同舟留言) 2014年5月2日 (五) 13:07 (UTC)
OK, I've included them. Johnuniq留言) 2014年5月3日 (六) 00:50 (UTC)

Tests

It is useful to have a system to verify that convert works satisfactorily after changes to the modules. In fact it is possible to run the tests before saving a change. See the following (the tester module is listed for completeness, but there is no need to see that page).

Johnuniq留言) 2014年5月3日 (六) 07:21 (UTC)

lk issue

The lk parameter created unexpected results like separator between number and Chinese unit and untranslated part of the unit like imperial (英制) and US (美制) whcih doesn't happen when it is turned off or abbr is on.

{{convert/sandbox|1|mpgus|lk=on}} -> 1英里每美制加侖(240 L/100 km;1.2 mi/imp gal
{{convert/sandbox|1|mpgus}} -> 1英里每美制加侖(240 L/100 km;1.2 mi/imp gal)
{{convert/sandbox|1|mpgus|lk=on|abbr=on}} -> 1 mi/US gal(240 L/100 km;1.2 mi/imp gal
{{convert/sandbox|1|impgal/mi|lk=on}} -> 1imperial 英制加侖英里(2.8 l/km;1.2 US gal/mi)
{{convert/sandbox|1|impgal/mi}} -> 1英制加侖每英里(2.8 l/km;1.2 US gal/mi)
{{convert/sandbox|1|impgal/mi|lk=on|abbr=on}} -> 1 imp gal/mi(2.8 l/km;1.2 US gal/mi)

--同舟留言) 2014年5月3日 (六) 09:10 (UTC)

In general, links work fine (I tested them). That particular unit is failing because it is a "per" unit (defined with double equals) and has a link defined. That causes the program to miss my new omitsep stuff to omit the separator. I'll fix it later (soon, but not now). Testing is useful! Johnuniq留言) 2014年5月3日 (六) 11:39 (UTC)

Fixed:

There are currently four fails at User talk:Johnuniq/tests (search for "Fail" to find them). These are all expected, and the tests should be updated in due course to include the correct results. Johnuniq留言) 2014年5月4日 (日) 04:53 (UTC)

I tried to edit your User:Johnuniq/tests but that doesn't turn out as expected. Maybe I shouldn't edit someone's testing page.... -- 同舟留言) 2014年5月4日 (日) 08:08 (UTC)
Please edit it as much as you want. You could take a copy if you like, but it would probably be better to just work on the tests page that I set up. It is hard to generate the "expected" text, and the easiest is to use the makeunits page mentioned at the top. You have to purge the makeunits page, then paste its results between the pre tags on the tests page. Any amount of whitespace after each template is allowed. The important point is to check the diff when you update the tests page to make sure that the new expected results really are what is wanted. Johnuniq留言) 2014年5月4日 (日) 09:10 (UTC)
I edited that test page manually before knowing that I could just copy the codes from your makeunit page like with the Convert/data module XD. -- 同舟留言) 2014年5月4日 (日) 12:54 (UTC)

Update October 2014

@同舟: Re our discussion at my enwiki talk, I have almost finished checking the simple change required. However, there is one issue. I'm posting here to show what happens using the convert currently in use at zhwiki. The following are the only cases where disp=/ is used in articles (see M224迫擊砲 for examples):

  • {{convert|300|m|ft|abbr=on|disp=/}} → 300米或980英尺*
  • {{convert|75|cm|disp=/}} → 75厘米或30英寸*
  • {{convert|14.4|lb|kg|disp=/}} → 14.4英磅或6.5公斤*
  • {{convert|15.2|lb|kg|disp=/}} → 15.2英磅或6.9公斤*
  • {{convert|3.6|lb|kg|disp=/}} → 3.6英磅或1.6公斤*
  • {{convert|2.5|lb|kg|disp=/}} → 2.5英磅或1.1公斤*

Note that there is no space around the slash in the output. There is some tricky code which decides whether the slash should be displayed as " / " or "&nbsp;/ " or "/". The reason "/" is being used in the above is that the "|abbr=off default" in Template:Convert is confusing the current convert module. When I fix that, the above will use "&nbsp;/ " instead.

My guess is that you would prefer "/" to always be used? Never " / " or "&nbsp;/ "? That would be simple to achieve, because the text is defined in Module:Convert/text (search for disp_joins). What is wanted? Johnuniq留言) 2014年10月8日 (三) 06:22 (UTC)

We would use the Chinese slash /or\ which is effectively wider than the western slashes / \ so no need for leading or trailing space. -- 同舟留言) 2014年10月8日 (三) 07:17 (UTC)
I've finished and have updated the modules. Should all be working now. You might like to check M224迫擊砲 for disp=/ and 依半衰期排列的放射性同位素列表 for disp=table. Let me know if any problems! Johnuniq留言) 2014年10月8日 (三) 09:07 (UTC)