Sometimes we want to see only translations with plurals.

This patch add a new status filter that add the ability to show all translations that have plural.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Gábor Hojtsy’s picture

Status: Needs review » Needs work
+++ l10n_community/translate.inc	15 Oct 2009 11:47:23 -0000
@@ -693,7 +704,13 @@ function l10n_community_get_strings($lan
+  if ($filters['status'] & L10N_STATUS_HAS_PLURAL) {
+    $where[] = "LOCATE(CHAR(0), s.value) > 0";
+  }
+  elseif ($filters['status'] & L10N_STATUS_NO_PLURAL) {
+    $where[] = "LOCATE(CHAR(0), s.value) = 0";
+  }

This code fragment pretty much shows why this approach fails badly. If we use LOCATE(), the database will need to run this function on each row, which prohibits using any indexes.

I'd say we'd rather cache this data in a column and do this calculation only once when the source string is inserted into the database.

This review is powered by Dreditor.

claudiu.cristea’s picture

That was my first thought but I didn't want to alter the table structure...

claudiu.cristea’s picture

Status: Needs work » Needs review
FileSize
4.92 KB

Here's a patch reflecting #1.

claudiu.cristea’s picture

The above patch is incomplete... Use this one.

claudiu.cristea’s picture

Added also filtering on the moderation page.

Gábor Hojtsy’s picture

Status: Needs review » Needs work

Much better direction IMHO! The patch does not add the field to fresh installs though.

claudiu.cristea’s picture

You're right. Here's the fix...

claudiu.cristea’s picture

Status: Needs work » Needs review

Forgot the the ticket status...

podarok’s picture

subscribe

Gábor Hojtsy’s picture

Title: New status filter for plural » Add status filter for plural/not plural

Retitled. There are basically two things which make me hesitant to load in more filters: #581342: String filter form too wide and that the indexes on the tables are not performing well for the current wide ranging filters already (think database query performance). It is probably not possible to optimize for use of arbitrary filters, so we need to balance flexibility and speed.

claudiu.cristea’s picture

It seems an important improvement in terms of usability... at least for me :)

Getting to the point...

  1. #581342: String filter form too wide is complaining about wideness while this additional status filter increases the height. So, this feature cannot break the layout. It simply add more vertical scrolling. I can see the frustration when you are using a =< 13" display... that's why scrolling was invented :)
  2. We have a new, boolean, indexed field for plural filtering. This should be fast enough. I don't think that this new field/index can depreciate the existing performance. I don't have a large enough DB to benchmark this but it shouldn't affect the performance.
Gábor Hojtsy’s picture

Status: Needs review » Needs work

Ok, I think the latest UI changes make it possible to add these filters more easily. Let's do it.

Gábor Hojtsy’s picture

Added #1118430: Set up the filtering/display setting UI for future growth to set us up for filter extensions like this.