Hi all.

I have big problems translating short phrases that can be found in many strings and translate differently according to context, like "No" (abbr for Number or negation) or "item" (also very common and many meanings acc to context). The problems don't occur on empty Drupal installation, but on site that has many translated strings, and to find such a string I had to navigate through 20 or more pages of translations under /admin/config/regional/translate/translate.

There should be an API to allow users to add custom filters to the translate interface page - by hook_form_alter or at least hook_form_alter and query tag -> hook_query_alter so Users can add a new query filter for this page.

To add a context filter I find very usefull, I had to add 'context' to the fields array in _locale_translate_seek_query (l. 1959 in locale.inc) and in _locale_translate_seek: 'context' => 'all' in $query (l. 1854) and small additional piece of code in this function below:

// Add condition on text context.
if (!empty($query['context']) && $query['context'] != 'all') {
$sql_query->condition('s.context', $query['context']);
}

I tried to do this "the Drupal way", but with no success, no hook could help, the filters are frozen in locale.inc that I had to hack.

I can help with development and contribute to the core, but so far I have no privileges, just 2 sandbox modules.

Please PM me if you want a new contributor, and I find the issue important, so hope it gets resolved.

Comments

Graber’s picture

Heeey, what a surprise, totally ignored, as all my new posts. Am I doing something wrong here???

Graber’s picture

Version: 7.24 » 7.28
Priority: Normal » Major
David_Rothstein’s picture

Title: Translation of short common strings found almost everywhere » Make it easier to alter the translation interface filters (use case: translation of short common strings found almost everywhere)
Version: 7.28 » 7.x-dev
Priority: Major » Normal
Status: Needs work » Active

Thanks for contributing, Graber!

It's common for issues to not receive comments (if no one else happens to be running into the same problem, or if others are but don't take the time to participate). Sometimes issues will sit around for a while and then get active eventually, at a random time. You never really know.

There are no special requirements or permissions needed to contribute to core; you can just post a patch (see, for example, https://drupal.org/node/1319154) and set the issue to "needs review". Often issues in this state get more attention.

I'm not too familiar with this part of the code but I took a look and see what you're saying. I agree that at least a query tag on the query run by _locale_translate_seek() (and maybe more) would be useful for someone trying to alter this form, and at first glance this seems appropriate for Drupal 7.

If the issue affects Drupal 8 too it should be moved there first (with the "Needs backport to D7" issue tag added), and it will also get much more attention that way... It seems likely this one is already fixed in Drupal 8 though, but I'm not positive.