Topic on Project:Support desk

How to translate this Cite template to Hebrew?

29
49.230.87.239 (talkcontribs)

I have an RTL (Hebrew) 1.34.0 principally all-core MediaWiki website with Cite extension and ParserFunctions extension loaded in LocalSettings.php.

In this website I have Template:Cite with the following content, which I use to create English footnotes in English-only pages:

<includeonly>{{#if:{{{refname|}}}
| {{#tag:ref|{{{content|}}}|name={{{refname}}}}}
| {{#tag:ref|{{{content|}}}}}
}}</includeonly>

Credit for @Jonathan3 for developing this template.

Call input examples:


1) Cite with parameter calls WITHOUT English naming (by name attribute)

First check{{Cite|content=First check}}
Second check{{Cite|content=Second check}}
Third check{{Cite|content=Third check}}

<references />

2) Cite with parameter calls WITH English naming (by name attribute)

First check{{Cite|content=First check}}
Second check{{Cite|content=Second check|refname=First_name}}
Third check {{Cite|refname=First_name}}

<references />


Call output examples (appear fine in dir="rtl" modes):


1) Cite with parameter calls WITHOUT English naming

First check[1] Second check[2] Third check[3]

  1. ^ First check
  2. ^ Second check
  3. ^ Third check

2) Cite with parameter calls WITH English naming

First check Second check Third check

  1. ^ First check
  2. ^ לקפוץ מעלה אל:2.0 2.1 Second check

---

Note: Brackets appear flipped (][) in dir="ltr" modes

---

My problem

I want to use this template in an Hebrew project, that is, in an RTL && Right-align writing mode but if I write for example:

{{Cite|Content=non_messy_content}}

and my footnote happens to start with English after the first pipeline and also including Hebrew (say, as with links) than everything becomes jumbled up:

{{Cite|Content=תוכן_שהתבלגן}}

The first example shows non messy content and the second shows messy content (תוכן שהתבלגן); in the second example the "Content" part is situated wrongly.

My question

The only solution which comes to my mind to solve this problem is having an Hebrew call to the template such as

{{הערה|תוכן=תוכן_שלא_התבלגן}}

Which means Content=content which didn't go messy.

If there were ready to use RTL&&RA Hebrew (or any other RTL) <ref> tags than I wouldn't need such a Hebrew call but HTML is all English so I do need a template and an all-Hebrew one.


Hence I ask,

How to translate my template from English to Hebrew in a successful manner?

How to translate this Cite template to Hebrew?

49.230.87.239 (talkcontribs)

I give you my word of honor that this is generally and most likely the last time I will tag your profiles here with this RTL&&RA issue:

@Amire80

49.230.87.239 (talkcontribs)

I give you my word of honor that this is generally and most likely the last time I will tag your profiles here with this RTL&&RA issue:

@קיפודנחש

49.230.87.239 (talkcontribs)

I give you my word of honor that this is generally and most likely the last time I will tag your profiles here with this RTL&&RA issue

@IKhitron

Bawolff (talkcontribs)

So this is a bit harder. Some possible solutions:

  • If you switch the page language via Special:PageLanguage (After enabling $wgUseDBPageLanguage), the edit box will be the directionality of the page language. (You can see an example of this by comparing the edit box for the page named MediaWiki:Translateinterface/en and MediaWiki:Translateinterface/he )
  • The following js might help: $( function() {box = document.getElementById( 'wpTextbox1' ); if (box) box.dir = 'auto';});
  • If you don't want to specify an overall override, or are authoring a mix of directionality in one page, you can directly insert RLM (right-to-left mark), LRM (Left-to-right mark) or FSI (first-strong-isolate) characters (You would have to directly insert the character, not the entity, for it to affect the edit box. However it may also have an effect on the output, in most cases it should probably be fine, and the isolate characters are probably less likely to have a negative effect than the other characters). This is kind of hard to do, and how to do it varries by operating system. In windows, you can insert an LRM using the key combination Alt+0253. This is what it looks like if you put an LRM character before and after the hebrew part:
{{Cite|content=‎תוכן_שהתבלגן‎}}
49.230.87.239 (talkcontribs)

@Bawolff

example.com/MediaWiki:Translateinterface/en

example.com/MediaWiki:Translateinterface/he

Brought me a 404 in my own website.


---

Running the JS

$( function() {box = document.getElementById( 'wpTextbox1' ); if (box) box.dir = 'auto';});

in an edit page juxtaposed all English content left and all Hebrew content right; so I still have a problem calling {{Cite|Content=CONTENT}} in the middle of two Hebrew structures, if the content of the footnote is not solely in English.


---

About using either RLM/LRM; I don't know these

About FSI; If I understand correctly it is still experimental


---

Is there a way to tell the backend, for example

Where "הערה" put "Cite" AND where "שם" put "name"?

This way I write everything in Hebrew but the output will always be based on a preexisting English translation of the output, just one step before parsing and rendering everything else?

Bawolff (talkcontribs)

you can use redirects for alternate template names. Template parameters can have multiple names in a fallback pattern.

49.230.87.239 (talkcontribs)

@Bawolff I have read in that page and what I understood is that a redirect does with transferring a human or a bot from one webpage to another.

Perhaps you meant something like that the page

תבנית:הערה

Should contain:

#REDIRECT [[Template:Cite]]


About fallback patterns for template parameters: I want to read about it, but I don't know where exactly,

Did you mean to: Help:Templates#Exceptions to the order of evaluation

I mostly misunderstand how is it essentially different than redirections and how does a template gets directed to do the "fallback",


Kindly,

Bawolff (talkcontribs)

you can do {{{parametername|{{{alternativeparamname}}}}}}

49.230.87.239 (talkcontribs)

@Bawolff

I want to better understand that code

I went to Help:Templates and searched:

|{{{

I didn't match any data.


Please tell us the name of the concept or refer to a man page.

At least a bit more detailing would be helpful.

Bawolff (talkcontribs)
49.230.87.239 (talkcontribs)

So,

parameter תוכן has the default value of content

AND

parameter שם has the default value of refname (a name attribute)

?

49.230.87.239 (talkcontribs)

@Jonathan3 now after the English phase was dealt with in depth (and success), you might have an approach to recommend about translating the template to Hebrew.

Jonathan3 (talkcontribs)

I don't have any experience of foreign languages but will have a look next week. I'd start by changing "refname" to "name", just to simplify things in finding a translation. I just kept it as "refname" as it had been suggested by someone else. They say a camel is a horse designed by a committee. Apologies if it turns out that the distinction is necessary!

49.230.17.183 (talkcontribs)

I agree that in the content of parameter names, name is better than refname (as long as there is no conflict between name as a mere parameter name and name as a special value representing HTML name attribute).

I preferred it all along without knowing if its a problem or not and seemingly it isn't (smile of happiness).

49.230.17.183 (talkcontribs)

@Bawolff

Okay, I have redirected תבנית:הערה to Template:Cite

Perhaps it would be redundant to say that English tests go fine


All Hebrew tests fail with the exact two errors:

  • שגיאת ציטוט: תג <ref> לא תקין;
  • להערות שוליים ללא שם חייב להיות תוכן


If you translate this to Hebrew you could understand that the parameters content and refname aren't applicable by through the תבנית:הערה TO Template:Cite redirect.


Why?

Because I got lost with Help:Templates#Exceptions to the order of evaluation

Please consider to give an example to how one should implement it in the (confusing and much-background-knowledge requiring context of LTR-to-RTL default parameters).

49.230.17.183 (talkcontribs)

by through = through


(confusing and much-background-knowledge requiring

=

(confusing and much-background-knowledge requiring)

Bawolff (talkcontribs)
49.230.17.183 (talkcontribs)

@Bawolff

My template is the same one Jonathan3 created:

<includeonly>{{#if:{{{refname|}}}
| {{#tag:ref|{{{content|}}}|name={{{refname}}}}}
| {{#tag:ref|{{{content|}}}}}
}}</includeonly>

Currently I also have a redirect from תבנית:הערה to it (Template:Cite)


Although this template (Template:Cite) is in English, I want to call it in Hebrew, as with, say;

בדיקה_ראשונה{{הערה|תוכן=בדיקה_ראשונה}}

בדיקה_שנייה{{הערה|תוכן=בדיקה_שנייה|שם=שם_ראשון}}
בדיקה שלישית{{הערה|שם=שם_ראשון}}

But; I don't know how I might be able be able to do that.

49.230.17.183 (talkcontribs)

@Bawolff do you know a way to do that or would you say it's even possible with the current release?

If it's not possible with the current release than maybe I should indeed migrate, somehow, from MediaWiki to TikiWiki or some other MediaWiki derivative.

Bawolff (talkcontribs)

As i already said above, you can use default values of parameters to have template parameters that have more than one name and you can have redirects to make the template have more than one name.

49.230.17.183 (talkcontribs)

@Bawolff

You said:

"you can use default values of parameters to have template parameters that have more than one name"

So, I tried to read Help:Templates#Default_values on which you said:

"It is a parameter that has as its default value a different parameter"

But I said I got lost with it and you said:

"I dont see anything in that section relavent to what you are doing"

So is it relevant or irrelevant?

49.230.17.183 (talkcontribs)

Use default values of parameters

To have template parameters

That have more than one name

---

So,

Should the default value of the parameter content be תוכן and should the default value of the parameter refname be שם?

Please share with us if I misunderstood.

182.232.57.75 (talkcontribs)
182.232.57.75 (talkcontribs)

@Jonathan3 I start to think that translating this template into Hebrew is impossible.

182.232.57.75 (talkcontribs)

@Jonathan3 I take back what I wrote one post above (which was anyway humorous);

I think I found a way to translate that template;

This version passed my tests below:

<includeonly>{{#תנאי:{{{שם|}}}
    | {{#תגית:ref|{{{תוכן|}}}|name={{{שם}}}}}
    | {{#תגית:ref|{{{תוכן|}}}}}
}}</includeonly>
  • Instead if I wrote תנאי
  • Instead tag I wrote תגית
  • Instead refname I wrote שם
  • Instead content I wrote תוכן

Tests passed successfully


1) Cite with parameter calls WITHOUT English naming (by name attribute)

* בדיקה ראשונה{{הערה|תוכן=בדיקה ראשונה}}
* בדיקה שנייה{{הערה|תוכן=בדיקה שנייה}}
* בדיקה שלישית{{הערה|תוכן=בדיקה שלישית}}
* בדיקה רביעית{{הערה|תוכן=בדיקה רביעית}}

Output:

  • [1]בדיקה ראשונה
  • [2]בדיקה שנייה
  • [3]בדיקה שלישית
  • [4]בדיקה רביעית
  1. ^ בדיקה ראשונה
  2. ^ בדיקה שנייה
  3. ^ בדיקה שלישית
  4. ^ בדיקה רביעית

2) Cite with parameter calls WITH English naming (by name attribute)

* בדיקה ראשונה{{הערה|תוכן=בדיקה ראשונה}}
* בדיקה שנייה{{הערה|תוכן=בדיקה שנייה|שם=שם_ראשון}}
* בדיקה שלישית{{הערה|שם=שם_ראשון}}

Output:

  • [1]בדיקה ראשונה
  • [2]בדיקה שנייה
  • [2]בדיקה שלישית
  1. בדיקה ראשונה
  2. ^ לקפוץ מעלה אל:2.0 2.1 בדיקה שנייה

Notes


Note 1)

Instead ref it was written תגית but in version 1.35.0 or 1.36.0 one could write תג instead תגית and the credit for that goes to @Amire80 for commiting the source code change.

תג is a "male" manner for tag in Hebrew instead the longer "female" manner of תגית.


Note 2)

I haven't tested the template with regards to links. I should do that ASAP and publish my progress here.


Note 3)

Any constructive comment about my translation of Jonathan3's template is most welcome.

Jonathan3 (talkcontribs)

If it works it works! Well done.

It looks like the references/footnotes part is a mixture of LTR and RTL (e.g. the number 1 and its full stop are LTR on the left, then the text itself is RTL). Is that a problem?

182.232.7.125 (talkcontribs)

@Jonathan3 thanks !

Actually in practice (in the Hebrew site) everything is RTL for me but here in mediawiki.org the output appears aligned-left for some reason but I cannot edit to try HTMLize the output chapters to give them dir="rtl" and style="text-align: right" or something similar I guess.

182.232.7.53 (talkcontribs)
Reply to "How to translate this Cite template to Hebrew?"