diff options
author | Angie Byron <webchick@24967.no-reply.drupal.org> | 2009-02-05 00:32:47 +0000 |
---|---|---|
committer | Angie Byron <webchick@24967.no-reply.drupal.org> | 2009-02-05 00:32:47 +0000 |
commit | c6dd7bec5e09c9a381f18f90baf9dacb280bd4cf (patch) | |
tree | 5742a91078d7eb814dbd173a28b51d0b1a188a24 /modules | |
parent | 62b05eb6a3b40629fc191ec7f0ffa76266941839 (diff) | |
download | brdo-c6dd7bec5e09c9a381f18f90baf9dacb280bd4cf.tar.gz brdo-c6dd7bec5e09c9a381f18f90baf9dacb280bd4cf.tar.bz2 |
#52990 by Roger López: Vastly improve translation string search and editing interface.
Diffstat (limited to 'modules')
-rw-r--r-- | modules/locale/locale.css | 15 | ||||
-rw-r--r-- | modules/locale/locale.module | 25 | ||||
-rw-r--r-- | modules/locale/locale.test | 14 |
3 files changed, 44 insertions, 10 deletions
diff --git a/modules/locale/locale.css b/modules/locale/locale.css index c9c8df509..b73d5b48b 100644 --- a/modules/locale/locale.css +++ b/modules/locale/locale.css @@ -4,3 +4,18 @@ font-style: normal; text-decoration: line-through; } + +#edit-language-wrapper, #edit-translation-wrapper, #edit-group-wrapper { + float: left; /* LTR */ + padding-right: .8em; /* LTR */ + margin: 0.1em; + /** + * In Opera 9, DOM elements with the property of "overflow: auto" + * will partially hide its contents with unnecessary scrollbars when + * its immediate child is floated without an explicit width set. + */ + width: 15em; +} +#locale-translation-filter-form .form-item select.form-select { + width: 100%; +} diff --git a/modules/locale/locale.module b/modules/locale/locale.module index 71c2959bd..4f17b27d4 100644 --- a/modules/locale/locale.module +++ b/modules/locale/locale.module @@ -32,7 +32,7 @@ function locale_help($path, $arg) { case 'admin/settings/language': $output = '<p>' . t("This page provides an overview of your site's enabled languages. If multiple languages are available and enabled, the text on your site interface may be translated, registered users may select their preferred language on the <em>My account</em> page, and site authors may indicate a specific language when creating posts. Languages will be displayed in the order you specify in places such as the language switcher block, or the language dropdown when creating or editing posts. The site's default language is used for anonymous visitors and for users who have not selected a preferred language.") . '</p>'; $output .= '<p>' . t('For each language available on the site, use the <em>edit</em> link to configure language details, including name, an optional language-specific path or domain, and whether the language is natively presented either left-to-right or right-to-left. These languages also appear in the <em>Language</em> selection when creating a post of a content type with multilingual support.') . '</p>'; - $output .= '<p>' . t('Use the <a href="@add-language">add language page</a> to enable additional languages (and automatically import files from a translation package, if available), the <a href="@search">translate interface page</a> to locate strings for manual translation, or the <a href="@import">import page</a> to add translations from individual <em>.po</em> files. A number of contributed translation packages containing <em>.po</em> files are available on the <a href="@translations">Drupal.org translations page</a>.', array('@add-language' => url('admin/settings/language/add'), '@search' => url('admin/build/translate/search'), '@import' => url('admin/build/translate/import'), '@translations' => 'http://drupal.org/project/translations')) . '</p>'; + $output .= '<p>' . t('Use the <a href="@add-language">add language page</a> to enable additional languages (and automatically import files from a translation package, if available), the <a href="@search">translate interface page</a> to locate strings for manual translation, or the <a href="@import">import page</a> to add translations from individual <em>.po</em> files. A number of contributed translation packages containing <em>.po</em> files are available on the <a href="@translations">Drupal.org translations page</a>.', array('@add-language' => url('admin/settings/language/add'), '@search' => url('admin/build/translate/translate'), '@import' => url('admin/build/translate/import'), '@translations' => 'http://drupal.org/project/translations')) . '</p>'; $output .= '<p>' . t('To rearrange languages, grab a drag-and-drop handle under the <em>English name</em> column and drag the item to a new location in the list. (Grab a handle by clicking and holding the mouse while hovering over a handle icon.) Remember that your changes will not be saved until you click the <em>Save configuration</em> button at the bottom of the page.') . '</p>'; return $output; case 'admin/settings/language/add': @@ -55,7 +55,7 @@ function locale_help($path, $arg) { return $output; case 'admin/build/translate/export': return '<p>' . t('This page exports the translated strings used by your site. An export file may be in Gettext Portable Object (<em>.po</em>) form, which includes both the original string and the translation (used to share translations with others), or in Gettext Portable Object Template (<em>.pot</em>) form, which includes the original strings only (used to create new translations with a Gettext translation editor).') . '</p>'; - case 'admin/build/translate/search': + case 'admin/build/translate/translate': return '<p>' . t('This page allows a translator to search for specific translated and untranslated strings, and is used when creating or editing translations. (Note: For translation tasks involving many strings, it may be more convenient to <a href="@export">export</a> strings for offline editing in a desktop Gettext translation editor.) Searches may be limited to strings found within a specific text group or in a specific language.', array('@export' => url('admin/build/translate/export'))) . '</p>'; case 'admin/build/block/configure': if ($arg[4] == 'locale' && $arg[5] == 0) { @@ -124,8 +124,8 @@ function locale_menu() { 'weight' => 0, 'type' => MENU_DEFAULT_LOCAL_TASK, ); - $items['admin/build/translate/search'] = array( - 'title' => 'Search', + $items['admin/build/translate/translate'] = array( + 'title' => 'Translate', 'weight' => 10, 'type' => MENU_LOCAL_TASK, 'page callback' => 'locale_translate_seek_screen', // search results and form concatenated @@ -314,6 +314,9 @@ function locale_theme() { 'locale_languages_overview_form' => array( 'arguments' => array('form' => array()), ), + 'locale_translation_filters' => array( + 'arguments' => array('form' => array()), + ), ); } @@ -596,3 +599,17 @@ function locale_block_view($delta = '') { return $block; } } + +/** + * Theme locale translation filter selector. + * + * @ingroup themeable + */ +function theme_locale_translation_filters($form) { + $output = ''; + foreach (element_children($form['status']) as $key) { + $output .= drupal_render($form['status'][$key]); + } + $output .= '<div id="locale-translation-buttons">' . drupal_render($form['buttons']) . '</div>'; + return $output; +} diff --git a/modules/locale/locale.test b/modules/locale/locale.test index 79a578e94..ebd7febbc 100644 --- a/modules/locale/locale.test +++ b/modules/locale/locale.test @@ -37,7 +37,7 @@ class LocaleTestCase extends DrupalWebTestCase { // Add language. $this->drupalLogin($admin_user); - $edit = array ( + $edit = array( 'langcode' => $langcode, 'name' => $name, 'native' => $native, @@ -65,7 +65,7 @@ class LocaleTestCase extends DrupalWebTestCase { 'translation' => 'all', 'group' => 'all', ); - $this->drupalPost('admin/build/translate/search', $search, t('Search')); + $this->drupalPost('admin/build/translate/translate', $search, t('Filter')); // assertText seems to remove the input field where $name always could be // found, so this is not a false assert. See how assertNoText succeeds // later. @@ -75,7 +75,9 @@ class LocaleTestCase extends DrupalWebTestCase { // reasonable. $this->clickLink(t('edit')); // We save the lid from the path. - $lid = preg_replace('/\D/', '', substr($this->getUrl(), strlen($base_url))); + $matches = array(); + preg_match('!admin/build/translate/edit/(\d)+!', $this->getUrl(), $matches); + $lid = $matches[1]; // No t() here, it's surely not translated yet. $this->assertText($name, 'name found on edit screen'); $edit = array ( @@ -84,7 +86,7 @@ class LocaleTestCase extends DrupalWebTestCase { $this->drupalPost(NULL, $edit, t('Save translations')); $this->assertText(t('The string has been saved.'), 'The string has been saved.'); $this->assertTrue($name != $translation && t($name, array(), $langcode) == $translation, 't() works'); - $this->drupalPost('admin/build/translate/search', $search, t('Search')); + $this->drupalPost('admin/build/translate/translate', $search, t('Filter')); // The indicator should not be here. $this->assertNoRaw($language_indicator, 'String is translated'); $this->drupalLogout(); @@ -107,7 +109,7 @@ class LocaleTestCase extends DrupalWebTestCase { $this->drupalLogin($translate_user); $this->drupalPost('admin/build/translate/delete/' . $lid, array(), t('Delete')); $this->assertText(t('The string has been removed.'), 'The string has been removed message.'); - $this->drupalPost('admin/build/translate/search', $search, t('Search')); + $this->drupalPost('admin/build/translate/translate', $search, t('Filter')); $this->assertNoText($name, 'Search now can not find the name'); } @@ -155,7 +157,7 @@ class LocaleTestCase extends DrupalWebTestCase { 'translation' => 'all', 'group' => 'all', ); - $this->drupalPost('admin/build/translate/search', $search, t('Search')); + $this->drupalPost('admin/build/translate/translate', $search, t('Filter')); // Find the edit path $content = $this->drupalGetContent(); $this->assertTrue(preg_match('@(admin/build/translate/edit/[0-9]+)@', $content, $matches), t('Found the edit path')); |