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!

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Dave Reid’s picture

Status: Active » Needs review
FileSize
13.57 KB

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. :)

Pasqualle’s picture

+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..

pvasili’s picture

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)

Gábor Hojtsy’s picture

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

podarok’s picture

subscribe

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

claudiu.cristea’s picture

@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.

Gábor Hojtsy’s picture

@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.

podarok’s picture

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

claudiu.cristea’s picture

Status: Needs review » Needs work
claudiu.cristea’s picture

Status: Needs work » Needs review
FileSize
3.56 KB

This patch add caching to #1.

claudiu.cristea’s picture

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

Check this one...

tobiasb’s picture

FileSize
4.26 KB

my version

Gábor Hojtsy’s picture

Looking at the patch, I think the latest translations block is not useful at all on a server the scale of localize.drupal.org, because showing the last 10 strings and then caching for a day will not show much. To show the site activity, I think #599322: Add activity 2.x integration has a better objective / strategy (it also shows when people moderate, import a .po file, etc).

For the top contributors block, we already have this per group in l10n_group. It would be good to generalize this, maybe even make it a block and then reuse all around. There is also #587686: Add more granular contributor statistics about adding thing like "recent top contributors".

Gábor Hojtsy’s picture