Commit ec5ca21e authored by catch's avatar catch

Issue #1430986 by Gábor Hojtsy, plach: Clean up naming for language...

Issue #1430986 by Gábor Hojtsy, plach: Clean up naming for language negotiation configuration functions/paths.
parent 69d530a0
......@@ -6,21 +6,21 @@
*/
/**
* Setting for language negotiation options
* Builds the configuration form for language negotiation.
*/
function locale_languages_configure_form() {
function language_negotiation_configure_form() {
include_once DRUPAL_ROOT . '/core/includes/language.inc';
$form = array(
'#submit' => array('locale_languages_configure_form_submit'),
'#theme' => 'locale_languages_configure_form',
'#submit' => array('language_negotiation_configure_form_submit'),
'#theme' => 'language_negotiation_configure_form',
'#language_types' => language_types_configurable(FALSE),
'#language_types_info' => language_types_info(),
'#language_providers' => language_negotiation_info(),
);
foreach ($form['#language_types'] as $type) {
_locale_languages_configure_form_language_table($form, $type);
language_negotiation_configure_form_table($form, $type);
}
$form['actions'] = array('#type' => 'actions');
......@@ -35,7 +35,7 @@ function locale_languages_configure_form() {
/**
* Helper function to build a language provider table.
*/
function _locale_languages_configure_form_language_table(&$form, $type) {
function language_negotiation_configure_form_table(&$form, $type) {
$info = $form['#language_types_info'][$type];
$table_form = array(
......@@ -117,7 +117,7 @@ function _locale_languages_configure_form_language_table(&$form, $type) {
}
/**
* Returns HTML for a language configuration form.
* Returns HTML for the language negotiation configuration form.
*
* @param $variables
* An associative array containing:
......@@ -125,7 +125,7 @@ function _locale_languages_configure_form_language_table(&$form, $type) {
*
* @ingroup themeable
*/
function theme_locale_languages_configure_form($variables) {
function theme_language_negotiation_configure_form($variables) {
$form = $variables['form'];
$output = '';
......@@ -186,7 +186,7 @@ function theme_locale_languages_configure_form($variables) {
/**
* Submit handler for language negotiation settings.
*/
function locale_languages_configure_form_submit($form, &$form_state) {
function language_negotiation_configure_form_submit($form, &$form_state) {
$configurable_types = $form['#language_types'];
foreach ($configurable_types as $type) {
......@@ -211,14 +211,14 @@ function locale_languages_configure_form_submit($form, &$form_state) {
// configuration.
language_types_set();
$form_state['redirect'] = 'admin/config/regional/language/configure';
$form_state['redirect'] = 'admin/config/regional/language/detection';
drupal_set_message(t('Language negotiation configuration saved.'));
}
/**
* The URL language provider configuration form.
* Builds the URL language provider configuration form.
*/
function locale_language_providers_url_form($form, &$form_state) {
function language_negotiation_configure_url_form($form, &$form_state) {
$form['locale_language_negotiation_url_part'] = array(
'#title' => t('Part of the URL that determines language'),
'#type' => 'radios',
......@@ -276,7 +276,7 @@ function locale_language_providers_url_form($form, &$form_state) {
);
}
$form_state['redirect'] = 'admin/config/regional/language/configure';
$form_state['redirect'] = 'admin/config/regional/language/detection';
$form['actions']['#type'] = 'actions';
$form['actions']['submit'] = array(
......@@ -292,7 +292,7 @@ function locale_language_providers_url_form($form, &$form_state) {
* Validate that the prefixes and domains are unique, and make sure that
* the prefix and domain are only blank for the default.
*/
function locale_language_providers_url_form_validate($form, &$form_state) {
function language_negotiation_configure_url_form_validate($form, &$form_state) {
// Get the enabled languages only.
$languages = language_list(TRUE);
$default = language_default();
......@@ -335,7 +335,7 @@ function locale_language_providers_url_form_validate($form, &$form_state) {
/**
* Save URL negotiation provider settings.
*/
function locale_language_providers_url_form_submit($form, &$form_state) {
function language_negotiation_configure_url_form_submit($form, &$form_state) {
// Save selected format (prefix or domain).
variable_set('locale_language_negotiation_url_part', $form_state['values']['locale_language_negotiation_url_part']);
......@@ -350,7 +350,7 @@ function locale_language_providers_url_form_submit($form, &$form_state) {
/**
* The URL language provider configuration form.
*/
function locale_language_providers_session_form($form, &$form_state) {
function language_negotiation_configure_session_form($form, &$form_state) {
$form['locale_language_negotiation_session_param'] = array(
'#title' => t('Request/session parameter'),
'#type' => 'textfield',
......@@ -358,7 +358,7 @@ function locale_language_providers_session_form($form, &$form_state) {
'#description' => t('Name of the request/session parameter used to determine the desired language.'),
);
$form_state['redirect'] = 'admin/config/regional/language/configure';
$form_state['redirect'] = 'admin/config/regional/language/detection';
return system_settings_form($form);
}
......
......@@ -150,7 +150,7 @@ function hook_language_negotiation_info() {
*/
function hook_language_negotiation_info_alter(array &$language_providers) {
if (isset($language_providers['custom_language_provider'])) {
$language_providers['custom_language_provider']['config'] = 'admin/config/regional/language/configure/custom-language-provider';
$language_providers['custom_language_provider']['config'] = 'admin/config/regional/language/detection/custom-language-provider';
}
}
......
......@@ -40,11 +40,11 @@ function locale_help($path, $arg) {
case 'admin/config/regional/language':
return '<p>' . t('Interface text can be translated. <a href="@translations">Download contributed translations</a> from Drupal.org.', array('@translations' => 'http://localize.drupal.org')) . '</p>';
case 'admin/config/regional/language/configure':
case 'admin/config/regional/language/detection':
$output = '<p>' . t("Define how to decide which language is used to display page elements (primarily text provided by Drupal and modules, such as field labels and help text). This decision is made by evaluating a series of detection methods for languages; the first detection method that gets a result will determine which language is used for that type of text. Define the order of evaluation of language detection methods on this page.") . '</p>';
return $output;
case 'admin/config/regional/language/configure/session':
case 'admin/config/regional/language/detection/session':
$output = '<p>' . t('Determine the language from a request/session parameter. Example: "http://example.com?language=de" sets language to German based on the use of "de" within the "language" parameter.') . '</p>';
return $output;
......@@ -62,7 +62,7 @@ function locale_help($path, $arg) {
case 'admin/structure/block/manage/%/%':
if ($arg[4] == 'locale' && $arg[5] == 'language') {
return '<p>' . t('This block is only shown if <a href="@languages">at least two languages are enabled</a> and <a href="@configuration">language negotiation</a> is set to <em>URL</em> or <em>Session</em>.', array('@languages' => url('admin/config/regional/language'), '@configuration' => url('admin/config/regional/language/configure'))) . '</p>';
return '<p>' . t('This block is only shown if <a href="@languages">at least two languages are enabled</a> and <a href="@configuration">language negotiation</a> is set to <em>URL</em> or <em>Session</em>.', array('@languages' => url('admin/config/regional/language'), '@configuration' => url('admin/config/regional/language/detection'))) . '</p>';
}
break;
}
......@@ -73,27 +73,27 @@ function locale_help($path, $arg) {
*/
function locale_menu() {
// Language negotiation.
$items['admin/config/regional/language/configure'] = array(
$items['admin/config/regional/language/detection'] = array(
'title' => 'Detection and selection',
'page callback' => 'drupal_get_form',
'page arguments' => array('locale_languages_configure_form'),
'page arguments' => array('language_negotiation_configure_form'),
'access arguments' => array('administer languages'),
'weight' => 10,
'file' => 'locale.admin.inc',
'type' => MENU_LOCAL_TASK,
);
$items['admin/config/regional/language/configure/url'] = array(
$items['admin/config/regional/language/detection/url'] = array(
'title' => 'URL language detection configuration',
'page callback' => 'drupal_get_form',
'page arguments' => array('locale_language_providers_url_form'),
'page arguments' => array('language_negotiation_configure_url_form'),
'access arguments' => array('administer languages'),
'file' => 'locale.admin.inc',
'type' => MENU_VISIBLE_IN_BREADCRUMB,
);
$items['admin/config/regional/language/configure/session'] = array(
$items['admin/config/regional/language/detection/session'] = array(
'title' => 'Session language detection configuration',
'page callback' => 'drupal_get_form',
'page arguments' => array('locale_language_providers_session_form'),
'page arguments' => array('language_negotiation_configure_session_form'),
'access arguments' => array('administer languages'),
'file' => 'locale.admin.inc',
'type' => MENU_VISIBLE_IN_BREADCRUMB,
......@@ -356,7 +356,7 @@ function locale_field_node_form_submit($form, &$form_state) {
*/
function locale_theme() {
return array(
'locale_languages_configure_form' => array(
'language_negotiation_configure_form' => array(
'render element' => 'form',
),
'locale_date_format_form' => array(
......@@ -477,7 +477,7 @@ function locale_language_negotiation_info() {
'weight' => -8,
'name' => t('URL'),
'description' => t('Determine the language from the URL (Path prefix or domain).'),
'config' => 'admin/config/regional/language/configure/url',
'config' => 'admin/config/regional/language/detection/url',
);
$providers[LANGUAGE_NEGOTIATION_SESSION] = array(
......@@ -490,7 +490,7 @@ function locale_language_negotiation_info() {
'weight' => -6,
'name' => t('Session'),
'description' => t('Determine the language from a request/session parameter.'),
'config' => 'admin/config/regional/language/configure/session',
'config' => 'admin/config/regional/language/detection/session',
);
$providers[LANGUAGE_NEGOTIATION_USER] = array(
......
......@@ -48,7 +48,7 @@ class LocaleConfigurationTest extends DrupalWebTestCase {
$this->drupalLogin($admin_user);
// Check if the Default English language has no path prefix.
$this->drupalGet('admin/config/regional/language/configure/url');
$this->drupalGet('admin/config/regional/language/detection/url');
$this->assertFieldByXPath('//input[@name="prefix[en]"]', '', t('Default English has no path prefix.'));
// Add predefined language.
......@@ -60,10 +60,10 @@ class LocaleConfigurationTest extends DrupalWebTestCase {
$this->assertEqual($this->getUrl(), url('admin/config/regional/language', array('absolute' => TRUE)), t('Correct page redirection.'));
// Check if the Default English language has no path prefix.
$this->drupalGet('admin/config/regional/language/configure/url');
$this->drupalGet('admin/config/regional/language/detection/url');
$this->assertFieldByXPath('//input[@name="prefix[en]"]', '', t('Default English has no path prefix.'));
// Check if French has a path prefix.
$this->drupalGet('admin/config/regional/language/configure/url');
$this->drupalGet('admin/config/regional/language/detection/url');
$this->assertFieldByXPath('//input[@name="prefix[fr]"]', 'fr', t('French has a path prefix.'));
// Check if we can change the default language.
......@@ -79,10 +79,10 @@ class LocaleConfigurationTest extends DrupalWebTestCase {
// Check if a valid language prefix is added afrer changing the default
// language.
$this->drupalGet('admin/config/regional/language/configure/url');
$this->drupalGet('admin/config/regional/language/detection/url');
$this->assertFieldByXPath('//input[@name="prefix[en]"]', 'en', t('A valid path prefix has been added to the previous default language.'));
// Check if French still has a path prefix.
$this->drupalGet('admin/config/regional/language/configure/url');
$this->drupalGet('admin/config/regional/language/detection/url');
$this->assertFieldByXPath('//input[@name="prefix[fr]"]', 'fr', t('French still has a path prefix.'));
}
}
......@@ -1251,7 +1251,7 @@ class LocaleLanguageSwitchingFunctionalTest extends DrupalWebTestCase {
// Enable URL language detection and selection.
$edit = array('language[enabled][locale-url]' => '1');
$this->drupalPost('admin/config/regional/language/configure', $edit, t('Save settings'));
$this->drupalPost('admin/config/regional/language/detection', $edit, t('Save settings'));
// Assert that the language switching block is displayed on the frontpage.
$this->drupalGet('');
......@@ -1532,7 +1532,7 @@ class LocaleUserCreationTest extends DrupalWebTestCase {
$edit = array(
'language[enabled][locale-url]' => TRUE,
);
$this->drupalPost('admin/config/regional/language/configure', $edit, t('Save settings'));
$this->drupalPost('admin/config/regional/language/detection', $edit, t('Save settings'));
$this->assertText(t('Language negotiation configuration saved.'), t('Set language negotiation.'));
// Check if the language selector is available on admin/people/create and
......@@ -1638,7 +1638,7 @@ class LocalePathFunctionalTest extends DrupalWebTestCase {
// Set path prefix.
$edit = array( "prefix[$langcode]" => $prefix );
$this->drupalPost('admin/config/regional/language/configure/url', $edit, t('Save configuration'));
$this->drupalPost('admin/config/regional/language/detection/url', $edit, t('Save configuration'));
// Check that the "xx" front page is readily available because path prefix
// negotiation is pre-configured.
......@@ -2116,7 +2116,7 @@ class LocaleUILanguageNegotiationTest extends DrupalWebTestCase {
// Setup for domain negotiation, first configure the language to have domain
// URL. We use https and a port to make sure that only the domain name is used.
$edit = array("domain[$langcode]" => "https://$language_domain:99");
$this->drupalPost("admin/config/regional/language/configure/url", $edit, t('Save configuration'));
$this->drupalPost("admin/config/regional/language/detection/url", $edit, t('Save configuration'));
// Set the site to use domain language negotiation.
$tests = array(
......@@ -2180,7 +2180,7 @@ class LocaleUILanguageNegotiationTest extends DrupalWebTestCase {
// Enable the path prefix for the default language: this way any unprefixed
// URL must have a valid fallback value.
$edit = array('prefix[en]' => 'en');
$this->drupalPost('admin/config/regional/language/configure/url', $edit, t('Save configuration'));
$this->drupalPost('admin/config/regional/language/detection/url', $edit, t('Save configuration'));
// Enable browser and URL language detection.
$edit = array(
......@@ -2189,8 +2189,8 @@ class LocaleUILanguageNegotiationTest extends DrupalWebTestCase {
'language[weight][locale-browser]' => -8,
'language[weight][locale-url]' => -10,
);
$this->drupalPost('admin/config/regional/language/configure', $edit, t('Save settings'));
$this->drupalGet('admin/config/regional/language/configure');
$this->drupalPost('admin/config/regional/language/detection', $edit, t('Save settings'));
$this->drupalGet('admin/config/regional/language/detection');
// Enable the language switcher block.
$edit = array('blocks[locale_language][region]' => 'sidebar_first');
......@@ -2230,14 +2230,14 @@ class LocaleUILanguageNegotiationTest extends DrupalWebTestCase {
'language[enabled][locale-url]' => TRUE,
'language[weight][locale-url]' => -10,
);
$this->drupalPost('admin/config/regional/language/configure', $edit, t('Save settings'));
$this->drupalPost('admin/config/regional/language/detection', $edit, t('Save settings'));
// Change the domain for the Italian language.
$edit = array(
'locale_language_negotiation_url_part' => 1,
'domain[it]' => 'it.example.com',
);
$this->drupalPost('admin/config/regional/language/configure/url', $edit, t('Save configuration'));
$this->drupalPost('admin/config/regional/language/detection/url', $edit, t('Save configuration'));
// Build the link we're going to test based on the clean url setting.
$link = (!empty($GLOBALS['conf']['clean_url'])) ? 'it.example.com/admin' : 'it.example.com/?q=admin';
......@@ -2303,7 +2303,7 @@ class LocaleUrlRewritingTest extends DrupalWebTestCase {
// Enable URL language detection and selection.
$edit = array('language[enabled][locale-url]' => 1);
$this->drupalPost('admin/config/regional/language/configure', $edit, t('Save settings'));
$this->drupalPost('admin/config/regional/language/detection', $edit, t('Save settings'));
// Reset static caching.
drupal_static_reset('language_list');
......@@ -2381,7 +2381,7 @@ class LocaleMultilingualFieldsFunctionalTest extends DrupalWebTestCase {
// Enable URL language detection and selection.
$edit = array('language[enabled][locale-url]' => '1');
$this->drupalPost('admin/config/regional/language/configure', $edit, t('Save settings'));
$this->drupalPost('admin/config/regional/language/detection', $edit, t('Save settings'));
// Set "Basic page" content type to use multilingual support.
$edit = array(
......@@ -2514,7 +2514,7 @@ class LocaleCommentLanguageFunctionalTest extends DrupalWebTestCase {
'language_content[enabled][locale-url]' => TRUE,
'language_content[enabled][locale-interface]' => FALSE,
);
$this->drupalPost('admin/config/regional/language/configure', $edit, t('Save settings'));
$this->drupalPost('admin/config/regional/language/detection', $edit, t('Save settings'));
// Change user language preference, this way interface language is always
// French no matter what path prefix the URLs have.
......@@ -2604,7 +2604,7 @@ class LocaleDateFormatsFunctionalTest extends DrupalWebTestCase {
$edit = array(
"{$language_type}[enabled][locale-url]" => TRUE,
);
$this->drupalPost('admin/config/regional/language/configure', $edit, t('Save settings'));
$this->drupalPost('admin/config/regional/language/detection', $edit, t('Save settings'));
// Configure date formats.
$this->drupalGet('admin/config/regional/date-time/locale');
......@@ -2690,7 +2690,7 @@ class LocaleLanguageNegotiationInfoFunctionalTest extends DrupalWebTestCase {
$type . '[enabled][' . $test_provider . ']' => TRUE,
$test_type . '[enabled][' . $test_provider . ']' => TRUE,
);
$this->drupalPost('admin/config/regional/language/configure', $edit, t('Save settings'));
$this->drupalPost('admin/config/regional/language/detection', $edit, t('Save settings'));
// Remove the interface language provider by updating the language
// negotiation settings with the proper flag enabled.
......@@ -2770,7 +2770,7 @@ class LocaleLanguageNegotiationInfoFunctionalTest extends DrupalWebTestCase {
$function($modules);
}
$this->drupalGet('admin/config/regional/language/configure');
$this->drupalGet('admin/config/regional/language/detection');
}
/**
......
......@@ -252,7 +252,7 @@ class PathLanguageTestCase extends DrupalWebTestCase {
// Enable URL language detection and selection.
$edit = array('language[enabled][locale-url]' => 1);
$this->drupalPost('admin/config/regional/language/configure', $edit, t('Save settings'));
$this->drupalPost('admin/config/regional/language/detection', $edit, t('Save settings'));
}
/**
......@@ -314,7 +314,7 @@ class PathLanguageTestCase extends DrupalWebTestCase {
'language[enabled][locale-url]' => 1,
'language[weight][locale-url]' => -8,
);
$this->drupalPost('admin/config/regional/language/configure', $edit, t('Save settings'));
$this->drupalPost('admin/config/regional/language/detection', $edit, t('Save settings'));
// Change user language preference.
$edit = array('language' => 'fr');
......@@ -337,7 +337,7 @@ class PathLanguageTestCase extends DrupalWebTestCase {
// Disable URL language negotiation.
$edit = array('language[enabled][locale-url]' => FALSE);
$this->drupalPost('admin/config/regional/language/configure', $edit, t('Save settings'));
$this->drupalPost('admin/config/regional/language/detection', $edit, t('Save settings'));
// Check that the English alias still works.
$this->drupalGet($english_alias);
......@@ -395,7 +395,7 @@ class PathLanguageUITestCase extends DrupalWebTestCase {
// Enable URL language detection and selection.
$edit = array('language[enabled][locale-url]' => 1);
$this->drupalPost('admin/config/regional/language/configure', $edit, t('Save settings'));
$this->drupalPost('admin/config/regional/language/detection', $edit, t('Save settings'));
}
/**
......@@ -483,7 +483,7 @@ class PathMonolingualTestCase extends DrupalWebTestCase {
// Set language detection to URL.
$edit = array('language[enabled][locale-url]' => TRUE);
$this->drupalPost('admin/config/regional/language/configure', $edit, t('Save settings'));
$this->drupalPost('admin/config/regional/language/detection', $edit, t('Save settings'));
// Force languages to be initialized.
drupal_language_initialize();
......
......@@ -2369,7 +2369,7 @@ class CommonFormatDateTestCase extends DrupalWebTestCase {
// Set language prefix.
$edit = array('prefix[' . self::LANGCODE . ']' => self::LANGCODE);
$this->drupalPost('admin/config/regional/language/configure/url', $edit, t('Save configuration'));
$this->drupalPost('admin/config/regional/language/detection/url', $edit, t('Save configuration'));
// Create a test user to carry out the tests.
$test_user = $this->drupalCreateUser();
......
......@@ -2446,8 +2446,8 @@ class SystemAdminTestCase extends DrupalWebTestCase {
$this->assertLinkByHref('admin/config/regional/settings');
$this->assertLinkByHref('admin/config/regional/date-time');
$this->assertLinkByHref('admin/config/regional/language');
$this->assertNoLinkByHref('admin/config/regional/language/configure/session');
$this->assertNoLinkByHref('admin/config/regional/language/configure/url');
$this->assertNoLinkByHref('admin/config/regional/language/detection/session');
$this->assertNoLinkByHref('admin/config/regional/language/detection/url');
$this->assertLinkByHref('admin/config/regional/translate');
// On admin/index only, the administrator should also see a "Configure
// permissions" link for the Locale module.
......@@ -2463,8 +2463,8 @@ class SystemAdminTestCase extends DrupalWebTestCase {
$this->assertNoLinkByHref('admin/config/regional/settings');
$this->assertNoLinkByHref('admin/config/regional/date-time');
$this->assertNoLinkByHref('admin/config/regional/language');
$this->assertNoLinkByHref('admin/config/regional/language/configure/session');
$this->assertNoLinkByHref('admin/config/regional/language/configure/url');
$this->assertNoLinkByHref('admin/config/regional/language/detection/session');
$this->assertNoLinkByHref('admin/config/regional/language/detection/url');
$this->assertLinkByHref('admin/config/regional/translate');
// This user cannot configure permissions, so even on admin/index should
// not see a "Configure permissions" link for the Locale module.
......
......@@ -180,7 +180,7 @@ class TranslationTestCase extends DrupalWebTestCase {
// negotiation is configured.
$this->drupalLogin($this->admin_user);
$edit = array('language[enabled][locale-url]' => FALSE);
$this->drupalPost('admin/config/regional/language/configure', $edit, t('Save settings'));
$this->drupalPost('admin/config/regional/language/detection', $edit, t('Save settings'));
$this->resetCaches();
$edit = array('status' => TRUE);
$this->drupalPost("node/$translation_es->nid/edit", $edit, t('Save'));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment