Commit 879b5357 authored by catch's avatar catch

Issue #1301148 by Gábor Hojtsy: Stop pretending we have configuration translation for languages.

parent 8e967dee
......@@ -2679,7 +2679,6 @@ function language_default() {
(object) array(
'language' => 'en',
'name' => 'English',
'native' => 'English',
'direction' => 0,
'enabled' => 1,
'plurals' => 0,
......
......@@ -1395,7 +1395,6 @@ function install_import_locales(&$install_state) {
$language = (object) array(
'language' => $install_locale,
'name' => $install_locale,
'native' => $install_locale,
'default' => TRUE,
);
locale_language_save($language);
......
......@@ -300,7 +300,7 @@ function language_negotiation_info() {
'callbacks' => array('language' => 'language_from_default'),
'weight' => 10,
'name' => t('Default language'),
'description' => t('Use the default site language (@language_name).', array('@language_name' => language_default()->native)),
'description' => t('Use the default site language (@language_name).', array('@language_name' => language_default()->name)),
'config' => 'admin/config/regional/language',
);
......
......@@ -356,7 +356,7 @@ function locale_language_switcher_url($type, $path) {
foreach ($languages[1] as $language) {
$links[$language->language] = array(
'href' => $path,
'title' => $language->native,
'title' => $language->name,
'language' => $language,
'attributes' => array('class' => array('language-link')),
);
......@@ -384,7 +384,7 @@ function locale_language_switcher_session($type, $path) {
$langcode = $language->language;
$links[$langcode] = array(
'href' => $path,
'title' => $language->native,
'title' => $language->name,
'attributes' => array('class' => array('language-link')),
'query' => $query,
);
......@@ -519,7 +519,6 @@ function locale_language_save($language) {
include_once DRUPAL_ROOT . '/includes/standard.inc';
$predefined = standard_language_list();
$language->name = $predefined[$language->language][0];
$language->native = isset($predefined[$language->language][1]) ? $predefined[$language->language][1] : $predefined[$language->language][0];
$language->direction = isset($predefined[$language->language][2]) ? $predefined[$language->language][2] : LANGUAGE_LTR;
}
......@@ -827,20 +826,20 @@ function _locale_rebuild_js($langcode = NULL) {
// Log the operation and return success flag.
switch ($status) {
case 'updated':
watchdog('locale', 'Updated JavaScript translation file for the language %language.', array('%language' => t($language->name)));
watchdog('locale', 'Updated JavaScript translation file for the language %language.', array('%language' => $language->name));
return TRUE;
case 'rebuilt':
watchdog('locale', 'JavaScript translation file %file.js was lost.', array('%file' => $language->javascript), WATCHDOG_WARNING);
// Proceed to the 'created' case as the JavaScript translation file has
// been created again.
case 'created':
watchdog('locale', 'Created JavaScript translation file for the language %language.', array('%language' => t($language->name)));
watchdog('locale', 'Created JavaScript translation file for the language %language.', array('%language' => $language->name));
return TRUE;
case 'deleted':
watchdog('locale', 'Removed JavaScript translation file for the language %language because no translations currently exist for that language.', array('%language' => t($language->name)));
watchdog('locale', 'Removed JavaScript translation file for the language %language because no translations currently exist for that language.', array('%language' => $language->name));
return TRUE;
case 'error':
watchdog('locale', 'An error occurred during creation of the JavaScript translation file for the language %language.', array('%language' => t($language->name)), WATCHDOG_ERROR);
watchdog('locale', 'An error occurred during creation of the JavaScript translation file for the language %language.', array('%language' => $language->name), WATCHDOG_ERROR);
return FALSE;
default:
// No operation needed.
......
......@@ -187,9 +187,8 @@ function block_install() {
}
/**
* @defgroup updates-7.x-to-8.x Updates from 7.x to 8.x
* @addtogroup updates-7.x-to-8.x
* @{
* Update functions from 7.x to 8.x.
*/
/**
......@@ -200,6 +199,6 @@ function block_update_8000() {
}
/**
* @} End of "defgroup updates-7.x-to-8.x"
* @} End of "addtogroup updates-7.x-to-8.x"
* The next series of updates should start at 9000.
*/
......@@ -2647,7 +2647,6 @@ class FieldTranslationsTestCase extends FieldTestCase {
$language = (object) array(
'language' => 'l' . $i,
'name' => $this->randomString(),
'native' => $this->randomString(),
);
locale_language_save($language);
}
......
......@@ -275,7 +275,8 @@ function _locale_languages_common_controls(&$form, $language = NULL) {
);
}
else {
$form['langcode'] = array('#type' => 'textfield',
$form['langcode'] = array(
'#type' => 'textfield',
'#title' => t('Language code'),
'#size' => 12,
'#maxlength' => 60,
......@@ -285,21 +286,15 @@ function _locale_languages_common_controls(&$form, $language = NULL) {
'#description' => t('Use language codes as <a href="@w3ctags">defined by the W3C</a> for interoperability. <em>Examples: "en", "en-gb" and "zh-hant".</em>', array('@w3ctags' => 'http://www.w3.org/International/articles/language-tags/')),
);
}
$form['name'] = array('#type' => 'textfield',
'#title' => t('Language name in English'),
$form['name'] = array(
'#type' => 'textfield',
'#title' => t('Language name'),
'#maxlength' => 64,
'#default_value' => @$language->name,
'#required' => TRUE,
'#description' => t('Name of the language in English. Will be available for translation in all languages.'),
);
$form['native'] = array('#type' => 'textfield',
'#title' => t('Native language name'),
'#maxlength' => 64,
'#default_value' => @$language->native,
'#required' => TRUE,
'#description' => t('Name of the language in the language being added.'),
);
$form['direction'] = array('#type' => 'radios',
$form['direction'] = array(
'#type' => 'radios',
'#title' => t('Direction'),
'#required' => TRUE,
'#description' => t('Direction that text in this language is presented.'),
......@@ -352,11 +347,10 @@ function locale_languages_add_custom_form_submit($form, &$form_state) {
$language = (object) array(
'language' => $langcode,
'name' => $form_state['values']['name'],
'native' => $form_state['values']['native'],
'direction' => $form_state['values']['direction'],
);
locale_language_save($language);
drupal_set_message(t('The language %language has been created and can now be used. More information is available on the <a href="@locale-help">help screen</a>.', array('%language' => t($form_state['values']['name']), '@locale-help' => url('admin/help/locale'))));
drupal_set_message(t('The language %language has been created and can now be used. More information is available on the <a href="@locale-help">help screen</a>.', array('%language' => $form_state['values']['name'], '@locale-help' => url('admin/help/locale'))));
locale_languages_add_set_batch($langcode);
$form_state['redirect'] = 'admin/config/regional/language';
}
......@@ -394,16 +388,13 @@ function locale_languages_add_set_batch($langcode) {
* Validate the language editing form. Reused for custom language addition too.
*/
function locale_languages_edit_form_validate($form, &$form_state) {
// Ensure sane field values for langcode, name, and native.
// Ensure sane field values for langcode and name.
if (!isset($form['langcode_view']) && preg_match('@[^a-zA-Z_-]@', $form_state['values']['langcode'])) {
form_set_error('langcode', t('%field may only contain characters a-z, underscores, or hyphens.', array('%field' => $form['langcode']['#title'])));
}
if ($form_state['values']['name'] != check_plain($form_state['values']['name'])) {
form_set_error('name', t('%field cannot contain any markup.', array('%field' => $form['name']['#title'])));
}
if ($form_state['values']['native'] != check_plain($form_state['values']['native'])) {
form_set_error('native', t('%field cannot contain any markup.', array('%field' => $form['native']['#title'])));
}
}
/**
......@@ -415,7 +406,6 @@ function locale_languages_edit_form_submit($form, &$form_state) {
$langcode = $form_state['values']['langcode'];
$language = $languages[$langcode];
$language->name = $form_state['values']['name'];
$language->native = $form_state['values']['native'];
$language->direction = $form_state['values']['direction'];
locale_language_save($language);
$form_state['redirect'] = 'admin/config/regional/language';
......@@ -446,7 +436,7 @@ function locale_languages_delete_form($form, &$form_state, $language) {
}
else {
$form['langcode'] = array('#type' => 'value', '#value' => $langcode);
return confirm_form($form, t('Are you sure you want to delete the language %name?', array('%name' => t($languages[$langcode]->name))), 'admin/config/regional/language', t('Deleting a language will remove all interface translations associated with it, and posts in this language will be set to be language neutral. This action cannot be undone.'), t('Delete'), t('Cancel'));
return confirm_form($form, t('Are you sure you want to delete the language %name?', array('%name' => $languages[$langcode]->name)), 'admin/config/regional/language', t('Deleting a language will remove all interface translations associated with it, and posts in this language will be set to be language neutral. This action cannot be undone.'), t('Delete'), t('Cancel'));
}
}
......@@ -880,7 +870,7 @@ function locale_date_format_language_overview_page() {
);
// Get list of languages.
$languages = locale_language_list('native');
$languages = locale_language_list();
foreach ($languages as $langcode => $info) {
$row = array();
......@@ -897,7 +887,7 @@ function locale_date_format_language_overview_page() {
* Provide date localization configuration options to users.
*/
function locale_date_format_form($form, &$form_state, $langcode) {
$languages = locale_language_list('native');
$languages = locale_language_list();
$language_name = $languages[$langcode];
// Display the current language name.
......
......@@ -17,7 +17,6 @@ function locale_install() {
->fields(array(
'language' => 'en',
'name' => 'English',
'native' => 'English',
'direction' => 0,
'enabled' => 1,
'weight' => 0,
......@@ -95,14 +94,7 @@ function locale_schema() {
'length' => 64,
'not null' => TRUE,
'default' => '',
'description' => 'Language name in English.',
),
'native' => array(
'type' => 'varchar',
'length' => 64,
'not null' => TRUE,
'default' => '',
'description' => 'Native language name.',
'description' => 'Language name.',
),
'direction' => array(
'type' => 'int',
......@@ -255,3 +247,20 @@ function locale_schema() {
return $schema;
}
/**
* @addtogroup updates-7.x-to-8.x
* @{
*/
/**
* Remove the native language name column.
*/
function locale_update_8000() {
db_drop_field('languages', 'native');
}
/**
* @} End of "addtogroup updates-7.x-to-8.x"
* The next series of updates should start at 9000.
*/
......@@ -285,8 +285,7 @@ function locale_language_selector_form(&$form, &$form_state, $user) {
$names = array();
foreach ($languages as $langcode => $item) {
$name = t($item->name);
$names[$langcode] = $name . ($item->native != $name ? ' (' . $item->native . ')' : '');
$names[$langcode] = $item->name;
}
$form['locale'] = array(
'#type' => 'fieldset',
......@@ -762,8 +761,7 @@ function locale_language_name($lang) {
* Returns array of language names
*
* @param $field
* 'name' => names in current language, localized
* 'native' => native names
* Name of language object field.
* @param $all
* Boolean to return all languages or only enabled ones
*/
......@@ -777,7 +775,7 @@ function locale_language_list($field = 'name', $all = FALSE) {
}
$list = array();
foreach ($languages as $language) {
$list[$language->language] = ($field == 'name') ? t($language->name) : $language->$field;
$list[$language->language] = $language->$field;
}
return $list;
}
......
......@@ -304,7 +304,7 @@ function locale_translate_edit_form($form, &$form_state, $lid) {
foreach ($languages as $langcode => $language) {
$form['translations'][$langcode] = array(
'#type' => 'textarea',
'#title' => t($language->name),
'#title' => $language->name,
'#rows' => $rows,
'#default_value' => '',
);
......
......@@ -60,13 +60,10 @@ class LocaleConfigurationTest extends DrupalWebTestCase {
$langcode = 'xx';
// The English name for the language.
$name = $this->randomName(16);
// The native name for the language.
$native = $this->randomName(16);
$edit = array(
'predefined_langcode' => 'custom',
'langcode' => $langcode,
'name' => $name,
'native' => $native,
'direction' => '0',
);
$this->drupalPost('admin/config/regional/language/add', $edit, t('Add custom language'));
......@@ -294,8 +291,6 @@ class LocaleTranslationFunctionalTest extends DrupalWebTestCase {
$langcode = 'xx';
// The English name for the language. This will be translated.
$name = $this->randomName(16);
// The native name for the language.
$native = $this->randomName(16);
// This is the language indicator on the translation search screen for
// untranslated strings. Copied straight from locale.inc.
$language_indicator = "<em class=\"locale-untranslated\">$langcode</em> ";
......@@ -308,7 +303,6 @@ class LocaleTranslationFunctionalTest extends DrupalWebTestCase {
'predefined_langcode' => 'custom',
'langcode' => $langcode,
'name' => $name,
'native' => $native,
'direction' => '0',
);
$this->drupalPost('admin/config/regional/language/add', $edit, t('Add custom language'));
......@@ -410,15 +404,12 @@ class LocaleTranslationFunctionalTest extends DrupalWebTestCase {
$langcode = 'xx';
// The English name for the language. This will be translated.
$name = $this->randomName(16);
// The native name for the language.
$native = $this->randomName(16);
// Add custom language.
$edit = array(
'predefined_langcode' => 'custom',
'langcode' => $langcode,
'name' => $name,
'native' => $native,
'direction' => '0',
);
$this->drupalPost('admin/config/regional/language/add', $edit, t('Add custom language'));
......@@ -470,8 +461,6 @@ class LocaleTranslationFunctionalTest extends DrupalWebTestCase {
$langcode = 'xx';
// The English name for the language. This will be translated.
$name = $this->randomName(16);
// The native name for the language.
$native = $this->randomName(16);
// This is the language indicator on the translation search screen for
// untranslated strings. Copied straight from locale.inc.
$language_indicator = "<em class=\"locale-untranslated\">$langcode</em> ";
......@@ -490,7 +479,6 @@ class LocaleTranslationFunctionalTest extends DrupalWebTestCase {
'predefined_langcode' => 'custom',
'langcode' => $langcode,
'name' => $name,
'native' => $native,
'direction' => '0',
);
$this->drupalPost('admin/config/regional/language/add', $edit, t('Add custom language'));
......@@ -534,8 +522,6 @@ class LocaleTranslationFunctionalTest extends DrupalWebTestCase {
$langcode = 'xx';
// The English name for the language. This will be translated.
$name = $this->randomName(16);
// The native name for the language.
$native = $this->randomName(16);
// This is the language indicator on the translation search screen for
// untranslated strings. Copied straight from locale.inc.
$language_indicator = "<em class=\"locale-untranslated\">$langcode</em> ";
......@@ -548,7 +534,6 @@ class LocaleTranslationFunctionalTest extends DrupalWebTestCase {
'predefined_langcode' => 'custom',
'langcode' => $langcode,
'name' => $name,
'native' => $native,
'direction' => '0',
);
$this->drupalPost('admin/config/regional/language/add', $edit, t('Add custom language'));
......@@ -781,15 +766,12 @@ class LocaleImportFunctionalTest extends DrupalWebTestCase {
$langcode = 'xx';
// The English name for the language.
$name = $this->randomName(16);
// The native name for the language.
$native = $this->randomName(16);
// Create a custom language.
$edit = array(
'predefined_langcode' => 'custom',
'langcode' => $langcode,
'name' => $name,
'native' => $native,
'direction' => '0',
);
$this->drupalPost('admin/config/regional/language/add', $edit, t('Add custom language'));
......@@ -1172,7 +1154,6 @@ class LocaleUninstallFunctionalTest extends DrupalWebTestCase {
$language = (object) array(
'language' => 'fr',
'name' => 'French',
'native' => 'Français',
'default' => $this->language == 'fr',
);
locale_language_save($language);
......@@ -1519,13 +1500,10 @@ class LocaleUserLanguageFunctionalTest extends DrupalWebTestCase {
$langcode = 'xx';
// The English name for the language.
$name = $this->randomName(16);
// The native name for the language.
$native = $this->randomName(16);
$edit = array(
'predefined_langcode' => 'custom',
'langcode' => $langcode,
'name' => $name,
'native' => $native,
'direction' => '0',
);
$this->drupalPost('admin/config/regional/language/add', $edit, t('Add custom language'));
......@@ -1535,13 +1513,10 @@ class LocaleUserLanguageFunctionalTest extends DrupalWebTestCase {
$langcode_disabled = 'xx-yy';
// The English name for the language. This will be translated.
$name_disabled = $this->randomName(16);
// The native name for the language.
$native_disabled = $this->randomName(16);
$edit = array(
'predefined_langcode' => 'custom',
'langcode' => $langcode_disabled,
'name' => $name_disabled,
'native' => $native_disabled,
'direction' => '0',
);
$this->drupalPost('admin/config/regional/language/add', $edit, t('Add custom language'));
......@@ -1710,15 +1685,12 @@ class LocalePathFunctionalTest extends DrupalWebTestCase {
$langcode = 'xx';
// The English name for the language.
$name = $this->randomName(16);
// The native name for the language.
$native = $this->randomName(16);
// The domain prefix.
$prefix = $langcode;
$edit = array(
'predefined_langcode' => 'custom',
'langcode' => $langcode,
'name' => $name,
'native' => $native,
'direction' => '0',
);
$this->drupalPost('admin/config/regional/language/add', $edit, t('Add custom language'));
......@@ -1857,13 +1829,10 @@ class LocaleContentFunctionalTest extends DrupalWebTestCase {
$langcode = 'xx';
// The English name for the language.
$name = $this->randomName(16);
// The native name for the language.
$native = $this->randomName(16);
$edit = array(
'predefined_langcode' => 'custom',
'langcode' => $langcode,
'name' => $name,
'native' => $native,
'direction' => '0',
);
$this->drupalPost('admin/config/regional/language/add', $edit, t('Add custom language'));
......@@ -1873,13 +1842,10 @@ class LocaleContentFunctionalTest extends DrupalWebTestCase {
$langcode_disabled = 'xx-yy';
// The English name for the language.
$name_disabled = $this->randomName(16);
// The native name for the language.
$native_disabled = $this->randomName(16);
$edit = array(
'predefined_langcode' => 'custom',
'langcode' => $langcode_disabled,
'name' => $name_disabled,
'native' => $native_disabled,
'direction' => '0',
);
$this->drupalPost('admin/config/regional/language/add', $edit, t('Add custom language'));
......@@ -2187,7 +2153,7 @@ class LocaleUILanguageNegotiationTest extends DrupalWebTestCase {
// language.
$args = array(':url' => base_path() . (!empty($GLOBALS['conf']['clean_url']) ? $langcode_browser_fallback : "?q=$langcode_browser_fallback"));
$fields = $this->xpath('//div[@id="block-locale-language"]//a[@class="language-link active" and @href=:url]', $args);
$this->assertTrue($fields[0] == $languages[$langcode_browser_fallback]->native, t('The browser language is the URL active language'));
$this->assertTrue($fields[0] == $languages[$langcode_browser_fallback]->name, t('The browser language is the URL active language'));
// Check that URLs are rewritten using the given browser language.
$fields = $this->xpath('//div[@id="site-name"]//a[@rel="home" and @href=:url]//span', $args);
......@@ -2300,7 +2266,6 @@ class LocaleMultilingualFieldsFunctionalTest extends DrupalWebTestCase {
$language = (object) array(
'language' => 'it',
'name' => 'Italian',
'native' => 'Italiano',
);
locale_language_save($language);
......@@ -2531,7 +2496,7 @@ class LocaleDateFormatsFunctionalTest extends DrupalWebTestCase {
// Configure date formats.
$this->drupalGet('admin/config/regional/date-time/locale');
$this->assertText('Français', 'Configured languages appear.');
$this->assertText('French', 'Configured languages appear.');
$edit = array(
'date_format_long' => 'd.m.Y - H:i',
'date_format_medium' => 'd.m.Y - H:i',
......
......@@ -449,7 +449,7 @@ function node_admin_nodes() {
);
if ($multilanguage) {
if ($node->language == LANGUAGE_NONE || isset($languages[$node->language])) {
$options[$node->nid]['language'] = $node->language == LANGUAGE_NONE ? t('Language neutral') : t($languages[$node->language]->name);
$options[$node->nid]['language'] = $node->language == LANGUAGE_NONE ? t('Language neutral') : $languages[$node->language]->name;
}
else {
$options[$node->nid]['language'] = t('Undefined language (@langcode)', array('@langcode' => $node->language));
......
......@@ -2249,7 +2249,6 @@ class FormatDateUnitTest extends DrupalWebTestCase {
'predefined_langcode' => 'custom',
'langcode' => self::LANGCODE,
'name' => self::LANGCODE,
'native' => self::LANGCODE,
'direction' => LANGUAGE_LTR,
);
$this->drupalPost('admin/config/regional/language/add', $edit, t('Add custom language'));
......
......@@ -200,7 +200,7 @@ function translation_form_node_form_alter(&$form, &$form_state) {
/**
* Implements hook_node_view().
*
* Display translation links with native language names, if this node is part of
* Display translation links with language names, if this node is part of
* a translation set. If no language provider is enabled "fall back" to the
* simple links built through the result of translation_node_get_translations().
*/
......@@ -234,7 +234,7 @@ function translation_node_view($node, $view_mode) {
else {
$links[$key] = array(
'href' => "node/{$translation->nid}",
'title' => $language->native,
'title' => $language->name,
'language' => $language,
);
}
......
......@@ -424,7 +424,7 @@ class TranslationTestCase extends DrupalWebTestCase {
$this->drupalGet("node/$node->nid", array('language' => $page_language));
foreach ($types as $type) {
$args = array('%translation_language' => $translation_language->native, '%page_language' => $page_language->native, '%type' => $type);
$args = array('%translation_language' => $translation_language->name, '%page_language' => $page_language->name, '%type' => $type);
if ($find) {
$message = t('[%page_language] Language switch item found for %translation_language language in the %type page area.', $args);
}
......@@ -439,7 +439,7 @@ class TranslationTestCase extends DrupalWebTestCase {
$xpath = '//div[contains(@class, :type)]//span[@class="locale-untranslated"]';
}
$found = $this->findContentByXPath($xpath, array(':type' => $type, ':url' => $url), $translation_language->native);
$found = $this->findContentByXPath($xpath, array(':type' => $type, ':url' => $url), $translation_language->name);
$result = $this->assertTrue($found == $find, $message) && $result;
}
......
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