updated i18n i10n_update workflwo imachecache_actions

This commit is contained in:
2020-06-23 12:41:21 +02:00
parent 8c39ab6f4a
commit 092758ecb0
134 changed files with 2894 additions and 1205 deletions
@@ -20,7 +20,7 @@ For support, please create a support request for this module's project:
Support questions by email to the module maintainer will be simply ignored. Use the issue tracker.
Now if you want professional (paid) support the module maintainer may be available occassionally.
Now if you want professional (paid) support the module maintainer may be available occasionally.
Drop me a message to check availability and hourly rates, http://reyero.net/en/contact
====================================================================
@@ -8,9 +8,8 @@ files[] = i18n_object.inc
files[] = i18n.test
configure = admin/config/regional/i18n
; Information added by Drupal.org packaging script on 2017-01-31
version = "7.x-1.15"
; Information added by Drupal.org packaging script on 2020-06-17
version = "7.x-1.27"
core = "7.x"
project = "i18n"
datestamp = "1485834792"
datestamp = "1592373390"
@@ -198,7 +198,8 @@ function i18n_language_field_extra() {
*/
function i18n_language_list($field = 'name', $mode = NULL) {
$mode = isset($mode) ? $mode : variable_get('i18n_language_list', I18N_LANGUAGE_ENABLED);
return locale_language_list($field, I18N_LANGUAGE_EXTENDED & $mode);
$all = I18N_LANGUAGE_EXTENDED & $mode;
return locale_language_list($field, $all);
}
/**
@@ -13,43 +13,56 @@ CONTENTS OF THIS FILE
INTRODUCTION
------------
The Block languages module, part of the Internationalization (https://www.drupal.org/project/i18n) package, allows the user to configure for which languages each block is visible.
The Block languages module, part of the Internationalization
(https://www.drupal.org/project/i18n) package, allows the user to configure
for which languages each block is visible.
* For a full description of the module, visit https://www.drupal.org/node/1279698
* For a full description of the module,
visit https://www.drupal.org/node/1279698.
* To submit bug reports and feature suggestions, or to track changes visit https://www.drupal.org/project/issues/i18n
* 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:
This module requires the following module:
Internationalization - https://www.drupal.org/project/i18n
* 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
* 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://www.drupal.org/docs/7/extending-drupal-7/installing-contributed-modules-find-import-enable-configure-drupal-7 for further information.
This is a submodule of the Internationalization module. Install the
Internationalization module as you would normally install a contributed Drupal
module. Visit https://www.drupal.org/node/895232 for further information.
CONFIGURATION
-------------
The settings for visibility per language are provided under Visibility Settings via the Languages tab when configuring a block.
The settings for visibility per language are provided under Visibility
Settings via the Languages tab when configuring a block.
The Languages tab also provides a setting for whether the block is translatable. For custom blocks, the block title and the block content will be translatable. For blocks defined by modules, only the block title will be translatable. If "Make this block translatable" is selected, a Translate tab will appear for that block. This tab provides a UI for adding translations of the block in each available language.
The Languages tab also provides a setting for whether the block is translatable.
For custom blocks, the block title and the block content will be translatable.
For blocks defined by modules, only the block title will be translatable. If
"Make this block translatable" is selected, a Translate tab will appear for that
block. This tab provides a UI for adding translations of the block in each
available language.
TROUBLESHOOTING
@@ -57,11 +70,16 @@ TROUBLESHOOTING
Conflicts with Context
The Block languages module conflicts with the Context module, which alters how blocks are rendered. This issue can be tracked in the Internationalization issue queue: http://drupal.org/node/1343044
The Block languages module conflicts with the Context module, which alters how
blocks are rendered. This issue can be tracked in the Internationalization
issue queue: http://drupal.org/node/1343044
String Errors
The user must allow your used string format to be translated on admin/config/regional/i18n/strings or you are going to have a error message like "The string blocks:block:1:body for textgroup blocks is not allowed for translation because of its text format."
The user must allow your used string format to be translated on
admin/config/regional/i18n/strings or you are going to have an error message
like "The string blocks:block:1:body for textgroup blocks is not allowed for
translation because of its text format."
MAINTAINERS
@@ -8,9 +8,8 @@ files[] = i18n_block.inc
files[] = i18n_block.test
; Information added by Drupal.org packaging script on 2017-01-31
version = "7.x-1.15"
; Information added by Drupal.org packaging script on 2020-06-17
version = "7.x-1.27"
core = "7.x"
project = "i18n"
datestamp = "1485834792"
datestamp = "1592373390"
@@ -37,6 +37,17 @@ function i18n_block_menu() {
return $items;
}
/**
* Implements hook_permission().
*/
function i18n_block_permission() {
return array(
'translate blocks' => array(
'title' => t('Translate Blocks'),
),
);
}
/**
* Implement hook_menu_alter().
*
@@ -59,7 +70,7 @@ function i18n_block_menu_alter(&$items) {
*/
function i18n_block_translate_tab_access($module, $delta) {
$block = block_load($module, $delta);
return user_access('translate interface') && $block && isset($block->i18n_mode) && ($block->i18n_mode == I18N_MODE_LOCALIZE);
return (user_access('translate interface') || user_access('translate blocks')) && $block && isset($block->i18n_mode) && ($block->i18n_mode == I18N_MODE_LOCALIZE);
}
/**
@@ -226,7 +237,7 @@ function i18n_block_form_block_admin_configure_alter(&$form, &$form_state, $form
'#options' => i18n_language_list(),
'#description' => t('If no language is selected, block will show regardless of language.'),
);
if (user_access('translate interface')) {
if (user_access('translate interface') || user_access('translate blocks')) {
$form['actions']['translate'] = array(
'#type' => 'submit',
'#name' => 'save_translate',
@@ -72,15 +72,16 @@ class i18nBlocksTestCase extends Drupali18nTestCase {
$this->clickLink(t('translate'));
// Title is a textarea, body is a text_format.
$this->assertFieldByName('strings[blocks:block:' . $box2['delta'] . ':title]', $translations['title']['es']);
$this->assertFieldByName('strings[blocks:block:' . $box2['delta'] . ':body]', $translations['body']['es']);
$this->assertFieldByName('strings[blocks:block:' . $box2['delta'] . ':body][value]', $translations['body']['es']);
// Update the translation.
$translations['title']['es'] = $this->randomName(10);
$translations['body']['es'] = $this->randomName(20);
$edit = array(
'strings[blocks:block:' . $box2['delta'] . ':title]' => $translations['title']['es'],
'strings[blocks:block:' . $box2['delta'] . ':body]' => $translations['body']['es'],
'strings[blocks:block:' . $box2['delta'] . ':body][value]' => $translations['body']['es'],
);
$this->drupalPost(NULL, $edit, t('Save translation'));
$this->i18nAssertTranslations($translations['title'], '', 'Updated block title translation displayed.');
@@ -12,47 +12,56 @@ CONTENTS OF THIS FILE
INTRODUCTION
------------
The Contact translation module, part of the Internationalization (https://www.drupal.org/project/i18n) package, helps with the multilingual configuration of the site contact forms. This module makes contact categories and replies available for translation.
The Contact translation module, part of the Internationalization
(https://www.drupal.org/project/i18n) package, helps with the multilingual
configuration of the site contact forms. This module makes contact categories
and replies available for translation.
* For a full description of the module, visit https://www.drupal.org/node/1396984
* For a full description of the module, visit
https://www.drupal.org/node/1396984.
* To submit bug reports and feature suggestions, or to track changes, visit https://www.drupal.org/project/issues/i18n
* 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:
This module requires the following module:
Internationalization (https://www.drupal.org/project/i18n)
* 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)
* 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. See https://drupal.org/documentation/install/modules-themes/modules-7 for further information.
This is a submodule of the Internationalization module. Install the
Internationalization module as you would normally install a contributed Drupal
module. Visit https://www.drupal.org/node/895232 for further information.
CONFIGURATION
-------------
1. Enable the Contact translation module included with the Internationalization module.
1. Enable the Contact translation module included with the Internationalization
module.
2. Go to Administration > Structure > Contact form.
3. Click edit for the form to configure.
4. Click the Translate tab.
5. Click the translate link for a language.
3. Select edit for the form to configure.
4. Select the Translate tab.
5. Select the translate link for a language.
6. Translate the Category and Auto-reply text.
7. Click Save translation.
7. Select Save translation.
8. Repeat steps 5 to 7 for each language.
9. Repeat steps 2 to 8 for all forms.
@@ -5,9 +5,8 @@ dependencies[] = i18n_string
package = Multilingual - Internationalization
core = 7.x
; Information added by Drupal.org packaging script on 2017-01-31
version = "7.x-1.15"
; Information added by Drupal.org packaging script on 2020-06-17
version = "7.x-1.27"
core = "7.x"
project = "i18n"
datestamp = "1485834792"
datestamp = "1592373390"
@@ -12,47 +12,60 @@ CONTENTS OF THIS FILE
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.
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
* 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
* 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:
This module requires the following module:
Internationalization (https://www.drupal.org/project/i18n)
* 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)
* 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.
This is a submodule of the Internationalization module. Install the
Internationalization module as you would normally install a contributed Drupal
module. Visit https://www.drupal.org/node/895232 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.
2. Go to Administration > Configuration > Regional and language > Translate
interface.
3. Select the 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.
For the translation to be displayed, the user needs 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
@@ -72,7 +72,7 @@ function i18n_field_i18n_string_info() {
'description' => t('Configurable fields descriptions, defaults, options, etc.'),
'format' => FALSE, // This group doesn't have formatted strings
'list' => TRUE, // This group can list all strings
'class' => 'i18n_string_textgroup_cached',
'class' => variable_get('i18n_string_textgroup_class_field', 'i18n_string_textgroup_cached'),
);
return $groups;
}
@@ -6,9 +6,8 @@ package = Multilingual - Internationalization
core = 7.x
files[] = i18n_field.inc
files[] = i18n_field.test
; Information added by Drupal.org packaging script on 2017-01-31
version = "7.x-1.15"
; Information added by Drupal.org packaging script on 2020-06-17
version = "7.x-1.27"
core = "7.x"
project = "i18n"
datestamp = "1485834792"
datestamp = "1592373390"
@@ -194,6 +194,9 @@ function i18n_field_field_widget_form_alter(&$element, &$form_state, $context) {
// Single-value file fields and image fields.
$alter_element = &$element[0];
}
elseif ($field['type'] == 'url' && $field['module'] == 'url' && $field['cardinality'] == 1) {
$alter_element = &$element;
}
elseif (isset($element['value'])) {
// Number fields. Single-value text fields.
$alter_element = &$element['value'];
@@ -202,6 +205,10 @@ function i18n_field_field_widget_form_alter(&$element, &$form_state, $context) {
// Entityreference fields using the entityreference_autocomplete widget.
$alter_element = &$element['target_id'];
}
elseif ($field['type'] == 'node_reference' && isset($element['nid'])) {
// The node_reference fields using the entityreference_autocomplete widget.
$alter_element = &$element['nid'];
}
else {
// All other fields.
$alter_element = &$element;
@@ -456,6 +463,27 @@ function i18n_field_field_info_alter(&$field_info) {
}
}
/**
* Prime the cache to avoid single db queries for entity fields / properties.
*
* This is mainly uses when large operations are occuring like a flush of the
* entity_property_infos().
*/
function i18n_field_prime_caches() {
global $language;
static $cache_primed;
// Fill the cache. This should avoid single db queries when filling the
// properties.
if (empty($cache_primed)) {
$cache_primed = TRUE;
$text_group = i18n_string_textgroup('field');
// Load all strings at once to avoid callbacks for each individual string.
$text_group->load_strings();
$text_group->multiple_translation_search(array('type' => '*', 'objectid' => '*', 'property' => '*'), $language->language);
}
}
/**
* Callback to translate entity property info for a fields.
*
@@ -478,6 +506,7 @@ function i18n_field_entity_property_callback(&$info, $entity_type, $field, $inst
return;
}
i18n_field_prime_caches();
$name = $field['field_name'];
$property = &$info[$entity_type]['bundles'][$instance['bundle']]['properties'][$name];
$property['label'] = i18n_field_translate_property($instance, 'label', $language->language);
@@ -491,9 +520,38 @@ function i18n_field_i18n_object_info_alter(&$info) {
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();
// Use a lock to avoid stampeding.
$lock_name = 'i18n_field_entity_property_callback_fallback:' . $GLOBALS['language']->language;
// See if another request is already doing this. If so we bail out here as
// we won't help with anything at the moment.
if (!lock_may_be_available($lock_name)) {
return;
}
if (lock_acquire($lock_name)) {
i18n_field_prime_caches();
// Inject translated properties.
$entity_property_info = entity_get_property_info();
foreach ($entity_property_info as $entity_type => $properties) {
if (isset($properties['bundles'])) {
foreach ($properties['bundles'] as $bundle => $bundle_properties) {
if ($bundle_properties['properties']) {
foreach ($bundle_properties['properties'] as $bundle_property => $bundle_property_info) {
if ($instance = field_info_instance($entity_type, $bundle_property, $bundle)) {
$property = &$entity_property_info[$entity_type]['bundles'][$instance['bundle']]['properties'][$bundle_property];
$property['label'] = i18n_field_translate_property($instance, 'label', $GLOBALS['language']->language);
}
}
}
}
}
}
// Inject into static cache.
$entity_get_property_info = &drupal_static('entity_get_property_info', array());
$entity_get_property_info = $entity_property_info;
// Write permanent cache.
cache_set('entity_property_info:' . $GLOBALS['language']->language, $entity_property_info);
lock_release($lock_name);
}
}
else {
watchdog('i18n_field', 'Unable to run fall-back handling for entity property translation due missing "i18n_object_info" cache', array(), WATCHDOG_WARNING);
@@ -511,4 +569,4 @@ function i18n_field_module_implements_alter(&$implementations, $hook) {
unset($implementations['i18n_field']);
$implementations['i18n_field'] = $group;
}
}
}
@@ -12,35 +12,41 @@ CONTENTS OF THIS FILE
INTRODUCTION
------------
The Multilingual forum module, part of the Internationalization (https://www.drupal.org/project/i18n) package, helps with the multilingual configuration of the sites forums.
The Multilingual forum module, part of the Internationalization
(https://www.drupal.org/project/i18n) package, helps with the multilingual
configuration of the sites forums.
* For a full description of the module visit https://www.drupal.org/node/1396988
* For a full description of the module visit
https://www.drupal.org/node/1396988.
* To submit bug reports and feature suggestions, or to track changes visit https://www.drupal.org/project/issues/i18n
* 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:
This module requires the following module:
* Internationalization (https://www.drupal.org/project/i18n)
* 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)
* 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. See https://www.drupal.org/docs/7/extending-drupal-7/installing-contributed-modules-find-import-enable-configure-drupal-7 for further information.
This is a submodule of the Internationalization module. Install the
Internationalization module as you would normally install a contributed Drupal
module. Visit https://www.drupal.org/node/895232 for further information.
CONFIGURATION
@@ -50,22 +56,22 @@ To configure forum vocabulary
1. Enable the Multilingual forum module included with Internationalization.
2. Go to Administration > Structure > Taxonomy.
3. Click "edit vocabulary" for the Forums vocabulary.
3. Select the "edit vocabulary" for the Forums vocabulary.
4. Choose the translation mode (Localize or Translate).
5. Click "Save and translate" button.
6. Click "translate" link for a language.
5. Select the "Save and translate" button.
6. Select the "translate" link for a language.
7. Translate the "Name" and "Description" for the forum.
8. Click "Save translation" button.
8. Select the "Save translation" button.
9. Repeat steps 6 to 8 for each language.
To configure forum terms
1. Go to Administration > Structure > Forums.
2. Click "edit" link for a forum or container.
3. Click "Translate" tab.
4. Click "translate" link for a language.
2. Select the "edit" link for a forum or container.
3. Select the "Translate" tab.
4. Select the "translate" link for a language.
5. Translate the "Name" and "Description" for the term.
6. Click "Save translation" button.
6. Select the "Save translation" button.
7. Repeat steps 4 to 6 for each language.
8. Repeat all steps for all terms.
@@ -7,9 +7,8 @@ package = Multilingual - Internationalization
core = 7.x
files[] = i18n_forum.test
; Information added by Drupal.org packaging script on 2017-01-31
version = "7.x-1.15"
; Information added by Drupal.org packaging script on 2020-06-17
version = "7.x-1.27"
core = "7.x"
project = "i18n"
datestamp = "1485834792"
datestamp = "1592373390"
@@ -13,62 +13,80 @@ CONTENTS OF THIS FILE
INTRODUCTION
------------
The Menu translation module, part of the Internationalization (https://www.drupal.org/project/i18n) package, allows users to select a translation mode for each menu.
The Menu translation module, part of the Internationalization
(https://www.drupal.org/project/i18n) package, allows users to select a
translation mode for each menu.
* For a full description of the module, visit this page:
https://www.drupal.org/node/1113982
https://www.drupal.org/node/1113982.
* To submit bug reports and feature suggestions, or to track changes:
https://www.drupal.org/project/issues/i18n
https://www.drupal.org/project/issues/i18n.
REQUIREMENTS
------------
This module requires the following modules:
This module requires the following module:
* Internationalization (https://www.drupal.org/project/i18n)
* 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)
* 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
To link menu item menus to nodes, it is useful to have the following modules:
* Entity translation i18n menu module, a sub module of Entity translation (https://www.drupal.org/project/entity_translation)
* Menu translation node module (https://www.drupal.org/project/i18n_menu_node)
* Entity translation i18n menu module, a submodule of Entity translation -
https://www.drupal.org/project/entity_translation
* Menu translation node module - https://www.drupal.org/project/i18n_menu_node
INSTALLATION
------------
* This is a submodule of the Internationalization module. Install the Internationalization module as you would normally install a contributed Drupal module. Visit https://www.drupal.org/docs/7/extending-drupal-7/installing-contributed-modules-find-import-enable-configure-drupal-7 for further information
This is a submodule of the Internationalization module. Install the
Internationalization module as you would normally install a contributed Drupal
module. Visit https://www.drupal.org/node/895232 for further information.
CONFIGURATION
-------------
Language-specific menus
1. To create or edit a menu, navigate to Structure > Menus > (menu to edit) > Edit.
2. In the Translation mode section, choose Fixed Language and a Language field will appear.
1. To create or edit a menu, navigate to Structure > Menus > (menu to edit) >
Edit.
2. In the Translation mode section, choose Fixed Language and a Language field
will appear.
3. Select a language, select Save, and add or update the menu items as needed.
The menu block will only appear when viewing content in the same language.
There are three modes available:
There are three modes available: Translate and Localize, Fixed Language, and No
Multilingual Options.
Translate and Localize:
You can create one menu for all languages, and translate or localize each menu item. There are two ways that menu items will be translated.
1. You can set a language when creating a custom menu item so that the menu item will only show up for that language. Menu items that link to nodes in a particular language will be treated this way.
2. You can localize other custom menu items without a language (for example, menu items linking to Views pages). Use the Translate tab to translate the menu item title and description. Translators can also use the "Translate interface" pages to translate these menu items.
The user can create one menu for all languages, and translate or localize each
menu item. There are two ways that menu items will be translated.
1. The user can set a language when creating a custom menu item so that the menu
item will only show up for that language. Menu items that link to nodes in a
particular language will be treated this way.
2. The user can localize other custom menu items without a language
(for example, menu items linking to Views pages). Use the Translate tab to
translate the menu item title and description. Translators can also use the
"Translate interface" pages to translate these menu items.
Fixed Language:
If you choose Fixed Language, you'll have to set up a separate menu in each language. This could become tedious if have a lot of languages enabled on your site, but is useful if the content or menu structure is different for each language.
If the user chooses Fixed Language, they'll have to set up a separate menu in
each language. This could become tedious if have a lot of languages enabled on
the site, but is useful if the content or menu structure is different for each
language.
No Multilingual Options:
Only the menu will be translatable.
@@ -76,7 +94,11 @@ Only the menu will be translatable.
TROUBLESHOOTING
---------------
A menu item linked to a node will be displayed only when the node language matches the page language. This is due to how the menu system works and the "Language selection" feature in i18n. Therefore, to get translated menus items that link to nodes, you first need translated content. For more information visit https://www.drupal.org/docs/7/multilingual/translating-content.
A menu item linked to a node will be displayed only when the node language
matches the page language. This is due to how the menu system works and the
"Language selection" feature in i18n. Therefore, to get translated menus items
that link to nodes, you first need translated content. For more information
visit https://www.drupal.org/docs/7/multilingual/translating-content.
MAINTAINERS
@@ -10,9 +10,8 @@ core = 7.x
files[] = i18n_menu.inc
files[] = i18n_menu.test
; Information added by Drupal.org packaging script on 2017-01-31
version = "7.x-1.15"
; Information added by Drupal.org packaging script on 2020-06-17
version = "7.x-1.27"
core = "7.x"
project = "i18n"
datestamp = "1485834792"
datestamp = "1592373390"
@@ -62,8 +62,8 @@ function i18n_menu_menu_alter(&$items) {
* @param $variables
*/
function i18n_menu_preprocess_menu_admin_overview(&$variables) {
$variables['title'] = i18n_string(array('menu', 'menu', $variables['name'], 'title'), $variables['title']);
$variables['description'] = i18n_string(array('menu', 'menu', $variables['name'], 'description'), $variables['description']);
$variables['title'] = i18n_string(array('menu', 'menu', $variables['name'], 'title'), $variables['title'], array('sanitize' => FALSE));
$variables['description'] = i18n_string(array('menu', 'menu', $variables['name'], 'description'), $variables['description'], array('sanitize' => FALSE));
}
/**
@@ -198,7 +198,6 @@ function i18n_menu_menu_link_alter(&$item) {
// We just make sure every link has a valid language property.
if (!i18n_object_langcode($item)) {
$item['language'] = LANGUAGE_NONE;
$item['i18n_tsid'] = 0;
}
}
@@ -398,7 +397,7 @@ function i18n_menu_localize_tree($tree, $langcode = NULL) {
if (_i18n_menu_link_process($item['link'])) {
if (!_i18n_menu_link_is_visible($item['link'], $langcode)) {
// Remove links for other languages than current.
// Links with language wont be localized.
// Links with language won't be localized.
unset($tree[$index]);
// @todo Research whether the above has any advantage over:
// $item['hidden'] = TRUE;
@@ -523,7 +522,7 @@ function _i18n_menu_link_localize(&$link, $langcode = NULL) {
function _i18n_menu_link_description($link, $langcode = NULL) {
if (!empty($link['options']['attributes']['title'])) {
$key = i18n_object_info('menu_link', 'key');
return i18n_string_translate(array('menu', 'item', $link[$key], 'description'), $link['options']['attributes']['title'], array('langcode' => $langcode));
return i18n_string_translate(array('menu', 'item', $link[$key], 'description'), $link['options']['attributes']['title'], array('langcode' => $langcode, 'sanitize' => FALSE));
}
else {
return NULL;
@@ -600,7 +599,7 @@ function _i18n_menu_link_is_visible($link, $langcode = NULL) {
}
/**
* Get localizable properties for menu link checking agains the router item.
* Get localizable properties for menu link checking against the router item.
*/
function _i18n_menu_link_localizable_properties($link) {
$props = array();
@@ -12,53 +12,78 @@ CONTENTS OF THIS FILE
INTRODUCTION
------------
The Multilingual content module, part of the Internationalization (https://www.drupal.org/project/i18n) package, provides extended multilingual options for nodes. These options help accommodate a variety of translation workflows by controlling how the language for nodes is set.
The Multilingual content module, part of the Internationalization
(https://www.drupal.org/project/i18n) package, provides extended multilingual
options for nodes. These options help accommodate a variety of translation
workflows by controlling how the language for nodes is set.
Note that the Multilingual content module lives in the i18n_node directory in the Internationalization package. Don't confuse this module with the core Content translation module.
Note that the Multilingual content module lives in the i18n_node directory
in the Internationalization package. Don't confuse this module with the core
Content translation module.
* For a full description of the module visit https://www.drupal.org/node/1279644
* For a full description of the module visit:
https://www.drupal.org/node/1279644.
* To submit bug reports and feature suggestions, or to track changes visit https://www.drupal.org/project/issues/i18n
* 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:
This module requires the following module:
* Internationalization (https://www.drupal.org/project/i18n)
* 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)
* 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. See https://www.drupal.org/docs/7/extending-drupal-7/installing-contributed-modules-find-import-enable-configure-drupal-7 for further information.
This is a submodule of the Internationalization module. Install the
Internationalization module as you would normally install a contributed Drupal
module. Visit https://www.drupal.org/node/895232 for further information.
CONFIGURATION
-------------
For each content type, the following Extended language options are available under the Multilingual Settings tab
1. "Set current language as default for new content" can be useful for content that is community-generated.
For each content type, the following Extended language options are available
under the Multilingual Settings tab.
1. "Set current language as default for new content" can be useful for content
that is community-generated.
2. "Require language" prevents users from creating 'Language neutral' nodes.
3. "Lock language" prevents users from changing the language of a node after it's created.
3. "Lock language" prevents users from changing the language of a node after
it's created.
Site-wide Settings for Node Translation
1. There are also site-wide settings provided to help streamline how multilingual content is created. Navigate to Config > Regional and language > Multilingual settings > Node Options.
2. "Switch interface for translating" switches the language of the user interface to the chosen language when a user translates a node. This is useful if users speak the language in which the translation is written. It means that after the node translation is saved, the language of the UI will match the language of the node.
3. "Hide content translation links" will prevent the language switcher links from appearing in nodes and teasers. This is useful if a language switcher block is enabled on the site.
4.You can also select the default language for new nodes if the corresponding content type doesn't have language support. By default, it is set to be in the default language of the site, but this can be changed to be language neutral. This is a useful option when thinking about forward compatibility for adding multilingual support to these content types in the future.
1. There are also site-wide settings provided to help streamline how
multilingual content is created. Navigate to Config > Regional and language >
Multilingual settings > Node Options.
2. "Switch interface for translating" switches the language of the user
interface to the chosen language when a user translates a node. This is
useful if users speak the language in which the translation is written. It
means that after the node translation is saved, the language of the UI will
match the language of the node.
3. "Hide content translation links" will prevent the language switcher links
from appearing in nodes and teasers. This is useful if a language switcher
block is enabled on the site.
4. The user can also select the default language for new nodes if the
corresponding content type doesn't have language support. By default, it is
set to be in the default language of the site, but this can be changed to be
language neutral. This is a useful option when thinking about forward
compatibility for adding multilingual support to these content types in the
future.
MAINTAINERS
@@ -9,9 +9,8 @@ configure = admin/config/regional/i18n/node
files[]=i18n_node.test
files[]=i18n_node.variable.inc
; Information added by Drupal.org packaging script on 2017-01-31
version = "7.x-1.15"
; Information added by Drupal.org packaging script on 2020-06-17
version = "7.x-1.27"
core = "7.x"
project = "i18n"
datestamp = "1485834792"
datestamp = "1592373390"
@@ -222,8 +222,16 @@ function i18n_node_language_mode($type) {
function i18n_node_node_prepare($node) {
$options = variable_get('i18n_node_options_' . $node->type, array());
if (i18n_node_type_enabled($node) && empty($node->nid) && !i18n_object_langcode($node) && in_array('current', $options)) {
$default = variable_get('i18n_node_default_language_for_' . $node->type, '-- current --');
// Set current language for new nodes if option enabled
$node->language = i18n_language_content()->language;
if ($default === '-- current --') {
$node->language = i18n_language_content()->language;
}
// If a custom language was specified, apply it.
else {
$node->language = $default;
}
}
}
@@ -249,13 +257,16 @@ function i18n_node_permission() {
/**
* Implements hook_node_view()
*/
function i18n_node_node_view($node) {
function i18n_node_node_view($node, $view_mode, $langcode) {
if (i18n_node_type_enabled($node)) {
$node->content['language'] = array(
'#type' => 'item',
'#title' => t('Language'),
'#markup' => i18n_language_name($node->language),
);
$extra_fields_display_settings = field_extra_fields_get_display('node', $node->type, $view_mode);
if ($extra_fields_display_settings['language']['visible']) {
$node->content['language'] = array(
'#type' => 'item',
'#title' => t('Language'),
'#markup' => i18n_language_name($node->language),
);
}
}
}
@@ -265,7 +276,9 @@ function i18n_node_node_view($node) {
* Handles links for extended languages. Sets current interface language.
*/
function i18n_node_node_view_alter(&$build) {
$node = $build['#node'];
if (isset($build['#node'])) {
$node = $build['#node'];
}
// Hide node translation links.
if (variable_get('i18n_hide_translation_links', 0)) {
if (isset($build['links']['translation'])) {
@@ -417,7 +430,16 @@ function i18n_node_form_node_type_form_alter(&$form, &$form_state) {
// Some settings about node languages. Add variables for node type from variable definition
if ($form['#node_type']->type) {
variable_type_include('node_type');
$form['i18n'] += node_variable_type_subform($form['#node_type']->type, array('i18n_node_options', 'i18n_node_extended'));
$form['i18n'] += node_variable_type_subform($form['#node_type']->type, array('i18n_node_options', 'i18n_node_default_language_for', 'i18n_node_extended'));
// Only show custom default language field if "current" is checked.
$form['i18n']['i18n_node_default_language_for']['#states'] = array(
'visible' => array(
':input[name="i18n_node_options[current]"]' => array('checked' => TRUE),
),
'required' => array(
':input[name="i18n_node_options[current]"]' => array('checked' => TRUE),
),
);
}
// Add disabled message
if ($disabled) {
@@ -45,13 +45,30 @@ function i18n_node_variable_info($options = array()) {
'repeat' => array(
'type' => 'options',
'options' => array(
'current' => t('Set current language as default for new content.', array(), $options),
// Note: this was previously used only to mark new, translatable nodes
// with the current language of the user. Now, this setting is extended
// to allow a specific language to be chosen (defaulting to the current
// language). This was done for backwards compatibility reasons.
'current' => t('Set custom language as default for new content.', array(), $options),
'required' => t('Require language (Do not allow Language Neutral).', array(), $options),
'lock' => t('Lock language (Cannot be changed).', array(), $options),
),
),
'group' => 'i18n',
);
// This field will only be displayed if "current" is checked above.
$variables['i18n_node_default_language_for_[node_type]'] = array(
'type' => 'multiple',
'title' => t('Custom default language', array(), $options),
'repeat' => array(
'type' => 'select',
'options' => array_merge(array(
'-- current --' => t('Current language')
), locale_language_list('name')),
'default' => '-- current --',
),
'group' => 'i18n',
);
$variables['i18n_node_extended_[node_type]'] = array(
'type' => 'multiple',
'title' => t('Extended language support'),
@@ -6,9 +6,8 @@ core = 7.x
files[] = i18n_path.inc
files[] = i18n_path.test
; Information added by Drupal.org packaging script on 2017-01-31
version = "7.x-1.15"
; Information added by Drupal.org packaging script on 2020-06-17
version = "7.x-1.27"
core = "7.x"
project = "i18n"
datestamp = "1485834792"
datestamp = "1592373390"
@@ -1,5 +1,5 @@
CONTENTS OF THIS FILE
---------------------------
---------------------
* Introduction
* Requirements
@@ -12,50 +12,64 @@ CONTENTS OF THIS FILE
INTRODUCTION
------------
The Redirect translation module, part of the Internationalization (https://www.drupal.org/project/i18n) package, improves search engine optimization (SEO) for multilingual websites.
The Redirect translation module, part of the Internationalization
(https://www.drupal.org/project/i18n) package, improves search engine
optimization (SEO) for multilingual websites.
It redirects anonymous users (including web crawlers) to the translation of the page in the requested language, if it exists, using a 301 redirect code.
It redirects anonymous users (including web crawlers) to the translation of the
page in the requested language, if it exists, using a 301 redirect code.
* For a full description of the module, visit this page:
https://www.drupal.org/node/1280468
https://www.drupal.org/node/1280468.
* To submit bug reports and feature suggestions, or to track changes:
https://www.drupal.org/project/issues/i18n
https://www.drupal.org/project/issues/i18n.
REQUIREMENTS
------------
This module requires the following modules:
This module requires the following module:
* Internationalization (https://www.drupal.org/project/i18n)
* Internationalization - https://www.drupal.org/project/i18n
The Translation redirect module requires the implementation of hook_i18n_translate_path by another module for the redirect page to be determined. Currently, the Multilingual content, Path translation, and Taxonomy translation modules implement this hook.
The Translation redirect module requires the implementation of
hook_i18n_translate_path by another module for the redirect page to be
determined. Currently, the Multilingual content, Path translation, and Taxonomy
translation modules implement this hook.
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)
* 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://www.drupal.org/docs/7/extending-drupal-7/installing-contributed-modules-find-import-enable-configure-drupal-7 for further information.
This is a submodule of the Internationalization module. Install the
Internationalization module as you would normally install a contributed Drupal
module. Visit https://www.drupal.org/node/895232 for further information.
CONFIGURATION
-------------
No configuration is necessary.
No configuration is necessary.
For node translation, enable the Multilingual content and the Translation redirect modules. For non-node pages, the redirection hook must be implemented by the relevant module.
For example, for taxonomy pages, you should enable the Taxonomy translation module because the module provides the necessary hook code. If you are using the Path translation module to create translation sets for non-node pages, then it implements the hook code for determining the redirection page.
For node translation, enable the Multilingual content and the Translation
redirect modules. For non-node pages, the redirection hook must be implemented
by the relevant module.
For example, for taxonomy pages, you should enable the Taxonomy translation
module because the module provides the necessary hook code. If you are using the
Path translation module to create translation sets for non-node pages, then it
implements the hook code for determining the redirection page.
MAINTAINERS
@@ -4,9 +4,8 @@ dependencies[] = i18n
package = Multilingual - Internationalization
core = 7.x
; Information added by Drupal.org packaging script on 2017-01-31
version = "7.x-1.15"
; Information added by Drupal.org packaging script on 2020-06-17
version = "7.x-1.27"
core = "7.x"
project = "i18n"
datestamp = "1485834792"
datestamp = "1592373390"
@@ -12,49 +12,64 @@ CONTENTS OF THIS FILE
INTRODUCTION
------------
The Multilingual select module, part of the Internationalization (https://www.drupal.org/project/i18n) package, allows the user to define whether content is filtered by language on pages provided by Drupal core.
The Multilingual select module, part of the Internationalization
(https://www.drupal.org/project/i18n) package, allows the user to define whether
content is filtered by language on pages provided by Drupal core.
* For a full description of the module visit https://www.drupal.org/node/1279512
* For a full description of the module visit:
https://www.drupal.org/node/1279512.
* To submit bug reports and feature suggestions, or to track changes visit https://www.drupal.org/project/issues/i18n
* 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:
This module requires the following module:
* Internationalization (https://www.drupal.org/project/i18n)
* Variable (https://www.drupal.org/project/variable)
* Internationalization - https://www.drupal.org/project/i18n
* Variable - https://www.drupal.org/project/variable
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)
* 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. See https://www.drupal.org/docs/7/extending-drupal-7/installing-contributed-modules-find-import-enable-configure-drupal-7 for further information.
This is a submodule of the Internationalization module. Install the
Internationalization module as you would normally install a contributed Drupal
module. Visit https://www.drupal.org/node/895232 for further information.
CONFIGURATION
-------------
The module allows you to configure whether or not to filter pages by the current language. If the Taxonomy translation submodule is also enabled, an option will be available for how taxonomy term pages are filtered. It also allows the exclusion of the modules language selection handling for some elements and certain paths.
The module allows the user to configure whether or not to filter pages by the
current language. If the Taxonomy translation submodule is also enabled, an
option will be available for how taxonomy term pages are filtered. It also
allows the exclusion of the modules language selection handling for some
elements and certain paths.
1. Enable the Multilingual select module included with Internationalization.
2. Go to Configuration > Regional and language > Multilingual settings > Selection.
3. Select nodes and taxonomy can be filtered by language in the Content to Filter by Language field set.
4. The "Content Selection Mode" allows content with specific tags to be skipped by entering a list of tags.
5. The "Enable for Specific Pages" field set allows specific pages to be included by path.
6. After making choices click Save configuration.
2. Navigate to Configuration > Regional and language > Multilingual settings >
Selection.
3. Select nodes and taxonomy can be filtered by language in the Content to
Filter by Language field set.
4. The "Content Selection Mode" allows content with specific tags to be skipped
by entering a list of tags.
5. The "Enable for Specific Pages" field set allows specific pages to be
included by path.
6. After making choices, Save configuration.
MAINTAINERS
@@ -6,9 +6,8 @@ core = 7.x
configure = admin/config/regional/i18n/select
files[] = i18n_select.test
; Information added by Drupal.org packaging script on 2017-01-31
version = "7.x-1.15"
; Information added by Drupal.org packaging script on 2020-06-17
version = "7.x-1.27"
core = "7.x"
project = "i18n"
datestamp = "1485834792"
datestamp = "1592373390"
@@ -12,54 +12,76 @@ CONTENTS OF THIS FILE
INTRODUCTION
------------
The String translation module, part of the Internationalization (https://www.drupal.org/project/i18n) package, provides support for other modules to translate user-defined strings. This is an API module that must be enabled only when required by other modules in the i18n package.
The String translation module, part of the Internationalization
(https://www.drupal.org/project/i18n) package, provides support for other
modules to translate user-defined strings. This is an API module that must be
enabled only when required by other modules in the i18n package.
* For a full description of the module, visit this page:
https://www.drupal.org/node/1279668
https://www.drupal.org/node/1279668
* To submit bug reports and feature suggestions, or to track changes:
https://www.drupal.org/project/issues/i18n
https://www.drupal.org/project/issues/i18n
REQUIREMENTS
------------
This module requires the following modules:
This module requires the following module:
Internationalization (https://www.drupal.org/project/i18n)
* 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)
* 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://www.drupal.org/docs/7/extending-drupal-7/installing-contributed-modules-find-import-enable-configure-drupal-7 for further information.
This is a submodule of the Internationalization module. Install the
Internationalization module as you would normally install a contributed Drupal
module. Visit https://www.drupal.org/node/895232 for further information.
CONFIGURATION
-------------
Strings will be translated from the source languages. By default the source language is the site's default language, so changing the default language could break these translations.
Strings will be translated from the source languages. By default the source
language is the site's default language, so changing the default language could
break these translations.
1. You can set which language is used as the source language via Administration > Configuration > Regional and language > Multilingual settings > Strings. By default, only plain strings are enabled, so regular blocks are not fully translatable.
2. To allow Filtered HTML, Full HTML or Plain text select the appropriate radio box(es) and Save configuration.
3. To select the strings to be translated navigate to Administration > Configuration > Regional and language > Translate interface and select on Stings vertical tab. From here you can select which text groups to translate and select the Refresh strings tab.
1. The user can set which language is used as the source language via
Administration > Configuration > Regional and language > Multilingual
settings > Strings. By default, only plain strings are enabled, so regular
blocks are not fully translatable.
2. To allow Filtered HTML, Full HTML or Plain text select the appropriate radio
box(es) and Save configuration.
3. To select the strings to be translated navigate to Administration >
Configuration > Regional and language > Translate interface and select on
Stings vertical tab. From here the user can select which text groups to
translate and select the Refresh strings tab.
FAQ
---
The String translation module allows you to configure which text formats are translatable. Formats like PHP Filter and Full HTML are translated before they are processed, so allowing a translator to edit these can be a security risk. This is particularly problematic when importing translations in bulk from a CSV file, since the translator's access to the import formats isn't verified by Drupal. After updating this setting, be sure to refresh the strings via Administration > Configuration > Regional and language > Translate interface > Strings so that strings in forbidden formats are deleted.
The String translation module allows you to configure which text formats are
translatable. Formats like PHP Filter and Full HTML are translated before they
are processed, so allowing a translator to edit these can be a security risk.
This is particularly problematic when importing translations in bulk from a CSV
file, since the translator's access to the import formats isn't verified by
Drupal. After updating this setting, be sure to refresh the strings via
Administration > Configuration > Regional and language > Translate interface >
Strings so that strings in forbidden formats are deleted.
MAINTAINERS
@@ -703,9 +703,19 @@ class i18n_string_textgroup_default {
// Create source string so we get an lid
$this->save_source($string);
}
// Convert objectid to objectkey if it's numeric.
if (!isset($string->objectkey)) {
$string->objectkey = (int)$string->objectid;
if (is_numeric($string->objectid)) {
$string->objectkey = (int)$string->objectid;
}
}
// Make sure objectkey is numeric.
if (!is_numeric($string->objectkey)) {
$string->objectkey = 0;
}
if (!isset($string->format)) {
$string->format = '';
}
@@ -1166,10 +1176,17 @@ class i18n_string_object_wrapper extends i18n_object_wrapper {
$info = is_array($info) ? $info : array('title' => $info);
$field_name = isset($info['field']) ? $info['field'] : $field;
$value = $this->get_field($field_name);
if (is_array($value) && isset($value['value'])) {
$format = isset($value['format']) ? $value['format'] : NULL;
$value = $value['value'];
}
else {
$format = isset($info['format']) ? $this->get_field($info['format']) : NULL;
}
$strings[$this->get_textgroup()][$string_type][$object_id][$field] = array(
'string' => is_array($value) || isset($info['empty']) && $value === $info['empty'] ? NULL : $value,
'title' => $info['title'],
'format' => isset($info['format']) ? $this->get_field($info['format']) : NULL,
'format' => $format,
'name' => array_merge($object_keys, array($field)),
);
}
@@ -1481,7 +1498,12 @@ class i18n_string_textgroup_cached extends i18n_string_textgroup_default {
foreach ($context as $key => $value) {
if ($value != '*') {
$try = array_merge($context, array($key => '*'));
return $this->multiple_cache_get($try);
$cached_results = $this->multiple_cache_get($try);
// Now filter the ones that actually match.
if (!empty($cached_results)) {
$cached_results = $this->string_filter($cached_results, $context);
}
return $cached_results;
}
}
}
@@ -10,9 +10,8 @@ files[] = i18n_string.inc
files[] = i18n_string.test
configure = admin/config/regional/i18n/strings
; Information added by Drupal.org packaging script on 2017-01-31
version = "7.x-1.15"
; Information added by Drupal.org packaging script on 2020-06-17
version = "7.x-1.27"
core = "7.x"
project = "i18n"
datestamp = "1485834792"
datestamp = "1592373390"
@@ -94,6 +94,7 @@ function i18n_string_schema() {
),
'objectindex' => array(
'type' => 'int',
'size' => 'big',
'not null' => TRUE,
'default' => 0,
'description' => 'Integer value of Object ID.',
@@ -245,6 +246,24 @@ function i18n_string_update_7002() {
}
}
/**
* Removed due to buggy upgrade for #2200647.
*/
function i18n_string_update_7003() {
}
/**
* Change objectindex from int to bigint.
*/
function i18n_string_update_7004() {
db_change_field('i18n_string', 'objectindex', 'objectindex', array(
'type' => 'int',
'size' => 'big',
'not null' => TRUE,
'default' => 0,
'description' => 'Integer value of Object ID.',
));
}
/**
* Notes for update script
@@ -118,13 +118,14 @@ function i18n_string_menu() {
'file' => 'i18n_string.admin.inc',
'access arguments' => array('translate interface'),
);
$items['admin/config/regional/i18n/strings'] = array(
'title' => 'Strings',
'description' => 'Options for user defined strings.',
'weight' => 20,
'type' => MENU_LOCAL_TASK,
'page callback' => 'drupal_get_form',
'page arguments' => array('variable_edit_form', array('i18n_string_allowed_formats', 'i18n_string_source_language')),
'page arguments' => array('variable_edit_form', array('i18n_string_allowed_formats', 'i18n_string_source_language', 'i18n_string_textgroup_class_[textgroup]')),
'access arguments' => array('administer site configuration'),
);
// AJAX callback path for strings.
@@ -258,6 +259,34 @@ function i18n_string_locale_translate_import_form_submit($form, &$form_state) {
}
}
/**
* Implements hook_element_info_alter().
*
* We need to do this on the element info level as wysiwyg also does so and form
* API (incorrectly) does not merge in the defaults for values that are arrays.
*/
function i18n_string_element_info_alter(&$types) {
$types['text_format']['#pre_render'][] = 'i18n_string_pre_render_text_format';
}
/**
* The '#pre_render' function to alter the text format element in a translation.
* The text format for a translation is taken form the original, so the text
* format drop down should be disabled.
*
* @param array $element
* The text_format element which will be rendered.
*
* @return array
* The altered text_format element with a disabled "Text format" select.
*/
function i18n_string_pre_render_text_format($element) {
if (!empty($element['#i18n_string_is_translation'])) {
$element['format']['format']['#attributes']['disabled'] = TRUE;
}
return $element;
}
/**
* Check if translation is required for this language code.
*
@@ -334,7 +363,10 @@ function i18n_string_update_context($oldname, $newname) {
}
/**
* Get textgroup handler
* Get textgroup handler.
*
* @return i18n_string_textgroup_default
*
*/
function i18n_string_textgroup($textgroup) {
$groups = &drupal_static(__FUNCTION__);
@@ -488,6 +520,19 @@ function i18n_string_group_info($group = NULL, $property = NULL, $default = NULL
}
}
/**
* Implements hook_i18n_string_info_alter().
*
* Set determined classes to use for the text group.
*/
function i18n_string_i18n_string_info_alter(&$info) {
foreach (array_keys($info) as $name) {
// If class is not defined. Classes from other modules, fixed classes and etc.
if (!isset($info[$name]['class'])) {
$info[$name]['class'] = variable_get('i18n_string_textgroup_class_' . $name, 'i18n_string_textgroup_default');
}
}
}
/**
* Translate / update multiple strings
@@ -519,11 +564,12 @@ function i18n_string_multiple($operation, $name, $strings, $options = array()) {
*
* This function is intended to return translations for plain strings that have NO text format
*
* @param $name
* @param array|string name
* Array or string concatenated with ':' that contains textgroup and string context
* @param $string
* String in default language or array of strings to be translated
* @param $options
* @param array|string $string
* A string in the default language, a string wth format (array with keys
* value and format),or an array of strings (without format) to be translated.
* @param array $options
* An associative array of additional options, with the following keys:
* - 'langcode' (defaults to the current language) The language code to translate to a language other than what is used to display the page.
* - 'filter' Filtering callback to apply to the translated string only
@@ -531,8 +577,13 @@ function i18n_string_multiple($operation, $name, $strings, $options = array()) {
* - 'callback' Callback to apply to the result (both to translated or untranslated string
* - 'sanitize' Whether to filter the translation applying the text format if any, default is TRUE
* - 'sanitize default' Whether to filter the default value if no translation found, default is FALSE
*
* @return string
*/
function i18n_string_translate($name, $string, $options = array()) {
if (is_array($string) && isset($string['value'])) {
$string = $string['value'];
}
if (is_array($string)) {
return i18n_string_translate_list($name, $string, $options);
}
@@ -583,10 +634,17 @@ function i18n_string_translate_access($string_format, $account = NULL) {
* Message if the user cannot translate that string.
*/
function i18n_string_translate_check_string($i18nstring, $account = NULL) {
if (!user_access('translate interface', $account) || !user_access('translate user-defined strings', $account)) {
// Check block translation permissions.
if ($i18nstring->textgroup == 'blocks') {
if (!user_access('translate interface', $account) && !user_access('translate blocks', $account)) {
return t('This is a user-defined string within a block. You are not allowed to translate blocks.');
}
}
elseif (!user_access('translate interface', $account) || !user_access('translate user-defined strings', $account)) {
return t('This is a user-defined string. You are not allowed to translate these strings.');
}
elseif (!empty($i18nstring->format)) {
if (!empty($i18nstring->format)) {
if (!i18n_string_allowed_format($i18nstring->format)) {
$format = filter_format_load($i18nstring->format);
return t('This string uses the %name text format. Strings with this format are not allowed for translation.', array('%name' => $format->name));
@@ -170,14 +170,16 @@ function i18n_string_translate_page_form_base($form, $langcode, $redirect = NULL
/**
* Create field elements for strings
*
* @param i18n_string_object[] $strings
* @param string $langcode
*
* @return array
*/
function i18n_string_translate_page_form_strings($strings, $langcode) {
$formats = filter_formats();
global $user;
$form = array();
foreach ($strings as $item) {
// We may have a source or not. Load it, our string may get the format from it.
$source = $item->get_source();
$format_id = $source ? $source->format : $item->format;
$description = '';
// Check permissions to translate this string, depends on format, etc..
if ($message = $item->check_translate_access()) {
// We'll display a disabled element with the reason it cannot be translated.
@@ -188,27 +190,31 @@ function i18n_string_translate_page_form_strings($strings, $langcode) {
$disabled = FALSE;
$description = '';
// If we don't have a source and it can be translated, we create it.
if (!$source) {
if (!$item->get_source()) {
// Enable messages just as a reminder these strings are not being updated properly.
$status = $item->update(array('messages' => TRUE));
if ($status === FALSE || $status === SAVED_DELETED) {
// We don't have a source string so nothing to translate here
$disabled = TRUE;
}
else {
$source = $item->get_source();
}
}
}
$default_value = $item->format_translation($langcode, array('langcode' => $langcode, 'sanitize' => FALSE, 'debug' => FALSE));
$available_formats = array_keys(filter_formats($user));
if (!in_array($item->format, $available_formats)) {
$item->format = NULL;
}
$form[$item->get_name()] = array(
'#title' => $item->get_title(),
'#type' => 'textarea',
'#type' => $item->format ? 'text_format' : 'textarea',
'#default_value' => $default_value,
'#format' => $item->format,
// This will trigger i18n_string_pre_render_text_format() to actually
// alter the element.
'#i18n_string_is_translation' => TRUE,
'#disabled' => $disabled,
'#description' => $description . _i18n_string_translate_format_help($format_id),
//'#i18n_string_format' => $source ? $source->format : 0,
'#description' => $description,
// If disabled, provide smaller textarea (that can be expanded anyway).
'#rows' => $disabled ? 1 : min(ceil(str_word_count($default_value) / 12), 10),
// Change the parent for disabled strings so we don't get empty values later
@@ -226,6 +232,16 @@ function i18n_string_translate_page_form_submit($form, &$form_state) {
foreach ($form_state['values']['strings'] as $name => $value) {
$count++;
list($textgroup, $context) = i18n_string_context(explode(':', $name));
if (is_array($value)) {
if (isset($value['value'])) {
$value = $value['value'];
$form_state['values']['strings'][$name] = $value;
}
else {
form_set_error("strings][$name", t('Unable to get the translated string value.'));
watchdog('locale', 'Unable to get the translated string value, string array is: %string', array('%string' => var_dump($value)), WATCHDOG_WARNING);
}
}
$result = i18n_string_textgroup($textgroup)->update_translation($context, $form_state['values']['langcode'], $value);
$success += ($result ? 1 : 0);
}
@@ -65,7 +65,7 @@ class i18nStringTestCase extends Drupali18nTestCase {
$this->drupalPost('admin/config/regional/translate/translate', $search, t('Filter'));
$this->clickLink(t('edit'));
// Just add a random translation.
$translation = $this->randomString();
$translation = $this->randomName();
$edit = array();
foreach ($this->getOtherLanguages() as $language) {
$langcode = $language->language;
@@ -34,9 +34,32 @@ function i18n_string_variable_info($options = array()) {
'default' => 0,
'group' => 'debug',
);
$variables['i18n_string_textgroup_class_[textgroup]'] = array(
'title' => t('Class to use for the text group'),
'description' => t('Determines which the class will be use for string translation in the text group.', array(), $options),
'repeat' => array(
'type' => 'select',
'default' => 'i18n_string_textgroup_default',
'options callback' => 'i18n_string_variable_textgroup_class_list',
),
'submit callback' => 'i18n_string_variable_textgroup_class_submit_callback',
'group' => 'i18n',
);
return $variables;
}
/**
* Implements hook_variable_type_info().
*/
function i18n_string_variable_type_info() {
$type['textgroup'] = array(
'title' => t('Text group'),
'type' => 'select',
'options callback' => 'i18n_string_variable_textgroup_list',
);
return $type;
}
/**
* Options callback, format list
*/
@@ -54,4 +77,33 @@ function i18n_string_variable_format_list() {
*/
function i18n_string_variable_format_default() {
return array(filter_fallback_format());
}
}
/**
* Options callback, text groups list.
*/
function i18n_string_variable_textgroup_list() {
$groups = array();
foreach (i18n_string_group_info() as $name => $info) {
$groups[$name] = $info['title'];
}
return $groups;
}
/**
* Options callback, text group classes list.
*/
function i18n_string_variable_textgroup_class_list($variable, $options = array()) {
return array(
'i18n_string_textgroup_default' => t('Text group handler default.', array(), $options),
'i18n_string_textgroup_cached' => t('Text group handler which include persistent caching.', array(), $options),
);
}
/**
* Submit callback. Execute Reset the persistent caches after save the text group class variables.
*/
function i18n_string_variable_textgroup_class_submit_callback($variable, $options, $form, $form_state) {
// Reset the persistent caches.
cache_clear_all('i18n:string:' , 'cache', TRUE);
}
@@ -3,7 +3,7 @@ README.txt
==========
Drupal module: i18n_sync (Synchronization)
This module will handle content synchronization accross translations.
This module will handle content synchronization across translations.
The available list of fields to synchronize will include standard node fields and cck fields.
To have aditional fields, add the list in a variable in the settings.php file, like this:
@@ -1,5 +1,5 @@
name = Synchronize translations
description = Synchronizes taxonomy and fields accross translations of the same content.
description = Synchronizes taxonomy and fields across translations of the same content.
dependencies[] = i18n
dependencies[] = translation
package = Multilingual - Internationalization
@@ -10,9 +10,8 @@ files[] = i18n_sync.install
files[] = i18n_sync.module.inc
files[] = i18n_sync.node.inc
files[] = i18n_sync.test
; Information added by Drupal.org packaging script on 2017-01-31
version = "7.x-1.15"
; Information added by Drupal.org packaging script on 2020-06-17
version = "7.x-1.27"
core = "7.x"
project = "i18n"
datestamp = "1485834792"
datestamp = "1592373390"
@@ -33,7 +33,7 @@ function i18n_sync($status = NULL) {
function i18n_sync_help($path, $arg) {
switch ($path) {
case 'admin/help#i18n_sync' :
$output = '<p>' . t('This module synchronizes content taxonomy and fields accross translations:') . '</p>';
$output = '<p>' . t('This module synchronizes content taxonomy and fields across translations:') . '</p>';
$output .= '<p>' . t('First you need to select which fields should be synchronized. Then, after a node has been updated, all enabled vocabularies and fields will be synchronized as follows:') . '</p>';
$output .= '<ul>';
$output .= '<li>' . t('All the node fields selected for synchronization will be set to the same value for all translations.') . '</li>';
@@ -91,6 +91,7 @@ function i18n_sync_form_node_type_form_alter(&$form, &$form_state) {
$form['i18n_sync']['i18n_sync_node_type'] = array(
'#tree' => TRUE,
'#weight' => 1,
);
// Each set provides title and options. We build a big checkboxes control for it to be
@@ -121,6 +122,21 @@ function i18n_sync_form_node_type_form_alter(&$form, &$form_state) {
);
}
}
// Add option to restrict syncing only when editing the translation source.
$form['i18n_sync']['i18n_sync_source_description'] = array(
'#prefix' => '<div>', '#suffix' => '</div>',
'#markup' => t('Restrict synchronization to the translation source.'),
'#weight' => 2,
);
$form['i18n_sync']['i18n_sync_source'] = array(
'#type' => 'checkbox',
'#title' => t('Synchronize translations only when saving the translation source'),
'#default_value' => variable_get('i18n_sync_source_' . $type, FALSE),
'#disabled' => $disabled,
'#weight' => 3,
'#description' => t('If not checked each node will trigger the synchronization, whether it\'s the source or not.'),
);
}
}
@@ -167,9 +183,17 @@ function i18n_sync_node_insert($node) {
*/
function i18n_sync_node_update($node) {
// Let's go with field synchronization.
if (i18n_sync_node_check($node) && !empty($node->tnid) && ($fields = i18n_sync_node_fields($node->type)) && ($translations = i18n_sync_node_get_translations($node, TRUE))) {
module_load_include('node.inc', 'i18n_sync');
i18n_sync_node_translation($node, $translations, $fields, 'update');
if (i18n_sync_node_check($node) && !empty($node->tnid) && (!variable_get('i18n_sync_source_' . $node->type, TRUE) || $node->tnid == $node->nid) && ($fields = i18n_sync_node_fields($node->type)) && ($translations = i18n_sync_node_get_translations($node, TRUE))) {
$do_sync = TRUE;
if (module_exists('entity_translation')) {
if (entity_translation_enabled_bundle('node', $node->type)) {
$do_sync = FALSE;
}
}
if ($do_sync) {
module_load_include('node.inc', 'i18n_sync');
i18n_sync_node_translation($node, $translations, $fields, 'update');
}
}
}
@@ -98,7 +98,7 @@ function i18n_sync_node_translation_nodereference_field(&$node, &$translation, $
* Example:
* English A references English B and English C.
* English A and B are translated to German A and B, but English C is not.
* The syncronization from English A to German A would it German B and English C.
* The synchronization from English A to German A would it German B and English C.
*/
function i18n_sync_node_translation_reference_field(&$reference_node, $default_value, $langcode) {
if (isset($reference_node->tnid) && translation_supported_type($reference_node->type)) {
@@ -12,17 +12,23 @@ CONTENTS OF THIS FILE
INTRODUCTION
------------
The Taxonomy translation module, part of the Internationalization (https://www.drupal.org/project/i18n) package, provides multiple options to translate taxonomy vocabularies and terms. For each vocabulary, there are four types of behaviors to choose from: Language-independent terms, Language-specific terms, Localized terms, and Mixed-language vocabulary.
The Taxonomy translation module, part of the Internationalization
(https://www.drupal.org/project/i18n) package, provides multiple options to
translate taxonomy vocabularies and terms. For each vocabulary, there are four
types of behaviors to choose from: Language-independent terms, Language-specific
terms, Localized terms, and Mixed-language vocabulary.
* For a full description of the module visit https://www.drupal.org/node/1114016
* For a full description of the module visit:
https://www.drupal.org/node/1114016
* To submit bug reports and feature suggestions, or to track changes visit https://www.drupal.org/project/issues/i18n
* 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:
This module requires the following module:
* Internationalization - https://www.drupal.org/project/i18n
@@ -34,13 +40,16 @@ RECOMMENDED MODULES
* 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
* 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://www.drupal.org/docs/7/extending-drupal-7/installing-contributed-modules-find-import-enable-configure-drupal-7 for further information.
This is a submodule of the Internationalization module. Install the
Internationalization module as you would normally install a contributed Drupal
module. Visit https://www.drupal.org/node/895232 for further information.
CONFIGURATION
@@ -51,29 +60,37 @@ Language-independent terms - only vocabulary will be translatable.
2. Select the "edit vocabulary" link.
3. Select the "No multilingual options for terms".
Language-specific terms - vocabulary is only used for content in that language. The terms will only be available if the term language matches the UI language.
Language-specific terms - vocabulary is only used for content in that language.
The terms will only be available if the term language matches the UI language.
1. Navigate to Structure > Taxonomy and select the "edit vocabulary link".
2. Choose "Fixed Language" and a Language drop-down field will be displayed.
3. Select the language.
4. Select "Fixed Language" and Save.
Localized terms - Terms are common for all languages, but their name and description may be localized.
Localized terms - Terms are common for all languages, but their name and
description may be localized.
1. Navigate to Structure > Taxonomy > vocabulary-to-edit > Edit.
2. Select "Localize" and select Save.
3. Edit a term and there will be a Translate tab. Select this tab.
4. Select Translate, translate the Name and Description, select "Save translation", and repeat for all languages.
4. Select Translate, translate the Name and Description, select
"Save translation", and repeat for all languages.
5. Repeat the process for all terms.
6. Navigate to Structure > Content types > term-to-edit > Manage display.
7. By default, the term reference is set to Link. Change this to "Link (localized)" and Save.
7. By default, the term reference is set to Link. Change this to "Link
(localized)" and Save.
The vocabulary will be appropriate for the language.
Mixed-language vocabulary - Use for vocabularies with terms in multiple languages.
Mixed-language vocabulary - Use for vocabularies with terms in multiple
languages.
1. Navigate to Structure > Taxonomy > vocabulary-to-edit > Edit.
2. Select the Translate radio button and Save.
3. Edit a vocabulary term and there will be a new Language field. Choose a language and then select Save and translate.
4. There are two options, the user can either select "Add translation link" or the user can select an existing term in the Select translations form.
3. Edit a vocabulary term and there will be a new Language field. Choose a
language and then select Save and translate.
4. There are two options, the user can either select "Add translation link" or
the user can select an existing term in the Select translations form.
5. Create translations for the terms and add terms for specific languages only.
Now if the user edits a node associated with this vocabulary, only the relevant terms will appear.
Now if the user edits a node associated with this vocabulary, only the relevant
terms will appear.
MAINTAINERS
@@ -48,7 +48,7 @@ function i18n_taxonomy_translation_term_form($form, $form_state, $vocabulary, $t
$form['translations'][$lang] = array(
'#title' => $langname,
'#type' => 'item',
'#markup' => $source->name,
'#markup' => check_plain($source->name),
'#langcode' => $lang,
);
}
@@ -11,9 +11,8 @@ files[] = i18n_taxonomy.pages.inc
files[] = i18n_taxonomy.admin.inc
files[] = i18n_taxonomy.test
; Information added by Drupal.org packaging script on 2017-01-31
version = "7.x-1.15"
; Information added by Drupal.org packaging script on 2020-06-17
version = "7.x-1.27"
core = "7.x"
project = "i18n"
datestamp = "1485834792"
datestamp = "1592373390"
@@ -377,10 +377,19 @@ function i18n_taxonomy_field_prepare_translation($entity_type, $entity, $field,
* The array of valid terms for this field, keyed by term id.
*/
function i18n_taxonomy_allowed_values($field) {
global $language;
$options = array();
foreach ($field['settings']['allowed_values'] as $tree) {
if ($vocabulary = taxonomy_vocabulary_machine_name_load($tree['vocabulary'])) {
if ($terms = taxonomy_get_tree($vocabulary->vid, $tree['parent'])) {
if (i18n_taxonomy_vocabulary_mode($vocabulary->vid) == I18N_MODE_TRANSLATE) {
$parent = i18n_taxonomy_translation_term_tid($tree['parent'], NULL, $tree['parent']);
$language = i18n_language_context();
$terms = i18n_taxonomy_get_tree($vocabulary->vid, $language->language, $parent);
}
else {
$terms = taxonomy_get_tree($vocabulary->vid, $tree['parent']);
}
if ($terms) {
foreach ($terms as $term) {
$options[$term->tid] = str_repeat('-', $term->depth) . i18n_taxonomy_term_name($term);
}
@@ -747,6 +756,28 @@ function i18n_taxonomy_form_taxonomy_form_term_alter(&$form, &$form_state) {
// Add language field or not depending on taxonomy mode.
switch (i18n_taxonomy_vocabulary_mode($vocabulary->vid)) {
case I18N_MODE_TRANSLATE:
// Set $form_state['storage'] default as empty array because we will add
// the translation and target from $_GET. So we still have it when the
// page partially reloads with ajax.
if(!isset($form_state['storage'])) {
$form_state['storage'] = array();
}
// get translation from $_GET or $form_state['storage']
$translation = null;
if(isset($_GET['translation'])) {
$translation = $_GET['translation'];
$form_state['storage']['translation'] = $translation;
} else if(isset($form_state['storage']) && isset($form_state['storage']['translation'])){
$translation = $form_state['storage']['translation'];
}
// get target from $_GET or $form_state['storage']
$target = null;
if(isset($_GET['target'])) {
$target = $_GET['target'];
$form_state['storage']['target'] = $target;
} else if(isset($form_state['storage']) && isset($form_state['storage']['target'])){
$target = $form_state['storage']['target'];
}
$form['language'] = array(
'#description' => t('This term belongs to a multilingual vocabulary. You can set a language for it.'),
) + i18n_element_language_select($term);
@@ -754,7 +785,7 @@ function i18n_taxonomy_form_taxonomy_form_term_alter(&$form, &$form_state) {
// If the term to be added will be a translation of a source term,
// set the default value of the option list to the target language and
// create a form element for storing the translation set of the source term.
if (empty($term->tid) && isset($_GET['translation']) && isset($_GET['target']) && ($source_term = taxonomy_term_load($_GET['translation'])) && ($target_language = i18n_language_object($_GET['target']))) {
if (empty($term->tid) && isset($translation) && isset($target) && ($source_term = taxonomy_term_load($translation)) && ($target_language = i18n_language_object($target))) {
// Set context language to target language.
i18n_language_context($target_language);
@@ -996,7 +1027,7 @@ function i18n_taxonomy_translate_terms($taxonomy, $langcode, $fullterms = TRUE)
}
elseif ($term->language && $term->language != $langcode) {
$translation_set = i18n_translation_set_load($term->i18n_tsid);
$translations = $translation_set->get_translations();
$translations = ($translation_set) ? $translation_set->get_translations() : NULL;
if ($translations && !empty($translations[$langcode])) {
$newterm = $translations[$langcode];
@@ -1225,6 +1256,11 @@ function i18n_taxonomy_field_uuid_presave($entity_type, $entity, $field, $instan
* Implements hook_entity_info_alter().
*/
function i18n_taxonomy_entity_info_alter(&$entity_info) {
if (isset($entity_info['taxonomy_vocabulary'])) {
// Add altered vocabulary schema fields.
$entity_info['taxonomy_vocabulary']['schema_fields_sql']['base table'][] = 'i18n_mode';
$entity_info['taxonomy_vocabulary']['schema_fields_sql']['base table'][] = 'language';
}
if (isset($entity_info['taxonomy_term'])) {
// Core doesn't provide a label callback for taxonomy terms. By setting one
// we can use it to return the correct localized term name.
@@ -1275,7 +1311,7 @@ function i18n_taxonomy_modules_enabled($modules) {
* Implements hook_views_pre_render().
*/
function i18n_taxonomy_views_pre_render(&$view) {
if(!module_exists('rules_scheduler')) {
if($view->base_table !== 'rules_scheduler') {
global $language;
foreach ($view->result as $delta => $term){
@@ -15,6 +15,10 @@ function i18n_taxonomy_token_info() {
'name' => t("Name (localized)"),
'description' => t("The name of the taxonomy term."),
);
$term['localized-name'] = array(
'name' => t("Name in current language"),
'description' => t("The name of the taxonomy term in current language."),
);
$term['i18n-description'] = array(
'name' => t("Description (localized)"),
'description' => t("The optional description of the taxonomy term."),
@@ -69,6 +73,12 @@ function i18n_taxonomy_tokens($type, $tokens, array $data = array(), array $opti
$replacements[$original] = $sanitize ? check_plain($name) : $name;
break;
case 'localized-name':
$translated_term = i18n_taxonomy_term_get_translation($term, $langcode);
$name = i18n_taxonomy_term_name($translated_term, $langcode);
$replacements[$original] = $sanitize ? check_plain($name) : $name;
break;
case 'i18n-description':
$replacements[$original] = i18n_string_text(array('taxonomy', 'term', $term->tid, 'description'), $term->description, array('langcode' => $langcode, 'format' => $term->format, 'sanitize' => $sanitize, 'cache' => TRUE));
break;
@@ -6,9 +6,8 @@ core = 7.x
files[] = i18n_translation.inc
; Information added by Drupal.org packaging script on 2017-01-31
version = "7.x-1.15"
; Information added by Drupal.org packaging script on 2020-06-17
version = "7.x-1.27"
core = "7.x"
project = "i18n"
datestamp = "1485834792"
datestamp = "1592373390"
@@ -20,7 +20,7 @@ class I18nTranslationSetController extends DrupalDefaultEntityController {
* @param $queried_entities
* Associative array of query results, keyed on the entity ID.
* @param $revision_id
* ID of the revision that was loaded, or FALSE if teh most current revision
* ID of the revision that was loaded, or FALSE if the most current revision
* was loaded.
*/
protected function attachLoad(&$queried_entities, $revision_id = FALSE) {
@@ -12,45 +12,52 @@ CONTENTS OF THIS FILE
INTRODUCTION
------------
The User mail translation module, part of the Internationalization (https://www.drupal.org/project/i18n) package, translates emails sent from the User module.
The User mail translation module, part of the Internationalization
(https://www.drupal.org/project/i18n) package, translates emails sent from the
User module.
* For a full description of the module, visit this page:
https://www.drupal.org/node/133977
https://www.drupal.org/node/133977.
* To submit bug reports and feature suggestions, or to track changes:
https://www.drupal.org/project/issues/i18n
https://www.drupal.org/project/issues/i18n.
REQUIREMENTS
------------
This module requires the following modules:
This module requires the following module:
Internationalization (https://www.drupal.org/project/i18n)
* 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)
* 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://www.drupal.org/docs/7/extending-drupal-7/installing-contributed-modules-find-import-enable-configure-drupal-7 for further information.
This is a submodule of the Internationalization module. Install the
Internationalization module as you would normally install a contributed Drupal
module. Visit https://www.drupal.org/node/895232 for further information.
CONFIGURATION
-------------
To configure email translations
1. Navigate to Administration > Configuration > Regional and language > Multilingual settings and select the variables tab.
2. Select the "User emails" tab. Select the variables you would like translated and Save configuration.
1. Navigate to Administration > Configuration > Regional and language >
Multilingual settings and select the variables tab.
2. Select the "User emails" tab. Select the variables to be translated. Save
configuration.
MAINTAINERS
@@ -4,9 +4,8 @@ core = 7.x
package = Multilingual - Internationalization
dependencies[] = i18n_variable
; Information added by Drupal.org packaging script on 2017-01-31
version = "7.x-1.15"
; Information added by Drupal.org packaging script on 2020-06-17
version = "7.x-1.27"
core = "7.x"
project = "i18n"
datestamp = "1485834792"
datestamp = "1592373390"
@@ -9,6 +9,13 @@
*/
function i18n_user_mail_alter(&$message) {
if ($message['module'] == 'user') {
$message['language'] = language_default();
if (isset($message['params']['account'])) {
$user_preferred = user_preferred_language($message['params']['account']);
if (isset($user_preferred)) {
$message['language'] = $user_preferred;
}
}
$language = (isset($message['language']) ? $message['language'] : language_default());
$variables = array('user' => $message['params']['account']);
$key = $message['key'];
@@ -8,14 +8,21 @@ CONTENTS OF THIS FILE
* Configuration
* Maintainers
INTRODUCTION
------------
The Variable translation module, part of the Internationalization (https://www.drupal.org/project/i18n) package, allows the user to translate text and settings that are stored in Drupal as variables. These variables include text such as 'site name' and 'site slogan', as well as settings like 'Default front page' and 'Default 404 page'.
The Variable translation module, part of the Internationalization
(https://www.drupal.org/project/i18n) package, allows the user to translate text
and settings that are stored in Drupal as variables. These variables include
text such as 'site name' and 'site slogan', as well as settings like 'Default
front page' and 'Default 404 page'.
* For a full description of the module, visit https://www.drupal.org/node/1113374
* For a full description of the module, visit:
https://www.drupal.org/node/1113374.
* To submit bug reports and feature suggestions, or to track changes visit https://www.drupal.org/project/issues/i18n
* To submit bug reports and feature suggestions, or to track changes visit:
https://www.drupal.org/project/issues/i18n.
REQUIREMENTS
@@ -23,24 +30,27 @@ REQUIREMENTS
This module requires the following modules:
* Internationalization (https://www.drupal.org/project/i18n)
* Variable (https://www.drupal.org/project/variable)
* Internationalization - https://www.drupal.org/project/i18n
* Variable - https://www.drupal.org/project/variable
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)
* 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. See https://www.drupal.org/docs/7/extending-drupal-7/installing-contributed-modules-find-import-enable-configure-drupal-7 for further information.
This is a submodule of the Internationalization module. Install the
Internationalization module as you would normally install a contributed Drupal
module. Visit https://www.drupal.org/node/895232 for further information.
CONFIGURATION
@@ -48,13 +58,20 @@ CONFIGURATION
To enable multilingual variables
1. Enable the Variable translation module included with the Internationalization package.
2. Go to Administration > Configuration > Regional and language > Multilingual settings.
3. Click on the Variables tab.
1. Enable the Variable translation module included with the Internationalization
package.
2. Go to Administration > Configuration > Regional and language > Multilingual
settings.
3. Select on the Variables tab.
4. Select the variables that will be multilingual.
5. Click Save configuration button.
5. Save configuration.
Once you have the correct settings, they'll be marked with "This is a multilingual variable" when you go to the corresponding administration pages. You must switch the site language while in the administration pages to set the variables for each language. A language switcher link will appear at the top of each administrative page that has multilingual variables.
Once the user has the correct settings, they'll be marked with "This is a
multilingual variable" when the user navigates to the corresponding
administration pages. The user must switch the site language while in the
administration pages to set the variables for each language. A language switcher
link will appear at the top of each administrative page that has multilingual
variables.
MAINTAINERS
@@ -10,9 +10,8 @@ configure = admin/config/regional/i18n/variable
files[] = i18n_variable.class.inc
files[] = i18n_variable.test
; Information added by Drupal.org packaging script on 2017-01-31
version = "7.x-1.15"
; Information added by Drupal.org packaging script on 2020-06-17
version = "7.x-1.27"
core = "7.x"
project = "i18n"
datestamp = "1485834792"
datestamp = "1592373390"
@@ -7,9 +7,8 @@ package = Testing
core = 6.x
hidden = TRUE
; Information added by Drupal.org packaging script on 2017-01-31
version = "7.x-1.15"
; Information added by Drupal.org packaging script on 2020-06-17
version = "7.x-1.27"
core = "7.x"
project = "i18n"
datestamp = "1485834792"
datestamp = "1592373390"
@@ -40,7 +40,7 @@ function i18n_test_i18n_string_info() {
'title' => t('Test Cached Strings'),
'description' => t('Translatable items of a textgroup with caching enabled.'),
'format' => FALSE, // This group doesn't have strings with format
'class' => 'i18n_string_textgroup_cached_logged',
'class' => variable_get('i18n_string_textgroup_class_test_cached', 'i18n_string_textgroup_cached_logged'),
);
return $groups;
}
@@ -202,7 +202,11 @@ function l10n_update_admin_settings_form($form, &$form_state) {
'#default_value' => variable_get('l10n_update_download_store', ''),
'#description' => t('A path relative to the Drupal installation directory where translation files will be stored, e.g. sites/all/translations. Saved translation files can be reused by other installations. If left empty the downloaded translation will not be saved.'),
);
return system_settings_form($form);
$form = system_settings_form($form);
$form['#submit'][] = 'l10n_update_admin_settings_form_submit';
return $form;
}
/**
@@ -220,6 +224,14 @@ function l10n_update_admin_settings_form_validate($form, &$form_state) {
}
}
/**
* Additional submit handler for update settings.
*/
function l10n_update_admin_settings_form_submit($form, &$form_state) {
// Add .htaccess file to the translations directory.
l10n_update_ensure_htaccess();
}
/**
* Get array of import options.
*
@@ -6,9 +6,8 @@ package = Multilingual
files[] = l10n_update.parser.inc
; Information added by Drupal.org packaging script on 2014-11-10
version = "7.x-1.1"
; Information added by Drupal.org packaging script on 2019-12-16
version = "7.x-1.4"
core = "7.x"
project = "l10n_update"
datestamp = "1415605322"
datestamp = "1576494267"
@@ -15,7 +15,7 @@ function l10n_update_schema() {
'name' => array(
'description' => 'A unique short name to identify the project.',
'type' => 'varchar',
'length' => '50',
'length' => '255',
'not null' => TRUE,
),
'project_type' => array(
@@ -68,7 +68,7 @@ function l10n_update_schema() {
'project' => array(
'description' => 'A unique short name to identify the project.',
'type' => 'varchar',
'length' => '50',
'length' => '255',
'not null' => TRUE,
),
'language' => array(
@@ -207,6 +207,27 @@ function l10n_update_requirements($phase) {
$requirements['l10n_update']['value'] = t('Not enabled');
$requirements['l10n_update']['severity'] = REQUIREMENT_INFO;
}
// Test the contents of the .htaccess file in the translations directory.
$directory = variable_get('l10n_update_download_store', '');
if ($directory) {
l10n_update_ensure_htaccess();
$htaccess_file = $directory . '/.htaccess';
// Check for the string which was added to the recommended .htaccess file
// in the latest security update.
if (!file_exists($htaccess_file) || !($contents = @file_get_contents($htaccess_file)) || strpos($contents, 'Drupal_Security_Do_Not_Remove_See_SA_2013_003') === FALSE) {
$requirements['l10n_update_htaccess'] = array(
'title' => t('Translations directory'),
'value' => t('Not fully protected'),
'severity' => REQUIREMENT_ERROR,
'description' => t('See <a href="@url">@url</a> for information about the recommended .htaccess file which should be added to the %directory directory to help protect against arbitrary code execution.', array(
'@url' => 'http://drupal.org/SA-CORE-2013-003',
'%directory' => $directory
)),
);
}
}
return $requirements;
}
// We must always return array, the installer doesn't use module_invoke_all()
@@ -297,3 +318,36 @@ function l10n_update_update_7005() {
function l10n_update_update_7006() {
registry_rebuild();
}
/**
* Increase the length of the {l10n_update_project}.name column.
*/
function l10n_update_update_7007() {
$schema = l10n_update_schema();
db_change_field('l10n_update_project', 'name', 'name', $schema['l10n_update_project']['fields']['name']);
}
/**
* Increase the length of the {l10n_update_file}.project column.
*/
function l10n_update_update_7008() {
$schema = l10n_update_schema();
db_change_field('l10n_update_file', 'project', 'project', $schema['l10n_update_file']['fields']['project']);
}
/**
* Remove 'headers' field from cache table.
*/
function l10n_update_update_7009() {
if (db_field_exists('cache_l10n_update', 'headers')) {
db_drop_field('cache_l10n_update', 'headers');
}
}
/**
* Add a .htaccess file to the translations directory.
*/
function l10n_update_update_7010() {
module_load_include('module', 'l10n_update');
l10n_update_ensure_htaccess();
}
@@ -494,3 +494,13 @@ function l10n_update_flush_caches() {
}
return array();
}
/**
* Creates a .htaccess file in the translations directory if it is missing.
*/
function l10n_update_ensure_htaccess() {
$directory = variable_get('l10n_update_download_store', '');
if ($directory) {
file_create_htaccess($directory, FALSE);
}
}
@@ -47,42 +47,18 @@ function l10n_update_build_projects($refresh = FALSE) {
$default_server = l10n_update_default_server();
if (module_exists('update')) {
$projects_info = update_get_available(TRUE);
}
foreach ($projects as $name => $data) {
// Force update fetch of project data in cases where Drupal's performance
// optimized approach is missing out on some projects.
// @see http://drupal.org/node/1671570#comment-6216090
if (module_exists('update') && !isset($projects_info[$name])) {
module_load_include('fetch.inc', 'update');
_update_process_fetch_task($data);
$available = _update_get_cached_available_releases();
if (!empty($available[$name])) {
$projects_info[$name] = $available[$name];
// For dev releases, remove the '-dev' part and trust the translation server
// to fall back to the latest stable release for that branch.
if (isset($data['info']['version']) && strpos($data['info']['version'], '-dev')) {
if (preg_match("/^(\d+\.x-\d+\.).*$/", $data['info']['version'], $matches)) {
// Example matches: 7.x-1.x-dev, 7.x-1.0-alpha1+5-dev => 7.x-1.x
$data['info']['version'] = $matches[1] . 'x';
}
}
if (isset($projects_info[$name]['releases']) && $projects_info[$name]['project_status'] != 'not-fetched') {
// Find out if a dev version is installed.
if (preg_match("/^[0-9]+\.x-([0-9]+)\..*-dev$/", $data['info']['version'], $matches)) {
// Find a suitable release to use as alternative translation.
foreach ($projects_info[$name]['releases'] as $project_release) {
// The first release with the same major release number which is not
// a dev release is the one. Releases are sorted the most recent first.
if ($project_release['version_major'] == $matches[1] &&
(!isset($project_release['version_extra']) || $project_release['version_extra'] != 'dev')) {
$release = $project_release;
break;
}
}
elseif (preg_match("/^(\d+\.).*$/", $data['info']['version'], $matches)) {
// Example match: 7.33-dev => 7.x (Drupal core)
$data['info']['version'] = $matches[1] . 'x';
}
if (!empty($release['version'])) {
$data['info']['version'] = $release['version'];
}
unset($release);
}
$data += array(
@@ -228,7 +204,7 @@ function _l10n_update_project_info_list(&$projects, $list, $project_type, $disab
'name' => $project_name,
'info' => $file->info,
'datestamp' => isset($file->info['datestamp']) ? $file->info['datestamp'] : 0,
'includes' => array($file->name => $file->info['name']),
'includes' => array($file->name => isset($file->info['name']) ? $file->info['name'] : $file->name),
'project_type' => $project_name == 'drupal' ? 'core' : $project_type,
);
}