Jump to content

Agar-aramat:Johnuniq/translate

Manipud iti Wikipedia, ti nawaya nga ensiklopedia

This page is to discuss any modifications required to adapt the convert template/module for use here; see the links on my user page. Johnuniq (tungtungan) 03:48, 13 Marso 2014 (UTC)

The following should be in convert/text: per_word, plural_suffix.

It's probably not worthwhile translating the bug messages because they should never occur (I believe they have never been seen). If a bug message were to be displayed, a user would not be able to do anything even if they could read the text—a developer would need to be contacted. It would be better to have the convert module have the minimum number of changes so future updates can occur with little effort. The only change needed here is to handle the local module names. Johnuniq (tungtungan) 11:28, 13 Marso 2014 (UTC)

Convert/text

[urnosen | urnosen ti taudan]

This looks good! If wanted, it is possible to add options so the local language can be used in converts. I can explain that if wanted.

If you say options to use local language, did you mean convert to accept both en and ilo parameters? That would be great if you could show me how to do this. --Lam-ang(Makipatang) 18:09, 15 Marso 2014 (UTC)

I think English digits are wanted for numbers, and large values are grouped in threes using commas, for example 123,456,789.12. Let me know if anything else is preferred.

Yes English digits are preferred.--Lam-ang(Makipatang) 18:09, 15 Marso 2014 (UTC)

I have some extra material to add to the module. Can the protection be temporarily removed? How about removing full protection from all the modules for a couple of weeks? Johnuniq (tungtungan) 11:28, 13 Marso 2014 (UTC)

I removed the protection of the main modules, feel free to update or modify if you see something wrong.--Lam-ang(Makipatang) 14:18, 13 Marso 2014 (UTC)

Convert/data

[urnosen | urnosen ti taudan]

The above comparison shows some glitches that should be resolved. All the definitions should be in the master list of units, and the convert data should exactly match the results from running makeunits. Note that makeunits omits redundant fields; those fields are generated on demand by convert. Johnuniq (tungtungan) 11:28, 13 Marso 2014 (UTC)

I'm not quite done translating and cleaning it up, I find it quite difficult to find mistakes while translating, it gives you the line where the error is but since code editor is not enabled for it, you have to visually find the lines where the errors are. I'll just have to do it section by section to make it easier. --Lam-ang(Makipatang) 15:03, 13 Marso 2014 (UTC)
That's a terrific lot of work you have done! I doubt other wikis have been as thorough. When having a quick look at the differences between the makeunits output and convert/data, I noticed a couple of points that you may want to check.
  • A space is needed in the link for klatm (Atmospera(unit)) and USbbl (Bariles(unit)).
  • MeV is megaelectronvolt and meV is millielectronvolt, but both have name megaelektronboltahe.
Johnuniq (tungtungan) 07:09, 14 Marso 2014 (UTC)
I did a quick glance and there are still quite a few mistakes, calling it quits for the day.--Lam-ang(Makipatang) 07:16, 14 Marso 2014 (UTC)
Yes, you have earned a rest—that kind of work is very tedious. I noticed you changed Modulo:Pagbaliwen. Let's not worry about it now because I have a lot of changes that we may as well use here. That is, sometime soon I will upload my current version of Module:Convert. When I do that I plan to restore per_word and plural_suffix to their original values because I have put a translation_table in Modulo:Pagbaliwen/teksto, and that replaces the per_word and plural_suffix in the main module (changing the main module has no effect). If you don't mind, I think I will also restore the bug error messages. As noted above, those messages are never displayed and are only a safety mechanism. The advantage of having the messages translated is, I think, not sufficient to compensate for the trouble such translation will cause when updates to the module occur in the future—it's best to have the main module be as similar as possible on all wikis. The only change needed here is to account for the names of the other modules. Johnuniq (tungtungan) 09:18, 14 Marso 2014 (UTC)
I'm all for easier maintenance of the modules, any bug error messages can be restored.--Lam-ang(Makipatang) 15:37, 14 Marso 2014 (UTC)

Other discussion

[urnosen | urnosen ti taudan]

Is anything else needed at the moment? Johnuniq (tungtungan) 11:28, 13 Marso 2014 (UTC)

The problem I was having were the plural outputs of meters, kilometers, kilograms, and miles, now that I think of it, the problem was directly translating Modulo:Pagbaliwen/datos (instead of Modulo:Pagbaliwen/dokumentasion/pangibaliw a datos/dok) where I was translating the English version that uses "s" for plurals. If you agree we can consider this resolved, I'll just have to finish translating Modulo:Pagbaliwen/dokumentasion/pangibaliw a datos/dok and use the make units for that instead.
Info

To denote plurarity in Ilokano language, reduplicate the initial consonant-vowel-consonant sound of the root word:

For example: milia (mile) → milmilia

If the word begins in vowel, the word is pluralized by reduplicating the initial glottal stop, vowel, and following consonant of the root word then represented by hyphen:

For example: onsa (ounce) → on-onsa

Or simply prefixing the word with "dagiti" - (used in context of a sentence)

For example: milia → dagiti milia (miles), onsa → dagiti onsa (ounces)

Note: There are other plural rules but don’t pertain on this discussion.

Examples:

  1. {{pagbaliwen|3.21|kg|lb}} → 3.21 kilogramo (7.1 lb) → plural should be 3.21 a kilkilogramo (7.1 lb)
  2. {{pagbaliwen|10|mi}} → 10 milia (16 km) → plural should be 10 a milmilia (16 km)
  3. {{pagbaliwen|60|+/-|10|m|ft}} → 60 ± 10 metro (197 ± 33 ft) → plural should be 60 ± 10 a metmetro (197 ± 33 ft) --Lam-ang(Makipatang) 14:43, 13 Marso 2014 (UTC)
Convert has a problem regarding SI units and plurals. The issue is that only the base unit need be defined (like gram or meter), and convert will construct the symbol or name or plural name from the base unit and the prefix. English examples: kg, kilogram, kilograms and ng, nanogram, nanograms. To reduce the overhead, a shortcut was taken for SI units, namely that plurals can only be formed by appending "s", or by using the singular name (for languages other than English). That was all I needed at the time, and it has worked quite well, but was been a problem at the Norwegian Wikipedia, and now here. I will think about what can be done.

Regarding the rules for plurals—they look a bit hard to implement automatically, and exceptions would occur, making the rules more complex. At the Slovenian Wikipedia, I implemented a system so one name could be used for value 1, another for 2, another for 3 or 4, and a couple of other similar rules. The master list of units includes a variable names table (which is in addition to the singular name). Is anything like that needed here? Or is there only a singular name and a plural name?

Regarding miles: can't you just add "milmilia" in the plural column here?

Johnuniq (tungtungan) 07:12, 15 Marso 2014 (UTC)
Yes the plural for miles can be added to the table, I remember translating it but I must have deleted it when makeunits was throwing all kinds of error at me when I loaded the translations for the table. No need to implement automatic conversion of plurals the only ones I'm having trouble really are the SI unit.--Lam-ang(Makipatang) 18:09, 15 Marso 2014 (UTC)

To clarify the master list of units, unit names work as follows.

Makeunits ignores the column names, and assumes that the English names shown below apply.

Unit code Symbol US symbol Scale Extra Name Plural name US name US plural name Prefix Default Link
Kodigo ti unit Simbolo Simbolo ti EU Gatad Nayon Nagan Ad-adu ngem maysa a nagan Nagan nga Ilokano Ad-adu ngem maysa a nagan iti Ilokano Pangsaruno Kasisigud Silpo

I suspect that each of the following columns should be blank here:

  • US symbol
  • US name
  • US plural name

If text is entered for any of these, it should be different from the standard (non-US) Symbol, Name, or Plural name. The US symbol/name is used if |sp=us is used in the convert. If no text is entered for the US symbol/name, the standard symbol/name is used. The purpose is for units like "metre" in UK English, vs. "meter" in US English.

You will need to enter text for the "Plural name" for each unit. Actually, many hundreds of units will probably never be used here, so you do not need to define a plural name for all of them—just do the common units. Later, if a unit that is missing a plural name is used, the definition for that unit can be fixed.

However, you cannot enter a plural name for the SI units, due to the problem mentioned above. I will investigate what is involved in fixing that. Johnuniq (tungtungan) 07:12, 15 Marso 2014 (UTC)

I was aware about the US columns, initially it was easier for me to translate everything, I will eventually delete those later on. There is a note at Help:Convert messages that optional parameter |sp=us don’t work here because it's translated in Ilokano. And yes the SI units are the ones that are giving me problems on plurals.--Lam-ang(Makipatang) 18:09, 15 Marso 2014 (UTC)
I may not have properly explained the purpose of |sp=us. In English, a significant portion of writers use "metre", while another significant portion use "meter" for the same thing. En.wiki has a guideline (en:WP:ENGVAR) to prevent people making pointless changes to how words are spelled, such as changing "colour" to "color", or "metre" to "meter". To accommodate ENGVAR, convert provides sp=us so editors can specify the spelling style that should be used, and there is no other setting (|sp=xx where xx is anything other than "us" is ignored as invalid). At a non-English Wikipedia, sp=us has no purpose because a non-English language will have only one name for metre/meter, and that one name should be used regardless of whether |sp=us is used in a convert. If a language has two names for some units, I suppose |sp=us could be used to provide a distinction, but if an article is copied from en.wiki, the article may have a convert using sp=us and it would not make sense for that to be interpreted as a command to display one of two alternative names in a non-English language. Johnuniq (tungtungan) 02:47, 16 Marso 2014 (UTC)
Yes I'm aware of what the parameter is used for, and I agree with you that they are of no use in a non-English Wikipedia that's why I said in my reply above that I will delete my translations for them later. As you said in your reply above that the parameter |sp=us could be re-purpose, I was actually thinking of the same thing because there are a few units in Ilokano that have different names such as segundo → kanito (second), lawas → dominggo (week), kadapan → pie (feet) (native and borrowed Spanish words for units) and so on but was also thinking of changing the input for the parameter to |sp=ilo and if someone uses |sp=us it will be just be ignored or invalid. I'm open to suggestions on what is best to do with this parameter.--Lam-ang(Makipatang) 16:15, 17 Marso 2014 (UTC)
There is a fair bit of code which does fiddly things if sp=us is in effect—that was required for compatibility with the old templates. My guess without studying the situation is that you could use sp=us for some other purpose, and it would probably work well enough, and the fiddly things would probably not be a problem. You could easily rename the option by changing "sp" if wanted, and/or changing "us" to "ilo"—in fact it would be easy to invent a new option although it would have to be of the form "x=y". The only problem would be with SI units, where again the code makes certain assumptions, similar to how it handles plurals with SI units. I am looking at reworking that to make it more flexible in order to fix the plural problem; the problem with sp=us and SI units would be fixed at the same time. The code is very subtle and I will need some good thinking time to do it—the changes obviously have to be correct, but I also want to avoid adding undue overhead as that was the reason for the assumptions in the first place. I'll return in a few days with the results. Johnuniq (tungtungan) 10:04, 19 Marso 2014 (UTC)
Info

In Ilokano language, ligatures are used to connect various parts of a sentence (actually most Philippine languages). In spoken Ilokano the connective particle "nga" is used almost all the time it doesn’t matter if it follows a vowel or consonant. In written Ilokano "nga" is used when it follows a vowel and "a" if it follows a consonant. I use the template {{a wenno nga}} in some templates if the following words are not known to be vowels or consonants.

There are times when those ligatures area needed, not all the time but could be useful when convert is used inline to form a coherent sentence, so is it possible to manually add those ligatures to the output of convert?

For example:

  1. {{pagbaliwen|3.21|kg|lb}} → 3.21 kilogramo (7.1 lb) → should be 3.21 a kilkilogramo (7.1 lb)
  2. {{pagbaliwen|10|mi}} → 10 milia (16 km) → should be 10 a milmilia (16 km)
  3. {{pagbaliwen|14.1|hand|in}} → 14.1 ima (57 pulgada) should be → 14.1 nga im-ima (57 a pulpulgada)

By the way thanks for all your help, and I'm pretty sure that many of the problems I'm encountering here will also apply to the other wiki versions of Philippine languages.--Lam-ang(Makipatang) 18:09, 15 Marso 2014 (UTC)

Please clarify what would happen, with an example of the input to convert. Is the idea that there would be an extra parameter in the template that would allow the editor to specify additional text to be inserted between the input number and the input unit? There is such a parameter: would the following work?
  • {{pagbaliwen|3.21|kg|lb|adj=pre|a}} → 3.21 a kilogramo (7.1 lb)
  • {{pagbaliwen|10|mi||adj=pre|a}} → 10 a milia (16 km)
  • {{pagbaliwen|14.1|hand|in|adj=pre|nga}} → 14.1 nga ima (57 pulgada)
  • {{pagbaliwen|14.1|hand|in|disp=preunit|nga |a }} → 14.1 nga ima (57 a pulgada)
The first of those has the plural problem discussed above, but apart from that, is this adequate?
Using |adj=pre introduces a small problem when no output unit is specified, as in the second example above. Note that || is used to pass an empty output unit to convert—that causes it to use the default output. The problem is that convert cannot determine exactly how the parameters were entered in the template, and if || is not used, "a" would be seen as the output unit. That is mentioned at en:Help:Convert#Extra words.
The fourth example uses |disp=preunit which is able to insert text before the input and output units. However, it is necessary to add a space if that is wanted. Johnuniq (tungtungan) 09:47, 16 Marso 2014 (UTC)
Yes, all the parameters mentioned above are more than adequate to add the ligatures when needed. --Lam-ang(Makipatang) 16:15, 17 Marso 2014 (UTC)

Both en and ilo parameters

[urnosen | urnosen ti taudan]

The following is a response to the comment at "18:09, 15 Marso 2014" above.

I edited Modulo:Pagbaliwen/teksto/pagipadasan to demonstrate that aliases can be created for existing options. Standard convert allows a range with "to", and accepts "sp=us" for US spelling. The edit (diff) adds range "newto" and option "newsp=newus".

  • {{pagbaliwen|1|to|5|m|in}} → 1 aginggana iti 5 metro (39 iti 197 in)
  • {{pagbaliwen|1|m|in|sp=us}} → 1 metro (39 in)
  • {{pagbaliwen|1|USgal/s}} → 1 galon ti EU kada segundo (0.0038 m3/s)
  • {{pagbaliwen|1|USgal/s|sp=us}} → 1 galon ti EU kada segundo (0.0038 m3/s)
  • {{pagbaliwen/pagipadasan|1|newto|5|m|in}} → 1 newto[pagbaliwen: di ammo a yunit]
  • {{pagbaliwen/pagipadasan|1|m|in|newsp=newus}} → 1 metro (39 in)[pagbaliwen: imbalido a pagpilian]
  • {{pagbaliwen/pagipadasan|1|USgal/s}} → 1 galon ti EU kada segundo (0.0038 m3/s)
  • {{pagbaliwen/pagipadasan|1|USgal/s|sp=us}} → 1 galon ti EU kada segundo (0.0038 m3/s)
  • {{pagbaliwen/pagipadasan|1|USgal/s|newsp=newus}} → 1 galon ti EU kada segundo (0.0038 m3/s)[pagbaliwen: imbalido a pagpilian]

I think all the options can similarly be translated, if wanted. Bear in mind that lots of options are almost entirely unused, so I wouldn't bother translating them all because the additions would need to be documented, and the longer the documentation the harder it is to read and comprehend. If you want something and can't see how to do it, please ask. Johnuniq (tungtungan) 06:34, 27 Marso 2014 (UTC)

I have made some major changes to Modulo:Pagbaliwen and Modulo:Pagbaliwen/teksto, some of which were in response to the issues discussed at #Plurals above. Previously, Modulo:Pagbaliwen/makeunits enforced certain assumptions for simplicity at en.wiki. However, it is now possible for an SI prefix to be inserted at different positions in the singular and plural names for an SI unit. Also, the singular and plural US spelling of the names can be different and can have the SI prefix inserted at different positions. The only restriction is that the SI prefix is always inserted in front of the symbol (that is, when abbr=on applies).

The new code has had only a very light test. Please give it a workout and let me know if any problems are found. Johnuniq (tungtungan) 06:34, 27 Marso 2014 (UTC)

Thank you again for all your efforts in making sure that module convert is adapted locally and working properly. I will be giving it a proper workout in the coming days ahead and will let you know if problems are found or if I need additional help. The modules will be semi-protected again but you should be able to edit them now.--Lam-ang(Makipatang) 15:44, 27 Marso 2014 (UTC)
So I was able to add plural names at Modulo:Pagbaliwen/dokumentasion/pangibaliw a datos/dok for Si units w/o getting any errors at Modulo tungtungan:Pagbaliwen/makeunits, for example {{pagbaliwen/pagipadasan|1|to|5|m|in}} now gives the correct plural output for meter → 1 aginggana iti 5 metro (39 iti 197 in), but if an SI unit has an SI prefix the output is incorrect, for example {{pagbaliwen/pagipadasan|1|to|5|km}} gives → 1 aginggana iti 5 kilometro (0.62 iti 3.11 mi) instead of→ 1 iti 5 kilkilometro (0.62 iti 3.11 mi). Obviously I'm not doing it right, so the question is how do you insert an SI prefix in the singular and plural names for an SI unit?--Lam-ang(Makipatang) 20:08, 28 Marso 2014 (UTC)

There might be a problem as I do not understand what is wanted. Let me explain what convert can do, and then you can let me know what is needed. At length units, unit "m" is defined with singular name "metro" and plural name "metmetro". The SIprefixes table at Modulo:Pagbaliwen/teksto defines prefix "k" to have name "kilo". When convert constructs the name for "km", it gets the name from "m" and the prefix "kilo". Say the value is plural, so the name is "metmetro". Because that name does not contain "%s", the prefix will be inserted at the front, giving "kilometmetro". If the name had been defined as, say, "met%smetro", the result would have been "metkilometro". In other words, an SI prefix replaces "%s" if that appears in the name, or is inserted at the front otherwise.

One quick workaround for commonly used units would be to simply define them in the master list (add a row). You could define "km" to have whatever symbol and names are wanted. The scale would be 1000 and the prefixes column would be empty (no "SI"). For the default, put "mi" instead of the expression used for m. You could do that for 10 or 20 commonly used units if no better solution can be found. The way convert works is that it looks up the unit code in the data table. If it exists, it is used. If it does not exist, the unit code is examined to determine if it should be interpreted in some other way, for example as having an SI prefix.

Is the problem related to the "ligatures" section above? If you can come up with a systematic rule for what convert should do, I will have a look at what would be involved in implementing it. As I mentioned before, I'm rather hesitant about rules for a language as they usually have many variations, but perhaps there could be a specification that would cover most cases. However, the module can only work with its input and it has no knowledge of what text comes before or after the convert, so a specification may not be possible. Johnuniq (tungtungan) 03:14, 29 Marso 2014 (UTC)

The ligatures are fine the only problem I'm having right now are the plural names of units that are constructed with SI prefix from Modulo:Pagbaliwen/teksto like the following
Singular Plural
kilometro (kilometer) kilkilometro (kilometers)
sentimetro (centimeter) Sensentimetro (centimeters)
kilogramo (kilogram) Kilkilogramo (kilograms)

basically anything from the SI prefix table, the first three letters have to be reduplicated before being prefix to a unit name to form the plural name, but as you suggested I'll just define them at the master table with no prefix column and that's it. --Lam-ang(Makipatang) 06:20, 29 Marso 2014 (UTC)