Přeskočit na obsah

Wikipedista:Johnuniq/translate

Z Wikipedie, otevřené encyklopedie

The core convert pages are:

Done[editovat | editovat zdroj]

The module has been configured to use "," as the decimal mark instead of ".", and " " as the thousands separator. The module is not able to group digits after the decimal mark. Examples:

  • {{convert|1234|m|m|abbr=on}} → 1 234 m (1 234 m)
  • {{convert|12345678,12345|m|m|abbr=on}} → 12 345 678,12345 m (12 345 678,12345 m)
  • {{převod|12345678,12345|m|m|abbr=on}} → 12 345 678,12345 m (12 345 678,12345 m)

The module has been configured to not add "s" to make plural names. Examples:

  • {{convert|1|kn|km/h|abbr=off}} → 1 uzel (1,9 kilometres per hour)
  • {{convert|2|kn|km/h|abbr=off}} → 2 uzlů (3,7 kilometres per hour)

The module has been configured to use "na" as the per word. Example:

  • {{convert|12,5|l/km|mpgus|abbr=off}} → 12,5 litre na kilometre (0,188 mil na US gallon)

That won't be useful until the relevant unit names have been translated.

Some units have "per" built-in to the name; "na" will only occur with units that are defined as one unit per another:

  • {{convert|12|g/L|lb/cuft|abbr=off}} → 12 grams per litre (0,75 pounds per cubic foot)

If a different word for per is needed with some units, they can be defined to include that word. Johnuniq (diskuse) 20. 8. 2014, 07:51 (UTC)

Number problems[editovat | editovat zdroj]

Because the module uses "," as the decimal mark, it expects a comma to represent the decimal point in input numbers. There is some code that can detect likely input errors, but I would have to do some checking to remind myself how it works. Examples:

  • {{convert|1.23|m|mm|abbr=on}} → 1,23 m (1 230 mm)
  • {{convert|1,23|m|mm|abbr=on}} → 1,23 m (1 230 mm)
  • {{convert|1,234,567|mm|m|abbr=on}}[convert: %s]%s

This is just something to be aware of because converts copied from enwiki are likely to break. Johnuniq (diskuse) 20. 8. 2014, 07:51 (UTC)

Convert/text[editovat | editovat zdroj]

Convert/text needs lots of translations, but not everything is needed because there will be many features that are not used here. Getting everything correct would take a lot of effort, so one approach would be to do the minimum and fix issues only when and if they become used in the future.

It is common for wikitext to be copied from an enwiki article for local use, and any converts in that should continue to work. That means the English options should be retained. For example, "|abbr=on" should always work here, although you may want to add a local equivalent. It would be best to ask me to do the first couple of changes like that—it's easy after you know how. The point is that any changes made to the module should be done in a way that allows any copied wikitext to continue working.

Eventually you would want unit names to be translated. Meanwhile, what should happen with m which gives "metre" by default, or "meter" if option "|sp=us" is used? The module can be configured to always use US spelling. Is that wanted?

  • {{convert|12|km|mi|abbr=off}} → 12 kilometre (7,5 mil)
  • {{convert|12|km|mi|abbr=off|sp=us}} → 12 kilometer (7,5 mil)

A convert containing a syntax error displays a message. At enwiki, it was decided that the message should be unobtrusive, so the details only appear in a pop-up window when the mouse is held over the error. The following shows an error because it is not possible to convert meters to kilograms:

If an error occurs on an article (main namespace), a tracking category is added. Currently that is:

Please decide what name should be used here and either edit the module or tell me the wanted name so I can edit it. The category page should be created as a hidden category—see en:Category:Convert invalid options for an example (for historical reasons, enwiki uses two categories although one would be better).

The message links to a page with further information. A quick fix would be to insert ":en:" in the link so it points to en:Help:Convert messages. Later, that page can be copied to here and translated, and the link updated.

What should happen if "|adj=on" is used? At enwiki that is "adjectival" which changes something like ("a 120 meters bridge" to "a 120-meter bridge"). That is, the option inserts a hyphen and uses the singular unit name. I assume no hyphen is wanted here, so it should be disabled?

In Czech the adjectival forms are "120metrový" (it seems that the #Custom unit spelling workaround will have to be used here again) and "120m", i.e. both without space. Petr Matas 21. 8. 2014, 16:46 (UTC)

The SI prefixes ("kilo" and so on) should be fixed. Search the page for "SIprefixes" to see the list. I need to know the symbol ("k") and the name ("kilo") that is wanted here, or just edit the module.

Please treat this like a talk page and add answers below. I will notice any responses in the next couple of days, but if I fail to respond, you might put a reminder on my talk page so I get an email. Johnuniq (diskuse) 20. 8. 2014, 07:51 (UTC)

Two plural forms[editovat | editovat zdroj]

Czech language has two plural forms:

  • Singular: 1 metr, 1 kandela
  • Plurals:
    • 2 metry, 2 kandely (for values 2, 3, 4)
    • 5 metrů, 5 kandel (for other values)

Can Convert handle this? I mean an additional column in the source tables, not automatic addition of suffixes, because they are different for each unit. Petr Matas 20. 8. 2014, 07:08 (UTC)

Yes, convert has a "variable names" feature that (I think) can handle this. See sl:User:Johnuniq/translate#Results and the preceding discussions ("convert/peskovnik" refers to "Template:convert/sandbox" which was used for testing there). Have a look at that page and see if it appears to be doing what you need. The unit definitions are at sl:Modul:Convert/documentation/conversion data/dok#Variable names. Johnuniq (diskuse) 20. 8. 2014, 08:03 (UTC)

Custom unit spelling[editovat | editovat zdroj]

Czech has a bit complicated declension. Is it possible to specify a custom unit spelling in the template invocation, like in "po 50 metrech uvidíte..." ("after 50 metres you will see...") instead of "po 50 metrů uvidíte..."? Petr Matas 20. 8. 2014, 07:08 (UTC)

No, there is no facility for that. The workaround would be the following:
  • po 50 metrech ({{convert|50|m|disp=out}}) uvidíte... → po 50 metrech (160 ft) uvidíte...
  • po 50 metrech ({{convert|50|m|disp=number}} whatever) uvidíte... → po 50 metrech (160 whatever) uvidíte...
The options like "disp=out" can be localized easily. Johnuniq (diskuse) 20. 8. 2014, 10:31 (UTC)