Modify

Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#15994 closed defect (fixed)

Better language interlink support

Reported by: stoecker Owned by: stoecker
Priority: normal Milestone:
Component: Trac Version:
Keywords: Cc: Klumbumbus, ak099, DiGro, Hb---

Description (last modified by stoecker)

Hi,

I added a new interlink system for translated wiki links

[[wikitr:OrigLink|Text]]

will be replaced by the translated form when it is translated or the original when not. This eases the workload of testing if interlinks are correct or not - you simply don't have to do it anymore :-).

The form

[[wikitr:{t} (en):OrigLink|Text]]

allows to add a note behind the label in case the text is no native (text freely choosable).

As you are the most active translators could you please test that feature and report problems (or success :-)

If no label text is given the labels probably will differ from the defaults, but I don't think that important. I hope I got all type of relevant links and the target correct, if not please tell.

Attachments (0)

Change History (29)

comment:1 Changed 2 years ago by stoecker

P.S. Comments, improvements welcome...

comment:2 Changed 2 years ago by Hb---

Cool idea.

Trying on De:Help/Preferences gives three times /help in the generated URL. See bottom of page.
Where shall the language code be placed?
Is there really a space char in front of the (hint text)?

comment:3 Changed 2 years ago by stoecker

You used

[[wikitr: (englisch)De:Help/Action/AutoSave|Automatisches Speichern]]

That is

  • "wikitr" → correct
  • " (englisch)De" → wrong, should be " (englisch)" only, you forgot the ":"
  • "Help/Action/AutoSave" → wrong, should either be "/Help/Action/AutoSave" or "Action/AutoSave" (as the Page is already in sublevel "Help/".
  • "Automatisches Speichern" → correct

I fixed the page and shortened the text from " (englisch)" to " (en") which is not so ugly :-).

Where shall the language code be placed?

Nowhere

Is there really a space char in front of the (hint text)?

Yes. Otherwise it will be directly behind the label.

comment:4 Changed 2 years ago by ak099

Hi,Dirk! I've tested it and it seems work well.

comment:5 Changed 2 years ago by stoecker

I'm thinking about a generic setting for the base language extension, so one doesn't have always to specify " (en)", but

  • probably not every language is happy with similar text
  • getting rid of the default seems no better than adding it
  • more complex makes it harder to understand
  • probably for right to left languages it anyway needs to be handled different.

Ideas, comments?

P.S. The wikitr: can also be used in English pages. It will have no visible effect there, but probably makes live easier for translators ;-)

P.P.S. [wikitr:link text] also works, but I don't know how a base language extension with a space sign could be specified in this form.

comment:6 Changed 2 years ago by stoecker

Ok. Now TracLanguages contains a column, which can be used to set a default interlink parameter and an empty value can be used to remove that default again.

comment:7 Changed 2 years ago by stoecker

Description: modified (diff)

To support RTL languages the base language text must now contain the pattern {t}. Anyway as it must be set once only now I think that's ok. See also docs at WikiMacros for macro TranslatedPages.

Last edited 2 years ago by stoecker (previous) (diff)

comment:8 Changed 2 years ago by Hb---

On De:Help/Preferences

[[wikitr:.en:Action/AutoSave|Automatisches Speichern]]

now results in

.en

Seems that the note is not added behind the label but given instead.

Last edited 2 years ago by Hb--- (previous) (diff)

comment:9 Changed 2 years ago by stoecker

See previous comments.

comment:10 Changed 2 years ago by Hb---

Seems that I'm still lost on the syntax. Usually functions or macros are called by

macroname <delimiter(:)> mandatory argument <separator(,)> 1. optional arg.<separator(,)> 2. optional arg.

Mandatory is the original page name.
Optional is the localized titel.
and optional is the hint if the localized page misses.

P.S.: Not sure if it's a coincidence, but the macros for the Wiki on /OutdatedPages and on /Translations/Statistics currently fail.

Last edited 2 years ago by Hb--- (previous) (diff)

comment:11 in reply to:  10 Changed 2 years ago by stoecker

Replying to Hb---:

Seems that I'm still lost on the syntax. Usually functions or macros are called by

macroname <delimiter(:)> mandatory argument <separator(,)> 1. optional arg.<separator(,)> 2. optional arg.

Mandatory is the original page name.
Optional is the localized titel.
and optional is the hint if the localized page misses.

The wikitr: is no WikiMacro. It is another specific style of TracLinks. It works like any other wiki link.

P.S.: Not sure if it's a coincidence, but the macros for the Wiki on /OutdatedPages and on /Translations/Statistics currently fail.

Fixed.

comment:12 in reply to:  5 Changed 2 years ago by Hb---

Replying to stoecker:

P.P.S. [wikitr:link text] also works...

This seems the best solution. No need for a big change, only extend from wiki to wikitr and thats it. This could be done for all English pages first. So trnaslators do not have to worry about getting the wiki links right.

comment:13 Changed 2 years ago by anonymous

It's the simplest solution, but I like the idea of automatically adding (en) to links to not yet translated pages. It's like a tradition to mark such links in Wikipedia.

Last edited 2 years ago by ak099 (previous) (diff)

comment:14 in reply to:  13 Changed 2 years ago by Hb---

Replying to anonym:

... I like the idea of automatically adding (en) to links to not yet translated pages. ...

Yes. And this happens with the single bracket solution, please see the two english links in wiki:De:Help/Action/MergeLayer.
But I doubt that (en) is the best indication for an untranslated page. Perhaps better symbols are available.

A globe symbol is discussed here https://globalbydesign.com/2012/06/06/looking-for-a-translation-icon/

A simple ™ for "Translate Me" is my favorite, Alt+0153 on WinNumPad. Try This™

comment:15 Changed 2 years ago by ak099

Maybe. Symbol doesn't really matter for me. The main thing is to have some sign that the linked page is not in my language, but in base langugage.

comment:16 Changed 2 years ago by stoecker

This seems the best solution. No need for a big change, only extend from wiki to wikitr and thats it. This could be done for all English pages first. So trnaslators do not have to worry about getting the wiki links right.

It was always only the need to change wiki into wikitr. That was the idea.

Ah, now I understand your syntax problems. Please read TracLinks for the different types of links.

  • The form [[target|label]] is the preferred (wikimedia style), but seldom used form.
  • The form [target label] is the old form, but has issues with spaces in the target link
  • other forms are [[target]], [target], target or even the ugly <target>

Where target may be of form wiki:page or also only page (see also CamelCase). Only change I made is that target can be of type wikitr:basespec:page with the optional basespec: part. Naturally if the basespec is used and contains a space, then only first form will work. If it is not used, all forms work as before.

BTW: The BackLinks macro you used does not detect all forms and thus is not reliable BTW.

A simple ™ for "Translate Me" is my favorite, Alt+0153 on WinNumPad. Try This™

The Trademark sign surely is not the right thing to use here!

Maybe. Symbol doesn't really matter for me. The main thing is to have some sign that the linked page is not in my language, but in base langugage.

That is default for wikitr: now and can be configured at TracLanguages for each language. Default is {t} ({c}) which leads to appending " (en)". To strip it when unwanted in special cases use an empty spec like wikitr::/Help/WhateverPage. You could set the default to {t} (анг) or whatever fits best into Russian pages at TracLanguages.

comment:17 in reply to:  16 ; Changed 2 years ago by Klumbumbus

Replying to stoecker:

It was always only the need to change wiki into wikitr. That was the idea.

Well, "only" is good. We have 1803 pages with wiki:. With a rough estimate of 10 links per page we would need to manually edit 18000 links? :o

However I appreciate the goal to have an automatic language support. (This was already working with one of the many linking formats but not in all cases which is why I preferred the [wiki:target label] format.)

comment:18 in reply to:  17 ; Changed 2 years ago by stoecker

Replying to Klumbumbus:

Replying to stoecker:

It was always only the need to change wiki into wikitr. That was the idea.

Well, "only" is good. We have 1803 pages with wiki:. With a rough estimate of 10 links per page we would need to manually edit 18000 links? :o

There is no reason to replace existing links (except maybe dead ones to planned and never finished translations).

This was already working with one of the many linking formats but not in all cases which is why I preferred the [wiki:target label] format.

I don't understand that sentence at all.

comment:19 Changed 2 years ago by Hb---

Replying to stoecker:

... syntax problems. Please read TracLinks for the different types of links.

  • The form [[target|label]] is the preferred (wikimedia style), but seldom used form.
  • The form [target label] is the old form, but has issues with spaces in the target link ...

Having read that Over9000 times while in wiki here the preferred style is neglected leads to the question:

  1. Are the "issues with space" so relevant that only the new style should be used and recommended in future?
  2. If yes, the TracLinks documentation would mostly differ from the content in the JOSM wiki.

... Only change I made is that target can be of type wikitr:basespec:page with the optional basespec: part. Naturally if the basespec is used and contains a space, then only first form will work. ...
That is default for wikitr: now and can be configured at TracLanguages for each language. Default is {t} ({c}) which leads to appending " (en)". To strip it when unwanted in special cases use an empty spec like wikitr::/Help/WhateverPage.

I like the shortest possible form most, here [wikitr:target name].

The technical solution is good. Shall anything in the wiki be changed to give advice to translators?

comment:20 in reply to:  19 Changed 2 years ago by stoecker

Replying to Hb---:

Replying to stoecker:

... syntax problems. Please read TracLinks for the different types of links.

  • The form [[target|label]] is the preferred (wikimedia style), but seldom used form.
  • The form [target label] is the old form, but has issues with spaces in the target link ...

Having read that Over9000 times while in wiki here the preferred style is neglected leads to the question:

  1. Are the "issues with space" so relevant that only the new style should be used and recommended in future?

No. All explicit forms are fine. Only if "wiki:" is left out completely Trac sometimes does not detect the links, so the formats without wiki/wikitr are not recommended.

The technical solution is good. Shall anything in the wiki be changed to give advice to translators?

The Translations/Wiki should document it :-)

comment:21 in reply to:  18 ; Changed 2 years ago by Klumbumbus

Replying to stoecker:

This was already working with one of the many linking formats but not in all cases which is why I preferred the [wiki:target label] format.

I don't understand that sentence at all.

What I meant is the following:

So when the links on the english page are in this format and you copy the page for translation, you only need to translate the label "Undo" -> "Rückgängig" and keep the rest of the link as is and it automatically points to the german page without adding De:.

However if the german undo page would not exist the link on the german Menu/Edit page would be broken and would not automatically change to the english undo page (see also e.g. the link to purge on the same page) . This can be achieved now with wikitr. (I thought it was already working with the format above too but obviously I was wrong.)

Same as Hb-- I prefer [wiki:target name] resp. now [wikitr:target name] as this is the easiest and fastest solution (simply copy from browser URL field and change one / to :).

comment:22 in reply to:  21 Changed 2 years ago by stoecker

Replying to Klumbumbus:

So when the links on the english page are in this format and you copy the page for translation, you only need to translate the label "Undo" -> "Rückgängig" and keep the rest of the link as is and it automatically points to the german page without adding De:.

Yes. For relative links that is the case, because the path changes on Copy&Paste of the unchanged contents. :-)

@DiGro:
No /Nl: in wikitr: links: wiki:/Nl:Help/Action/Duplicate?action=diff&version=8

comment:23 Changed 2 years ago by stoecker

Resolution: fixed
Status: newclosed

comment:24 Changed 2 years ago by Klumbumbus

Would it be possible to implement the new features on wiki: too, so we could keep using wiki: instead of wikitr:?

comment:25 in reply to:  24 Changed 2 years ago by stoecker

Replying to Klumbumbus:

Would it be possible to implement the new features on wiki: too, so we could keep using wiki: instead of wikitr:?

Even if, it would be a bad hack which can break anytime, so no. Sorry :-)

comment:26 in reply to:  24 ; Changed 2 years ago by Hb---

Replying to Klumbumbus:

Would it be possible to implement the new features on wiki: too, so we could keep using wiki: instead of wikitr:?

That will make it impossible to exactly target the source of the translation.

But reason for reopening is the question how the navigation works when an foreign user hits an untranslated page. That page may have links to translated pages. Are those links

  1. localized in the help browser/JOSM
  2. localized on the wiki server? (Probably not).

Replying to Stoecker:

The Translations/Wiki should document it :-)

Not the right place as after each step all translators get woken up.

Please see the Kraut page De:Translations/Wiki for a draft.

comment:27 in reply to:  26 ; Changed 2 years ago by stoecker

Replying to Hb---:

Replying to Klumbumbus:

Would it be possible to implement the new features on wiki: too, so we could keep using wiki: instead of wikitr:?

That will make it impossible to exactly target the source of the translation.

But reason for reopening is the question how the navigation works when an foreign user hits an untranslated page. That page may have links to translated pages. Are those links

  1. localized in the help browser/JOSM
  2. localized on the wiki server? (Probably not).

?

An untranslated page does not have links to translated pages, as untranslated pages are base English pages and they always link to English base language.

Or do you mean a partial Copy&Paste. This links to translated pages logically, as it actually should be in the target language even if it is not in reality.

The macro does not know which language a user has or expects. It simply links Russian pages to Russian pages and Dutch pages to Dutch pages depending on the name of the current page (and to English when missing). Not more, not less.

Replying to Stoecker:

The Translations/Wiki should document it :-)

Not the right place as after each step all translators get woken up.

Please see the Kraut page De:Translations/Wiki for a draft.

Nobody gets woken up. They actively look, which I appreciate. For work in progress use the "oudated=" parameter, so translations and people visiting the page know what's going on.

comment:28 in reply to:  27 ; Changed 2 years ago by Hb---

Replying to stoecker:

how the navigation works when an foreign user hits an untranslated page. That page may have links to translated pages. Are those links

  1. localized in the help browser/JOSM
  2. localized on the wiki server? (Probably not).

An untranslated page does not have links to translated pages, as untranslated pages are base English pages and they always link to English base language.

Example: A German user requests help for Help/Dialog/SelectionList wanders to Help/ToggleDialogs looks around for more windows and clicks Help/Dialog/Notes. That link will lead him to the English page while a German version De:Help/Dialog/Notes exists.

In the wiki the language list from the TranslatedPages macro is shown, but not in the Help Browser.

The macro does not know which language a user has or expects. ...

The context based help system on the client side first checks if a translated page is available. This check should be done for the mouse clicks in the Help Browser too.

comment:29 in reply to:  28 Changed 2 years ago by stoecker

Replying to Hb---:

Replying to stoecker:

how the navigation works when an foreign user hits an untranslated page. That page may have links to translated pages. Are those links

  1. localized in the help browser/JOSM
  2. localized on the wiki server? (Probably not).

An untranslated page does not have links to translated pages, as untranslated pages are base English pages and they always link to English base language.

Example: A German user requests help for Help/Dialog/SelectionList wanders to Help/ToggleDialogs looks around for more windows and clicks Help/Dialog/Notes. That link will lead him to the English page while a German version De:Help/Dialog/Notes exists.

That's impossible to fix with the current system.

In the wiki the language list from the TranslatedPages macro is shown, but not in the Help Browser.

The macro does not know which language a user has or expects. ...

The context based help system on the client side first checks if a translated page is available. This check should be done for the mouse clicks in the Help Browser too.

Same answer.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain stoecker.
as The resolution will be set.
The resolution will be deleted.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.