Add a latest translations and a top translators block

Dave Reid - June 12, 2009 - 17:35
Project:Localization server
Version:6.x-1.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Dave Reid
Status:needs review
Description

It's helpful for me to see the latest translation activity and who my top translators are. Plus, I think having these two blocks helps out the 'community' aspect as it recognizes both the top contributors and the people who have recently helped translate. It also gives me a chance to help glance and quick review the latest translations.

I could probably spruce these up a little more with configuration options and I'm not sure if I can link directly to the page for a specific translation string. But it's a start and I'm running these blocks on project.davereid.net just fine!

#1

Dave Reid - June 12, 2009 - 17:37
Status:active» needs review

Patch attached for review. Sorry, my IDE auto-corrects trailing whitespace, so there's not too much I can do since I don't like to disable it. :)

AttachmentSize
490020-blocks.patch 13.57 KB

#2

Pasqualle - June 12, 2009 - 19:51

+1
yes, especially a core committer should use a text editor which automatically removes trailing spaces. It is really bad to create and read patches like this. This is the no 2 reason when I want to contribute but I refuse to.. no 1 is the limited time..

#3

pvasili - June 18, 2009 - 11:20

You can make SQL queries on the PHP block. It's easy ;)

I think more useful to integrate in the VotingAPI (see at: http://drupaler.ru/translate/download)

#4

Dave Reid - June 18, 2009 - 13:28

@pvasili: I know that I can create an SQL PHP block, but it would be nicer if the module could provide these blocks. Using an SQL PHP block is not easy for end-users. Using VotingAPI and your links have nothing to do with this feature request either. Please create a separate issue report.

#5

Gábor Hojtsy - October 2, 2009 - 08:51

The idea looks cool. However, to make this work on heavy duty sites like localize.drupal.org, we need to cache this data heavily.

#6

podarok - October 17, 2009 - 11:11

subscribe

looking for adding counters for suggested+approved+declined+notapproved_suggestions for every user too...

#7

claudiu.cristea - October 17, 2009 - 18:59

@Gábor Hojtsy,

However, to make this work on heavy duty sites like localize.drupal.org, we need to cache this data heavily.

I think that implementing some cache clearing for native block caching may be enough. Administrators can enable the Block caching.

The default BLOCK_CACHE_PER_ROLE is suitable. We only have to implement:

cache_clear_all('l10n_community:latest_translations:', 'cache_block', TRUE);
cache_clear_all('l10n_community:top_translators:', 'cache_block', TRUE);

where the table {l10n_community_translations} get INSERTed/UPDATEd/DELETEed.

#8

Gábor Hojtsy - October 19, 2009 - 07:03

@claudiu.cristea: given how often that table changes, that would be almost identical to no caching. We need to accept some staleness of that data at least. Maybe even include the date of generation in the block and leave it stale for a day or so.

#9

podarok - October 19, 2009 - 09:14

one day - is a good period for recalculation...

#10

claudiu.cristea - November 6, 2009 - 16:27
Status:needs review» needs work

#11

claudiu.cristea - November 6, 2009 - 18:16
Status:needs work» needs review

This patch add caching to #1.

AttachmentSize
l10n_server_blocks-490020-D6.patch 3.56 KB

#12

claudiu.cristea - November 6, 2009 - 18:20

Ups... There was a bug in the above patch...

Check this one...

AttachmentSize
l10n_server_blocks-490020-1-D6.patch 3.56 KB
 
 

Drupal is a registered trademark of Dries Buytaert.