patchSamizdat - Patches: patch #5882, separate_translation patch 0.4.2...


You are not allowed to post comments on this tracker with your current authentication level.

patch #5882: separate_translation patch 0.4.2 (vs samizdat-

Submitter:  Dmitry Borodaenko <angdraug>
Submitted:  Sun 22 Apr 2007 06:22:10 PM UTC
Category:  None Priority:  8
Status:  Done Privacy:  Public
Assigned to:  None Open/Closed:  Closed

Jump to the original submission

Tue 04 Mar 2008 03:59:19 PM UTC, comment #7: 

As discussed on samizdat-devel, this patch is now obsolete: parts of its design are now included in Samizdat, and other parts are too hard to do without confusing users.

Dmitry Borodaenko <angdraug>
Group administrator
Thu 02 Aug 2007 12:00:51 AM UTC, comment #6: 

hi samizdat-devel,

Here's a slightly updated separation-translations fix "0.4.2" against
the snapshot.

The main changes are:

  • controllers/resource_controller.rb

After relating a reply to its parent article (to become a
translation), the user should be redirected back to the same content
that s/he was looking at before clicking to create the relation, even
though this action may have had an effect on the translation mechanism
(the reply may or may not have now changed from what appears to the
user as parent status - this depends on both the language of the reply
and the preferred language).

IMHO this is now fixed in this new version of the patch.

  • controllers/message_controller.rb 

- includes the the bug fix #20303 which IMHO should be noncontroversial

  • helpers/message_helper.rb

It can happen (in fact, it's quite realistic in practice) that the
original version of an article is non-wiki, but more
open-editing-aholic users add translations with wiki status.
The "open = " section has been corrected so that the open status
applies correctly from the user's point of view. Otherwise, the
logged in user gets an edit button for the version which s/he cannot
edit, and gets no edit button for the version which s/he can edit.

  • helpers/resource_helper.rb

Things could get very messy if both the parent article and its replies
(translations) can independently become related to foci. This change
offers the user the possibility to link the parent article to foci
instead of the translation to foci.


i think that with this 0.4.2 patch, the translation functionality of
070618-1 has probably been mostly debugged:

The style of the changes can probably be compactified and otherwise
ruby-ised ;).

Is this too complicated from a design point of view? i don't know.

i think the point of view for the user with the patched 070618
mechanism is definitely better than before: translators should be able
to fairly intuitively provide translations and "monolingual" users
should be able to see their preferred translations (when they exist)
without needing to understand the translation mechanism.


(file #13548)

Boud Roukema <boud>
Group Member
Sat 30 Jun 2007 08:36:30 PM UTC, comment #5: 

i have an irreproducible error. :P

There could be some minor (annoying) caching error with the title in history_controller.rb - i've only seen one instance of this (so far). When clicking on the link to compare the most recent and the second most recent version of an article, the title had some extra text in addition to the correct text. The extra text looked like it was something brought up by the cache. Looking at the same URL from a different browser gave the correct title; refreshing the URL on the original browser also gave the correct title. The person who found the error didn't keep a copy of the original error, so this makes it difficult to analyse.

It might be independent of the separate-translation mechanism.

Anyway, unless it's reproducible, it can't really qualify as much more than a comment.

Boud Roukema <boud>
Group Member
Sat 30 Jun 2007 10:31:41 AM UTC, comment #4: 

Patch 0.4.1 is almost the same as 0.4 - the difference is in resource_helper.rb, where it generalises from message to resource, since a resource is not always a message.  If it's not a message, we'll assume that no translation is needed since it's not done in other parts of samizdat.

Also in resource_helper.rb, i removed the part of the patch applying to the calendar patch. [If you have previously applied the calendar patch, then make the obvious change by hand - s/related/related_parent/  in just one place - so that the parent article gets attached to the calendar, not the translation.]

[mediawiki: wikipedia user home pages can be translated according to the mediawiki i18n functionality just like ordinary articles: only a namespace convention distinguishes User:John from an article about the subject "John" in general. But i guess nothing stops a user from creating an ordinary article about him/herself. But then whenever s/he updates his/her article, it would appear as an update on the right-hand column of the front page... Anyway, this is a theme for when we start serious blog/social networking functions in samizdat.]

(file #13204)

Boud Roukema <boud>
Group Member
Sat 30 Jun 2007 02:12:43 AM UTC, comment #3: 

The attached file 070629_vs070618_separate_translations-0.4 should fix most of the bugs in the separate-translations function in 070618-1. It's a patch against 070618.

The bugs in 070618-1 occur when the user's preferred language (accept_language) is different to the language of a parent article.

(file #13203)

Boud Roukema <boud>
Group Member
Tue 26 Jun 2007 12:22:18 AM UTC, comment #2: 

The 070618 version of separation-translations is nice and on the right track but still buggy.

See the discussion on the mailing list:

i've set the priority at 8 (between high and immediate) since i18n is a key aspect of samizdat so having it badly functioning in our latest cvs and debian experimental version rather urgently needs fixing...  In principle it's really a bug now, not a patch...

Boud Roukema <boud>
Group Member
Wed 09 May 2007 12:03:55 AM UTC, comment #1: 

updated separate_translation-0.2 to work for samizdat-

(file #12723)

Boud Roukema <boud>
Group Member
Sun 22 Apr 2007 06:22:10 PM UTC, original submission:

--- old/lib/samizdat/engine/resource.rb 2007-02-02 22:57:24.000000000 +0100
+++ /usr/lib/ruby/1.8/samizdat/engine/resource.rb       2007-03-06
01:21:32.143763240 +0100
@@ -84,8 +84,19 @@

r[:head] = CGI.escapeHTML(Template.limit_string(r[:head]))
:title == mode and return cache[cache_key] = r[:head]
+ # separate-translation PATCH:
+ # - link directly to translation rather than to parent original + # - warning: comment threads risk branching and separating by language
+ if config['separate_translations'] and :list == mode + message = Message.cached(@id, @session.showhidden?)
+ translation = message.select_translation(@session.accept_language)
+ return cache[cache_key] = template.resource(, r[:head], r[:desc])
+ end
:list == mode and return cache[cache_key] = template.resource(id, r[:head], r[:desc])

     r[:focuses] = render_focuses if :full == mode
     class << r
       def to_s

--- old/data/samizdat/config.yaml       2007-02-18 15:17:22.000000000 +0100
+++ /etc/samizdat/sites/config.yaml     2007-03-06 01:23:17.845694104 +0100
@@ -139,1 +139,31 @@

+# separate-translation PATCH:
+# This patch links directly to a translation rather than to the parent original,
+# especially for the right-hand column of the front page. For users expecting
+# to see the article in their language, not just a title in their language, +# this patch should make them feel more comfortable.
+# However, unless the user chooses to click on "parent" and add his/her comments
+# to the parent, then his/her comments will only appear as replies to a comment,
+# and not as replies to the main parent article. This may leading to branching
+# off of the threads of a discussion, especially it may generate parallel discussions
+# in different languages which do not meet. When a thread display of discussions
+# is introduced in future versions, this may not be a major problem.
+# UNcomment the line below to ENable this patch. By default it is disabled.
+# To DISable the patch, comment out the line entirely.
+# separate_translations: true
+separate_translations: true

Dmitry Borodaenko <angdraug>
Group administrator


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files
file #13548:  070801_vs070618_separate_translations-0.4.2 added by boud (15KiB - application/octet-stream)
file #13204:  070629_vs070618_separate_translations-0.4.1 added by boud (13KiB - application/octet-stream)
file #13203:  070629_vs070618_separate_translations-0.4 added by boud (13KiB - application/octet-stream)
file #12723:  sep added by boud (3KiB - application/octet-stream - separate_translation-0.2 patch)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by boud (Updated the item)
  • -email is unavailable- added by angdraug (Submitted the item)

    Follow 11 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2008-03-04 angdraug StatusIn Progress Done
        Open/ClosedOpen Closed
    2007-08-02 boud Attached File- Added 070801_vs070618_separate_translations-0.4.2, #13548
        Summaryseparate_translation patch 0.4.1 separate_translation patch 0.4.2 (vs samizdat-
    2007-06-30 boud Summaryseparate_translation patch 0.4 separate_translation patch 0.4.1
    2007-06-30 boud Attached File- Added 070629_vs070618_separate_translations-0.4.1, #13204
    2007-06-30 boud Attached File- Added 070629_vs070618_separate_translations-0.4, #13203
        Summaryseparate_translation patch 0.2 separate_translation patch 0.4
    2007-06-26 boud Priority3 - Low 8
    2007-05-09 boud Attached File- Added sep, #12723
        Summaryseparate_translation patch 0.1 separate_translation patch 0.2

    Back to the top

    Powered by Savane 3.13-1277.
    Corresponding source code