updated core and some modules

This commit is contained in:
2017-02-27 13:42:16 +01:00
parent 8a300d7d79
commit b38c8e71d1
228 changed files with 2503 additions and 750 deletions
@@ -0,0 +1,65 @@
CONTENTS OF THIS FILE
---------------------
* Introduction
* Requirements
* Recommended modules
* Installation
* Configuration
* Maintainers
INTRODUCTION
------------
The Field translation module, part of the Internationalization (https://www.drupal.org/project/i18n) package, allows for translation of text associated with a field's settings including the label, help text, default value, and list options.
* For a full description of the module, visit this page https://www.drupal.org/node/1279346
* To submit bug reports and feature suggestions, or to track changes visit https://www.drupal.org/project/issues/i18n
REQUIREMENTS
------------
This module requires the following modules:
Internationalization (https://www.drupal.org/project/i18n)
RECOMMENDED MODULES
-------------------
* Internationalization Views (https://www.drupal.org/project/i18nviews)
* Language Icons (https://www.drupal.org/project/languageicons)
* Translation Overview (https://www.drupal.org/project/translation_overview)
* Localization Client (https://www.drupal.org/project/l10n_client)
* Internationalization contributions (https://www.drupal.org/project/i18n_contrib)
INSTALLATION
------------
* This is a submodule of the Internationalization module. Install the Internationalization module as you would normally install a contributed Drupal module. Visit https://drupal.org/documentation/install/modules-themes/modules-7 for further information.
CONFIGURATION
-------------
1. Enable the Field translation module included with Internationalization.
2. Go to Administration > Configuration > Regional and language > Translate interface.
3. Click on Filter Translatable Strings field set and limit search to fields.
4. Edit the desired field and Save.
For the translation to be displayed, you need to use some of the Field Formatters provided by this module whose name usually ends up in 'translated'. For most core fields it is Default translated.
Note: The Field Translation module does not provide content translation for fields. This functionality is provided by the Entity Translation (ET) module.
MAINTAINERS
-----------
* Jose Reyero - https://www.drupal.org/u/jose-reyero
* Florian Weber (webflo) - https://www.drupal.org/u/webflo
* Peter Philipp - https://www.drupal.org/u/das-peter
* Joseph Olstad - https://www.drupal.org/u/joseph.olstad
* Nathaniel Catchpole - https://www.drupal.org/u/catch
@@ -6,9 +6,9 @@ package = Multilingual - Internationalization
core = 7.x
files[] = i18n_field.inc
files[] = i18n_field.test
; Information added by Drupal.org packaging script on 2016-10-22
version = "7.x-1.14"
; Information added by Drupal.org packaging script on 2017-01-31
version = "7.x-1.15"
core = "7.x"
project = "i18n"
datestamp = "1477154943"
datestamp = "1485834792"
@@ -446,3 +446,69 @@ function i18n_field_type_info($type = NULL, $property = NULL) {
return $info;
}
}
/**
* Implements hook_field_info_alter().
*/
function i18n_field_field_info_alter(&$field_info) {
foreach(array_keys($field_info) as $type) {
$field_info[$type]['property_callbacks'][] = 'i18n_field_entity_property_callback';
}
}
/**
* Callback to translate entity property info for a fields.
*
* @see entity_metadata_field_entity_property_info()
* @see entity_metadata_field_default_property_callback()
* @see i18n_field_i18n_object_info_alter()
* @see hook_module_implements_alter()
*/
function i18n_field_entity_property_callback(&$info, $entity_type, $field, $instance, $field_type) {
global $language;
// This could create a endless recursion if it's called during rebuilding the
// cache for i18n_object_info(). So if the cache of i18n_object_info isn't
// available yet we assume the worst case, leave the info alone but trigger a
// rebuild of the property when hook_i18n_object_info_alter is invoked. At
// that point the info is available and we can rely on it.
if (!$info = &drupal_static('i18n_object_info')) {
$i18n_field_entity_property_callback_fallback = &drupal_static(__FUNCTION__);
$i18n_field_entity_property_callback_fallback = TRUE;
return;
}
$name = $field['field_name'];
$property = &$info[$entity_type]['bundles'][$instance['bundle']]['properties'][$name];
$property['label'] = i18n_field_translate_property($instance, 'label', $language->language);
}
/**
* Implements hook_i18n_object_info_alter().
*/
function i18n_field_i18n_object_info_alter(&$info) {
if (drupal_static('i18n_field_entity_property_callback')) {
if ($info = drupal_static('i18n_object_info')) {
// Clean static and permanent cache of the data and then re-run the property
// building.
drupal_static_reset('entity_get_property_info');
cache_clear_all('entity_property_info:' . $GLOBALS['language']->language, 'cache');
entity_get_property_info();
}
else {
watchdog('i18n_field', 'Unable to run fall-back handling for entity property translation due missing "i18n_object_info" cache', array(), WATCHDOG_WARNING);
}
}
}
/**
* Implements hook_module_implements_alter().
*/
function i18n_field_module_implements_alter(&$implementations, $hook) {
if ($hook == 'i18n_object_info_alter') {
// Move our hook implementation to the bottom.
$group = $implementations['i18n_field'];
unset($implementations['i18n_field']);
$implementations['i18n_field'] = $group;
}
}