patchSamizdat - Patches: patch #6167, monolanguage-0.3.1 [vs 080703-2] -...

 
 

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

patch #6167: monolanguage-0.3.1 [vs 080703-2] - features + updates on frontpage are optionally shown monolingually

Submitter:  Boud Roukema <boud>
Submitted:  Sat 25 Aug 2007 04:05:08 AM UTC
   
 
Category:  None Priority:  5 - Normal
Status:  Done Privacy:  Public
Assigned to:  None Open/Closed:  Closed

Jump to the original submission

Mon 20 Apr 2009 03:20:02 PM UTC, comment #7: 

Refactored version of this patch is integrated into the latest Samizdat snapshot (0.6.2.20090420-1 in Debian/experimental).

Dmitry Borodaenko <angdraug>
Group administrator
Fri 22 Aug 2008 11:56:54 PM UTC, comment #6: 

Version 0.3.1 has a very tiny change - a line with a single space added at the end - which should make the patch work either with or without the more_links patch 0.2 having been previously applied https://savannah.nongnu.org/patch/?6278 .



(file #16337)

Boud Roukema <boud>
Group Member
Mon 18 Aug 2008 02:38:27 AM UTC, comment #5: 

PS: Version 0.3 requires a one-line fix for a bug in dataset.rb - see https://savannah.nongnu.org/bugs/?24091 - there's a dependency marked here.

Boud Roukema <boud>
Group Member
Mon 18 Aug 2008 02:30:29 AM UTC, comment #4: 

VERSIONS: Should work against 080703-2, probably also against 080811-1.

DISCUSSION: As in previous versions, this only affects the central column and the right-hand column of the frontpage, or else ?page= and ?features_page= requests, since they also use frontpage_controller.rb. TODO: remains doing this for e.g. pages like a list of articles in a focus.

Three general strategies seemed to be possible for rewriting this, given the fact that original articles in the monolanguage and translations in the monolanguage cannot be easily selected with a single SELECT command:

  • (ideal): do the whole thing with a single RdfDataSet command
    • against: the present squish syntax parsing in storage.rb does not look like it can handle UNION, so this would require work on storage.rb
  • (messy): do the whole thing in a single SqlDataSet command, using SELECT .... UNION SELECT ...
    • against: messy, and would go against the whole spirit of samizdat, which is an rdf engine!
  • (compromise): use two RdfDataSet.new commands, creating two dataset objects, and stick them together in frontpage_controller and nav in application_helper.rb
    • against: causes code duplication, e.g. extending monolanguage functionality to other selections such as a focus page will/would require what is more or less code duplication
    • against: the limit and chronology apply separately for the originals and translations, so even though the two resulting lists from the select commands are merged together and sorted, the result could confuse users who expect a single chronological sequence; on the other hand, the chronological order of features is not obvious to the casual reader either
    • for: not as messy as a single SQL query and avoids having to try to dig deep into storage.rb


In any case, here i chose the 3rd option (which is also close to the previous algorithm, but somewhat cleaner thanks to the dataset class :).

COMMENT/TODO: This version (0.3) ignores the calendar patch and will need to be updated slightly depending on how the calendar patch is updated for 080703-2/080811-1.

COMMENT on dataset.rb: A more compact version of the modifications to frontpage_controller.rb in this patch would require a + operation on dataset s (unless storage.rb is modified to allow and implement UNION). Given the relation between "datasets" and the limits used in selections from the database, i'm not sure if it would be easy.

COMMENT on storage.rb: The method translated_features_dataset in frontpage_controller.rb required a dummy rdf triple in order to convince the check_graph method in storage.rb that the graph is valid. IMHO this suggests that something is wrong, since the query IMHO should work correctly without the dummy triple, and if it were wrong, then a dummy should not be able to fool it!



(file #16307)

Boud Roukema <boud>
Group Member
Sat 29 Sep 2007 11:19:36 AM UTC, comment #3: 

several small bug fixes done in monolanguage-0.2

TODO: monolanguage-isation of showing a focus, i.e. in
resource_controller, is not done yet.



(file #14042)

Boud Roukema <boud>
Group Member
Sat 25 Aug 2007 10:11:34 AM UTC, comment #2: 

TODO: Calendar date foci which are temporarily shown in the centre
column from event_date-2 to event_date-0 days are not
monolingualised. Should this be done with the present version
of calendar, or would it be to wait till a better version of
calendar?

Boud Roukema <boud>
Group Member
Sat 25 Aug 2007 10:08:16 AM UTC, comment #1: 

Ignore the last paragraph in the initial comment after "...preferences, but it's something that could be tidied up." - it's just internal notes.

Boud Roukema <boud>
Group Member
Sat 25 Aug 2007 04:05:08 AM UTC, original submission:  

SUMMARY

People brought up monolingually get discouraged by seeing too much
text in other languages on a web page, even if they know that it's
important information. Since samizdat is highly i18n-ised, it's not so
easy to monolingualise it, because then users will lose a lot of the
structure to the site and access to information. This patch provides
the user with a "mono" button (top-right) to force monolinguality (a
cookie is set) for the features and updates, i.e. the middle and
right-hand columns of the frontpage. If nobody has translated ordinary
or feature articles into the preferred language of the user, then s/he
will see a nearly empty page after clicking "mono".  If s/he decides to
cross the border by clicking "multi", then everything returns to normal,
with articles being listed as much as possible in the preferred language.

CONFIG:

  • config: Sysadmin must put the line


monolanguage: true

in the site or default yaml file.


HOW IT WORKS:

  • member_controller.rb - get monolanguage parameter

   /member/set?lang=monolanguage

  • request.rb  - @request.monolanguage?  method


  • frontpage_controller.rb


If monolanguage is set, then collect_features and collect_updates
are modified to list only

  • features (updates) which are original (parent) articles in the preferred

language

  • features (updates) which are child articles in the preferred language

and which are related to Focus::Translation
and then sort them by decreasing ID.

Forcing to monolinguality is not done elsewhere in the 0.1 patch,
but hopefully this should be enough to satisfy people annoyed at too
much text that they don't understand.

The language list has "| mono multi" added with appropriate html markup.
The presently valid one is strong and the other one is an a href.
(i also un-a-href-ed the presently preferred language - this is not a major
issue, but i thought there's no need to propose to people to click on
something which will have no effect.)

The cache keys for collect_features, collect_updates and also the general
frontpage cache key have had labels added in order that caching does not
prevent showing changes to the user.


Possible TODO: limit ends up being evaluated at somewhere between
limit and 2*limit because of originals + translations - there could be
many or few of either. i don't know how important this is to people's
preferences, but it's something that could be tidied up.


- need different caches for different monolanguages, since the set of
objects stored are different for different langs  OK
- need to do something for when set of messages is empty -> this was
not the bug - see the message_helper bug

  • config.yaml  e.g.  monolanguage: true


Boud Roukema <boud>
Group Member

 

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

Attached Files
file #16307:  080818_monolanguage-0.3.patch added by boud (9KiB - text/x-patch)
file #14042:  070929_monolanguage-0.2.patch added by boud (9KiB - text/x-patch)
file #13789:  070825_monolanguage-0.1 added by boud (8KiB - application/octet-stream)

 

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

    Follow 10 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2009-04-20 angdraug StatusWorks For Me Done
        Open/ClosedOpen Closed
    2008-08-22 boud Attached File- Added 080823_monolanguage-0.3.1.patch, #16337
        Summarymonolanguage-0.3 [vs 080703-2] - features + updates on frontpage are optionally shown monolingually monolanguage-0.3.1 [vs 080703-2] - features + updates on frontpage are optionally shown monolingually
    2008-08-18 boud Dependencies- Depends on bugs #24091
    2008-08-18 boud Attached File- Added 080818_monolanguage-0.3.patch, #16307
        Summarymonolanguage-0.2 - features + updates on frontpage are optionally shown monolingually monolanguage-0.3 [vs 080703-2] - features + updates on frontpage are optionally shown monolingually
    2007-09-29 boud Attached File- Added 070929_monolanguage-0.2.patch, #14042
        Summarymonolanguage-0.1 - features + updates on frontpage are optionally shown monolingually monolanguage-0.2 - features + updates on frontpage are optionally shown monolingually
    2007-08-25 boud Attached File- Added 070825_monolanguage-0.1, #13789

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code