New status filter for plural
claudiu.cristea - October 15, 2009 - 11:55
| Project: | Localization server |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | claudiu.cristea |
| Status: | needs review |
Description
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.
| Attachment | Size |
|---|---|
| l10n_server_plural_filter-D6.patch | 3.76 KB |

#1
+++ 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.
#2
That was my first thought but I didn't want to alter the table structure...
#3
Here's a patch reflecting #1.
#4
The above patch is incomplete... Use this one.
#5
Added also filtering on the moderation page.
#6
Much better direction IMHO! The patch does not add the field to fresh installs though.
#7
You're right. Here's the fix...
#8
Forgot the the ticket status...
#9
subscribe