diff --git a/core/modules/translation/config/translation.settings.yml b/core/modules/translation/config/translation.settings.yml new file mode 100644 index 0000000..bf1e79b --- /dev/null +++ b/core/modules/translation/config/translation.settings.yml @@ -0,0 +1 @@ +language_type: "language_interface" diff --git a/core/modules/translation/translation.install b/core/modules/translation/translation.install index d0c5157..61d014d 100644 --- a/core/modules/translation/translation.install +++ b/core/modules/translation/translation.install @@ -15,3 +15,14 @@ function translation_update_8000() { ->condition('permission', 'translate content') ->execute(); } + +/** +* Moves "translation_language_type" from variable to config. +* +* @ingroup config_upgrade + */ +function translation_update_8001() { + update_variables_to_config('translation.settings', array( + 'translation_language_type' => 'language_type', + )); +} diff --git a/core/modules/translation/translation.module b/core/modules/translation/translation.module index 5a67213..0fc5332 100644 --- a/core/modules/translation/translation.module +++ b/core/modules/translation/translation.module @@ -259,7 +259,7 @@ function translation_node_view(Node $node, $view_mode) { // only for configurable language types and interface language is the only // configurable language type in core, we use it as default. Contributed // modules can change this behavior by setting the system variable below. - $type = variable_get('translation_language_type', LANGUAGE_TYPE_INTERFACE); + $type = config('translation.settings')->get('language_type'); $custom_links = language_negotiation_get_switch_links($type, "node/$node->nid"); $links = array(); @@ -537,8 +537,7 @@ function translation_path_get_translations($path) { * Replaces links with pointers to translated versions of the content. */ function translation_language_switch_links_alter(array &$links, $type, $path) { - $language_type = variable_get('translation_language_type', LANGUAGE_TYPE_INTERFACE); - + $language_type = config('translation.settings')->get('language_type'); if ($type == $language_type && preg_match("!^node/(\d+)(/.+|)!", $path, $matches)) { $node = node_load((int) $matches[1]); diff --git a/core/modules/translation/translation.pages.inc b/core/modules/translation/translation.pages.inc index cc94a1e..7a9880c 100644 --- a/core/modules/translation/translation.pages.inc +++ b/core/modules/translation/translation.pages.inc @@ -32,7 +32,7 @@ function translation_node_overview(Node $node) { $translations = array($node->langcode => $node); } - $type = variable_get('translation_language_type', LANGUAGE_TYPE_INTERFACE); + $type = config('translation.settings')->get('language_type'); $header = array(t('Language'), t('Title'), t('Status'), t('Operations')); foreach (language_list() as $langcode => $language) {