summaryrefslogtreecommitdiff
path: root/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_string/i18n_string.pages.inc
diff options
context:
space:
mode:
Diffstat (limited to 'kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_string/i18n_string.pages.inc')
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_string/i18n_string.pages.inc17
1 files changed, 15 insertions, 2 deletions
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_string/i18n_string.pages.inc b/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_string/i18n_string.pages.inc
index 86e7432..28005d6 100644
--- a/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_string/i18n_string.pages.inc
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/i18n/i18n_string/i18n_string.pages.inc
@@ -12,7 +12,14 @@ include_once DRUPAL_ROOT . '/includes/locale.inc';
include_once drupal_get_path('module', 'locale') . '/locale.admin.inc';
/**
- * Generate translate page from object
+ * Generate translate page from object.
+ *
+ * @param string $object_type
+ * Obejct type as declared in hook_i18n_object_info().
+ * @param object $object_value
+ * Drupal object to translate.
+ * @param object $language
+ * Optional language object.
*/
function i18n_string_translate_page_object($object_type, $object_value, $language = NULL) {
// For backwards compatibility, ensure parameter is a language object
@@ -22,6 +29,13 @@ function i18n_string_translate_page_object($object_type, $object_value, $languag
$object = i18n_object($object_type, $object_value);
$strings = $object->get_strings(array('empty' => TRUE));
+ // If no localizable strings, print message and fail gracefully.
+ // Possibly this object comes from some other contrib module.
+ // See http://drupal.org/node/1889878
+ if (!$strings) {
+ return t('This object has no strings available for translation.');
+ }
+
if (empty($langcode)) {
drupal_set_title(t('Translate !name', array('!name' => i18n_object_info($object_type, 'title'))));
return i18n_string_translate_page_overview($object, $strings);
@@ -44,7 +58,6 @@ function i18n_string_translate_page_overview($object, $strings) {
* Provide a core translation module like overview page for this object.
*/
function i18n_string_translate_page_overview_form($form, &$form_state, $object, $strings) {
- //include_once DRUPAL_ROOT . '/includes/language.inc';
// Set the default item key, assume it's the first.
$item_title = reset($strings);
$header = array(