Index: install.php
===================================================================
RCS file: /cvs/drupal/drupal/install.php,v
retrieving revision 1.151
diff -u -p -r1.151 install.php
--- install.php	22 Jan 2009 19:31:07 -0000	1.151
+++ install.php	24 Jan 2009 18:01:51 -0000
@@ -575,7 +575,7 @@ function install_select_locale($profilen
  * Form API array definition for language selection.
  */
 function install_select_locale_form(&$form_state, $locales) {
-  include_once DRUPAL_ROOT . '/includes/locale.inc';
+  include_once DRUPAL_ROOT . '/includes/iso.inc';
   $languages = _locale_get_predefined_list();
   foreach ($locales as $locale) {
     // Try to use verbose locale name
@@ -1019,6 +1019,7 @@ function install_task_list($active = NUL
  * Form API array definition for site configuration.
  */
 function install_configure_form(&$form_state, $url) {
+  include_once DRUPAL_ROOT . '/includes/locale.inc';
 
   $form['intro'] = array(
     '#markup' => st('To configure your website, please provide the following information.'),
@@ -1082,6 +1083,16 @@ function install_configure_form(&$form_s
     '#title' => st('Server settings'),
     '#collapsible' => FALSE,
   );
+
+  $form['server_settings']['site_default_country'] = array(
+    '#type' => 'select',
+    '#title' => t('Default country'),
+    '#default_value' => variable_get('site_default_country', ''),
+    '#options' => country_get_list(),
+    '#description' => t('Select the default country for the site.'),
+    '#weight' => 0,
+  );
+
   $form['server_settings']['date_default_timezone'] = array(
     '#type' => 'select',
     '#title' => st('Default time zone'),
@@ -1155,6 +1166,7 @@ function install_configure_form_submit($
   variable_set('site_name', $form_state['values']['site_name']);
   variable_set('site_mail', $form_state['values']['site_mail']);
   variable_set('date_default_timezone', $form_state['values']['date_default_timezone']);
+  variable_set('site_default_country', $form_state['values']['site_default_country']);
 
   // Enable update.module if this option was selected.
   if ($form_state['values']['update_status_module'][1]) {
Index: includes/iso.inc
===================================================================
RCS file: includes/iso.inc
diff -N includes/iso.inc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ includes/iso.inc	24 Jan 2009 18:01:51 -0000
@@ -0,0 +1,475 @@
+<?php
+// $Id$
+
+/**
+ * @file
+ * Provides a list of countries and languages based on ISO standards.
+ */
+
+/**
+ * Get an array of all country code => country name pairs.
+ *
+ * Get an array of all country code => country name pairs as layed out
+ * in ISO 3166-1 alpha-2 with the exception that on the ISO standard
+ * country codes are uppercased.
+ * Grabbed from location project (http://drupal.org/project/location).
+ * @return
+ *   An array of all country code => country name pairs.
+ */
+function _country_get_predefined_list() {
+  static $countries;
+
+  if (isset($countries)) {
+    return $countries;
+  }
+  $t = get_t();
+
+  $countries = array(
+    'ad' => $t('Andorra'),
+    'ae' => $t('United Arab Emirates'),
+    'af' => $t('Afghanistan'),
+    'ag' => $t('Antigua and Barbuda'),
+    'ai' => $t('Anguilla'),
+    'al' => $t('Albania'),
+    'am' => $t('Armenia'),
+    'an' => $t('Netherlands Antilles'),
+    'ao' => $t('Angola'),
+    'aq' => $t('Antarctica'),
+    'ar' => $t('Argentina'),
+    'as' => $t('American Samoa'),
+    'at' => $t('Austria'),
+    'au' => $t('Australia'),
+    'aw' => $t('Aruba'),
+    'ax' => $t('Aland Islands'),
+    'az' => $t('Azerbaijan'),
+    'ba' => $t('Bosnia and Herzegovina'),
+    'bb' => $t('Barbados'),
+    'bd' => $t('Bangladesh'),
+    'be' => $t('Belgium'),
+    'bf' => $t('Burkina Faso'),
+    'bg' => $t('Bulgaria'),
+    'bh' => $t('Bahrain'),
+    'bi' => $t('Burundi'),
+    'bj' => $t('Benin'),
+    'bm' => $t('Bermuda'),
+    'bn' => $t('Brunei'),
+    'bo' => $t('Bolivia'),
+    'br' => $t('Brazil'),
+    'bs' => $t('Bahamas'),
+    'bt' => $t('Bhutan'),
+    'bv' => $t('Bouvet Island'),
+    'bw' => $t('Botswana'),
+    'by' => $t('Belarus'),
+    'bz' => $t('Belize'),
+    'ca' => $t('Canada'),
+    'cc' => $t('Cocos (Keeling) Islands'),
+    'cd' => $t('Congo (Kinshasa)'),
+    'cf' => $t('Central African Republic'),
+    'cg' => $t('Congo (Brazzaville)'),
+    'ch' => $t('Switzerland'),
+    'ci' => $t('Ivory Coast'),
+    'ck' => $t('Cook Islands'),
+    'cl' => $t('Chile'),
+    'cm' => $t('Cameroon'),
+    'cn' => $t('China'),
+    'co' => $t('Colombia'),
+    'cr' => $t('Costa Rica'),
+    'cs' => $t('Serbia And Montenegro'),
+    'cu' => $t('Cuba'),
+    'cv' => $t('Cape Verde'),
+    'cx' => $t('Christmas Island'),
+    'cy' => $t('Cyprus'),
+    'cz' => $t('Czech Republic'),
+    'de' => $t('Germany'),
+    'dj' => $t('Djibouti'),
+    'dk' => $t('Denmark'),
+    'dm' => $t('Dominica'),
+    'do' => $t('Dominican Republic'),
+    'dz' => $t('Algeria'),
+    'ec' => $t('Ecuador'),
+    'ee' => $t('Estonia'),
+    'eg' => $t('Egypt'),
+    'eh' => $t('Western Sahara'),
+    'er' => $t('Eritrea'),
+    'es' => $t('Spain'),
+    'et' => $t('Ethiopia'),
+    'fi' => $t('Finland'),
+    'fj' => $t('Fiji'),
+    'fk' => $t('Falkland Islands'),
+    'fm' => $t('Micronesia'),
+    'fo' => $t('Faroe Islands'),
+    'fr' => $t('France'),
+    'ga' => $t('Gabon'),
+    'gd' => $t('Grenada'),
+    'ge' => $t('Georgia'),
+    'gf' => $t('French Guiana'),
+    'gg' => $t('Guernsey'),
+    'gh' => $t('Ghana'),
+    'gi' => $t('Gibraltar'),
+    'gl' => $t('Greenland'),
+    'gm' => $t('Gambia'),
+    'gn' => $t('Guinea'),
+    'gp' => $t('Guadeloupe'),
+    'gq' => $t('Equatorial Guinea'),
+    'gr' => $t('Greece'),
+    'gs' => $t('South Georgia and the South Sandwich Islands'),
+    'gt' => $t('Guatemala'),
+    'gu' => $t('Guam'),
+    'gw' => $t('Guinea-Bissau'),
+    'gy' => $t('Guyana'),
+    'hk' => $t('Hong Kong S.A.R., China'),
+    'hm' => $t('Heard Island and McDonald Islands'),
+    'hn' => $t('Honduras'),
+    'hr' => $t('Croatia'),
+    'ht' => $t('Haiti'),
+    'hu' => $t('Hungary'),
+    'id' => $t('Indonesia'),
+    'ie' => $t('Ireland'),
+    'il' => $t('Israel'),
+    'im' => $t('Isle of Man'),
+    'in' => $t('India'),
+    'io' => $t('British Indian Ocean Territory'),
+    'iq' => $t('Iraq'),
+    'ir' => $t('Iran'),
+    'is' => $t('Iceland'),
+    'it' => $t('Italy'),
+    'je' => $t('Jersey'),
+    'jm' => $t('Jamaica'),
+    'jo' => $t('Jordan'),
+    'jp' => $t('Japan'),
+    'ke' => $t('Kenya'),
+    'kg' => $t('Kyrgyzstan'),
+    'kh' => $t('Cambodia'),
+    'ki' => $t('Kiribati'),
+    'km' => $t('Comoros'),
+    'kn' => $t('Saint Kitts and Nevis'),
+    'kp' => $t('North Korea'),
+    'kr' => $t('South Korea'),
+    'kw' => $t('Kuwait'),
+    'ky' => $t('Cayman Islands'),
+    'kz' => $t('Kazakhstan'),
+    'la' => $t('Laos'),
+    'lb' => $t('Lebanon'),
+    'lc' => $t('Saint Lucia'),
+    'li' => $t('Liechtenstein'),
+    'lk' => $t('Sri Lanka'),
+    'lr' => $t('Liberia'),
+    'ls' => $t('Lesotho'),
+    'lt' => $t('Lithuania'),
+    'lu' => $t('Luxembourg'),
+    'lv' => $t('Latvia'),
+    'ly' => $t('Libya'),
+    'ma' => $t('Morocco'),
+    'mc' => $t('Monaco'),
+    'md' => $t('Moldova'),
+    'me' => $t('Montenegro'),
+    'mg' => $t('Madagascar'),
+    'mh' => $t('Marshall Islands'),
+    'mk' => $t('Macedonia'),
+    'ml' => $t('Mali'),
+    'mm' => $t('Myanmar'),
+    'mn' => $t('Mongolia'),
+    'mo' => $t('Macao S.A.R., China'),
+    'mp' => $t('Northern Mariana Islands'),
+    'mq' => $t('Martinique'),
+    'mr' => $t('Mauritania'),
+    'ms' => $t('Montserrat'),
+    'mt' => $t('Malta'),
+    'mu' => $t('Mauritius'),
+    'mv' => $t('Maldives'),
+    'mw' => $t('Malawi'),
+    'mx' => $t('Mexico'),
+    'my' => $t('Malaysia'),
+    'mz' => $t('Mozambique'),
+    'na' => $t('Namibia'),
+    'nc' => $t('New Caledonia'),
+    'ne' => $t('Niger'),
+    'nf' => $t('Norfolk Island'),
+    'ng' => $t('Nigeria'),
+    'ni' => $t('Nicaragua'),
+    'nl' => $t('Netherlands'),
+    'no' => $t('Norway'),
+    'np' => $t('Nepal'),
+    'nr' => $t('Nauru'),
+    'nu' => $t('Niue'),
+    'nz' => $t('New Zealand'),
+    'om' => $t('Oman'),
+    'pa' => $t('Panama'),
+    'pe' => $t('Peru'),
+    'pf' => $t('French Polynesia'),
+    'pg' => $t('Papua New Guinea'),
+    'ph' => $t('Philippines'),
+    'pk' => $t('Pakistan'),
+    'pl' => $t('Poland'),
+    'pm' => $t('Saint Pierre and Miquelon'),
+    'pn' => $t('Pitcairn'),
+    'pr' => $t('Puerto Rico'),
+    'ps' => $t('Palestinian Territory'),
+    'pt' => $t('Portugal'),
+    'pw' => $t('Palau'),
+    'py' => $t('Paraguay'),
+    'qa' => $t('Qatar'),
+    're' => $t('Reunion'),
+    'ro' => $t('Romania'),
+    'rs' => $t('Serbia'),
+    'ru' => $t('Russia'),
+    'rw' => $t('Rwanda'),
+    'sa' => $t('Saudi Arabia'),
+    'sb' => $t('Solomon Islands'),
+    'sc' => $t('Seychelles'),
+    'sd' => $t('Sudan'),
+    'se' => $t('Sweden'),
+    'sg' => $t('Singapore'),
+    'sh' => $t('Saint Helena'),
+    'si' => $t('Slovenia'),
+    'sj' => $t('Svalbard and Jan Mayen'),
+    'sk' => $t('Slovakia'),
+    'sl' => $t('Sierra Leone'),
+    'sm' => $t('San Marino'),
+    'sn' => $t('Senegal'),
+    'so' => $t('Somalia'),
+    'sr' => $t('Suriname'),
+    'st' => $t('Sao Tome and Principe'),
+    'sv' => $t('El Salvador'),
+    'sy' => $t('Syria'),
+    'sz' => $t('Swaziland'),
+    'tc' => $t('Turks and Caicos Islands'),
+    'td' => $t('Chad'),
+    'tf' => $t('French Southern Territories'),
+    'tg' => $t('Togo'),
+    'th' => $t('Thailand'),
+    'tj' => $t('Tajikistan'),
+    'tk' => $t('Tokelau'),
+    'tl' => $t('East Timor'),
+    'tm' => $t('Turkmenistan'),
+    'tn' => $t('Tunisia'),
+    'to' => $t('Tonga'),
+    'tr' => $t('Turkey'),
+    'tt' => $t('Trinidad and Tobago'),
+    'tv' => $t('Tuvalu'),
+    'tw' => $t('Taiwan'),
+    'tz' => $t('Tanzania'),
+    'ua' => $t('Ukraine'),
+    'ug' => $t('Uganda'),
+    'uk' => $t('United Kingdom'),
+    'um' => $t('United States Minor Outlying Islands'),
+    'us' => $t('United States'),
+    'uy' => $t('Uruguay'),
+    'uz' => $t('Uzbekistan'),
+    'va' => $t('Vatican'),
+    'vc' => $t('Saint Vincent and the Grenadines'),
+    've' => $t('Venezuela'),
+    'vg' => $t('British Virgin Islands'),
+    'vi' => $t('U.S. Virgin Islands'),
+    'vn' => $t('Vietnam'),
+    'vu' => $t('Vanuatu'),
+    'wf' => $t('Wallis and Futuna'),
+    'ws' => $t('Samoa'),
+    'ye' => $t('Yemen'),
+    'yt' => $t('Mayotte'),
+    'za' => $t('South Africa'),
+    'zm' => $t('Zambia'),
+    'zw' => $t('Zimbabwe'),
+  );
+
+  // Sort the list.
+  natcasesort($countries);
+
+  return $countries;
+}
+
+/**
+ * @ingroup locale-api-predefined List of predefined languages
+ * @{
+ */
+
+/**
+ * Some of the common languages with their English and native names
+ *
+ * Based on ISO 639 and http://people.w3.org/rishida/names/languages.html
+ */
+function _locale_get_predefined_list() {
+  return array(
+    "aa" => array("Afar"),
+    "ab" => array("Abkhazian", "аҧсуа бызшәа"),
+    "ae" => array("Avestan"),
+    "af" => array("Afrikaans"),
+    "ak" => array("Akan"),
+    "am" => array("Amharic", "አማርኛ"),
+    "ar" => array("Arabic", /* Left-to-right marker "‭" */ "العربية", LANGUAGE_RTL),
+    "as" => array("Assamese"),
+    "av" => array("Avar"),
+    "ay" => array("Aymara"),
+    "az" => array("Azerbaijani", "azərbaycan"),
+    "ba" => array("Bashkir"),
+    "be" => array("Belarusian", "Беларуская"),
+    "bg" => array("Bulgarian", "Български"),
+    "bh" => array("Bihari"),
+    "bi" => array("Bislama"),
+    "bm" => array("Bambara", "Bamanankan"),
+    "bn" => array("Bengali"),
+    "bo" => array("Tibetan"),
+    "br" => array("Breton"),
+    "bs" => array("Bosnian", "Bosanski"),
+    "ca" => array("Catalan", "Català"),
+    "ce" => array("Chechen"),
+    "ch" => array("Chamorro"),
+    "co" => array("Corsican"),
+    "cr" => array("Cree"),
+    "cs" => array("Czech", "Čeština"),
+    "cu" => array("Old Slavonic"),
+    "cv" => array("Chuvash"),
+    "cy" => array("Welsh", "Cymraeg"),
+    "da" => array("Danish", "Dansk"),
+    "de" => array("German", "Deutsch"),
+    "dv" => array("Maldivian"),
+    "dz" => array("Bhutani"),
+    "ee" => array("Ewe", "Ɛʋɛ"),
+    "el" => array("Greek", "Ελληνικά"),
+    "en" => array("English"),
+    "eo" => array("Esperanto"),
+    "es" => array("Spanish", "Español"),
+    "et" => array("Estonian", "Eesti"),
+    "eu" => array("Basque", "Euskera"),
+    "fa" => array("Persian", /* Left-to-right marker "‭" */ "فارسی", LANGUAGE_RTL),
+    "ff" => array("Fulah", "Fulfulde"),
+    "fi" => array("Finnish", "Suomi"),
+    "fj" => array("Fiji"),
+    "fo" => array("Faeroese"),
+    "fr" => array("French", "Français"),
+    "fy" => array("Frisian", "Frysk"),
+    "ga" => array("Irish", "Gaeilge"),
+    "gd" => array("Scots Gaelic"),
+    "gl" => array("Galician", "Galego"),
+    "gn" => array("Guarani"),
+    "gu" => array("Gujarati"),
+    "gv" => array("Manx"),
+    "ha" => array("Hausa"),
+    "he" => array("Hebrew", /* Left-to-right marker "‭" */ "עברית", LANGUAGE_RTL),
+    "hi" => array("Hindi", "हिन्दी"),
+    "ho" => array("Hiri Motu"),
+    "hr" => array("Croatian", "Hrvatski"),
+    "hu" => array("Hungarian", "Magyar"),
+    "hy" => array("Armenian", "Հայերեն"),
+    "hz" => array("Herero"),
+    "ia" => array("Interlingua"),
+    "id" => array("Indonesian", "Bahasa Indonesia"),
+    "ie" => array("Interlingue"),
+    "ig" => array("Igbo"),
+    "ik" => array("Inupiak"),
+    "is" => array("Icelandic", "Íslenska"),
+    "it" => array("Italian", "Italiano"),
+    "iu" => array("Inuktitut"),
+    "ja" => array("Japanese", "日本語"),
+    "jv" => array("Javanese"),
+    "ka" => array("Georgian"),
+    "kg" => array("Kongo"),
+    "ki" => array("Kikuyu"),
+    "kj" => array("Kwanyama"),
+    "kk" => array("Kazakh", "Қазақ"),
+    "kl" => array("Greenlandic"),
+    "km" => array("Cambodian"),
+    "kn" => array("Kannada", "ಕನ್ನಡ"),
+    "ko" => array("Korean", "한국어"),
+    "kr" => array("Kanuri"),
+    "ks" => array("Kashmiri"),
+    "ku" => array("Kurdish", "Kurdî"),
+    "kv" => array("Komi"),
+    "kw" => array("Cornish"),
+    "ky" => array("Kirghiz", "Кыргыз"),
+    "la" => array("Latin", "Latina"),
+    "lb" => array("Luxembourgish"),
+    "lg" => array("Luganda"),
+    "ln" => array("Lingala"),
+    "lo" => array("Laothian"),
+    "lt" => array("Lithuanian", "Lietuvių"),
+    "lv" => array("Latvian", "Latviešu"),
+    "mg" => array("Malagasy"),
+    "mh" => array("Marshallese"),
+    "mi" => array("Maori"),
+    "mk" => array("Macedonian", "Македонски"),
+    "ml" => array("Malayalam", "മലയാളം"),
+    "mn" => array("Mongolian"),
+    "mo" => array("Moldavian"),
+    "mr" => array("Marathi"),
+    "ms" => array("Malay", "Bahasa Melayu"),
+    "mt" => array("Maltese", "Malti"),
+    "my" => array("Burmese"),
+    "na" => array("Nauru"),
+    "nd" => array("North Ndebele"),
+    "ne" => array("Nepali"),
+    "ng" => array("Ndonga"),
+    "nl" => array("Dutch", "Nederlands"),
+    "nb" => array("Norwegian Bokmål", "Bokmål"),
+    "nn" => array("Norwegian Nynorsk", "Nynorsk"),
+    "nr" => array("South Ndebele"),
+    "nv" => array("Navajo"),
+    "ny" => array("Chichewa"),
+    "oc" => array("Occitan"),
+    "om" => array("Oromo"),
+    "or" => array("Oriya"),
+    "os" => array("Ossetian"),
+    "pa" => array("Punjabi"),
+    "pi" => array("Pali"),
+    "pl" => array("Polish", "Polski"),
+    "ps" => array("Pashto", /* Left-to-right marker "‭" */ "پښتو", LANGUAGE_RTL),
+    "pt-pt" => array("Portuguese, Portugal", "Português"),
+    "pt-br" => array("Portuguese, Brazil", "Português"),
+    "qu" => array("Quechua"),
+    "rm" => array("Rhaeto-Romance"),
+    "rn" => array("Kirundi"),
+    "ro" => array("Romanian", "Română"),
+    "ru" => array("Russian", "Русский"),
+    "rw" => array("Kinyarwanda"),
+    "sa" => array("Sanskrit"),
+    "sc" => array("Sardinian"),
+    "sd" => array("Sindhi"),
+    "se" => array("Northern Sami"),
+    "sg" => array("Sango"),
+    "sh" => array("Serbo-Croatian"),
+    "si" => array("Singhalese"),
+    "sk" => array("Slovak", "Slovenčina"),
+    "sl" => array("Slovenian", "Slovenščina"),
+    "sm" => array("Samoan"),
+    "sn" => array("Shona"),
+    "so" => array("Somali"),
+    "sq" => array("Albanian", "Shqip"),
+    "sr" => array("Serbian", "Српски"),
+    "ss" => array("Siswati"),
+    "st" => array("Sesotho"),
+    "su" => array("Sudanese"),
+    "sv" => array("Swedish", "Svenska"),
+    "sw" => array("Swahili", "Kiswahili"),
+    "ta" => array("Tamil", "தமிழ்"),
+    "te" => array("Telugu", "తెలుగు"),
+    "tg" => array("Tajik"),
+    "th" => array("Thai", "ภาษาไทย"),
+    "ti" => array("Tigrinya"),
+    "tk" => array("Turkmen"),
+    "tl" => array("Tagalog"),
+    "tn" => array("Setswana"),
+    "to" => array("Tonga"),
+    "tr" => array("Turkish", "Türkçe"),
+    "ts" => array("Tsonga"),
+    "tt" => array("Tatar", "Tatarça"),
+    "tw" => array("Twi"),
+    "ty" => array("Tahitian"),
+    "ug" => array("Uighur"),
+    "uk" => array("Ukrainian", "Українська"),
+    "ur" => array("Urdu", /* Left-to-right marker "‭" */ "اردو", LANGUAGE_RTL),
+    "uz" => array("Uzbek", "o'zbek"),
+    "ve" => array("Venda"),
+    "vi" => array("Vietnamese", "Tiếng Việt"),
+    "wo" => array("Wolof"),
+    "xh" => array("Xhosa", "isiXhosa"),
+    "yi" => array("Yiddish"),
+    "yo" => array("Yoruba", "Yorùbá"),
+    "za" => array("Zhuang"),
+    "zh-hans" => array("Chinese, Simplified", "简体中文"),
+    "zh-hant" => array("Chinese, Traditional", "繁體中文"),
+    "zu" => array("Zulu", "isiZulu"),
+  );
+}
+/**
+ * @} End of "locale-api-languages-predefined"
+ */
Index: includes/locale.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/locale.inc,v
retrieving revision 1.200
diff -u -p -r1.200 locale.inc
--- includes/locale.inc	22 Jan 2009 03:29:01 -0000	1.200
+++ includes/locale.inc	24 Jan 2009 18:01:53 -0000
@@ -302,6 +302,7 @@ function locale_languages_predefined_for
 
   if (!isset($form_state['values']['name'])) {
     // Predefined language selection.
+    include_once DRUPAL_ROOT . '/includes/iso.inc';
     $predefined = _locale_get_predefined_list();
     if (!isset($predefined[$langcode])) {
       form_set_error('langcode', t('Invalid language code.'));
@@ -325,6 +326,7 @@ function locale_languages_predefined_for
   }
   else {
     // Predefined language selection.
+    include_once DRUPAL_ROOT . '/includes/iso.inc';
     $predefined = _locale_get_predefined_list();
     locale_add_language($langcode);
     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($predefined[$langcode][0]), '@locale-help' => url('admin/help/locale'))));
@@ -659,6 +661,7 @@ function locale_translate_import_form_su
     $languages = language_list('language', TRUE);
     $langcode = $form_state['values']['langcode'];
     if (!isset($languages[$langcode])) {
+      include_once DRUPAL_ROOT . '/includes/iso.inc';
       $predefined = _locale_get_predefined_list();
       locale_add_language($langcode);
       drupal_set_message(t('The language %language has been created.', array('%language' => t($predefined[$langcode][0]))));
@@ -982,6 +985,7 @@ function locale_add_language($langcode, 
 
   // If name was not set, we add a predefined language.
   if (!isset($name)) {
+    include_once DRUPAL_ROOT . '/includes/iso.inc';
     $predefined = _locale_get_predefined_list();
     $name = $predefined[$langcode][0];
     $native = isset($predefined[$langcode][1]) ? $predefined[$langcode][1] : $predefined[$langcode][0];
@@ -2287,6 +2291,7 @@ function _locale_translate_language_list
  * Prepares the language code list for a select form item with only the unsupported ones
  */
 function _locale_prepare_predefined_list() {
+  include_once DRUPAL_ROOT . '/includes/iso.inc';
   $languages = language_list();
   $predefined = _locale_get_predefined_list();
   foreach ($predefined as $key => $value) {
@@ -2308,193 +2313,6 @@ function _locale_prepare_predefined_list
 }
 
 /**
- * Some of the common languages with their English and native names
- *
- * Based on ISO 639 and http://people.w3.org/rishida/names/languages.html
- */
-function _locale_get_predefined_list() {
-  return array(
-    "aa" => array("Afar"),
-    "ab" => array("Abkhazian", "аҧсуа бызшәа"),
-    "ae" => array("Avestan"),
-    "af" => array("Afrikaans"),
-    "ak" => array("Akan"),
-    "am" => array("Amharic", "አማርኛ"),
-    "ar" => array("Arabic", /* Left-to-right marker "‭" */ "العربية", LANGUAGE_RTL),
-    "as" => array("Assamese"),
-    "av" => array("Avar"),
-    "ay" => array("Aymara"),
-    "az" => array("Azerbaijani", "azərbaycan"),
-    "ba" => array("Bashkir"),
-    "be" => array("Belarusian", "Беларуская"),
-    "bg" => array("Bulgarian", "Български"),
-    "bh" => array("Bihari"),
-    "bi" => array("Bislama"),
-    "bm" => array("Bambara", "Bamanankan"),
-    "bn" => array("Bengali"),
-    "bo" => array("Tibetan"),
-    "br" => array("Breton"),
-    "bs" => array("Bosnian", "Bosanski"),
-    "ca" => array("Catalan", "Català"),
-    "ce" => array("Chechen"),
-    "ch" => array("Chamorro"),
-    "co" => array("Corsican"),
-    "cr" => array("Cree"),
-    "cs" => array("Czech", "Čeština"),
-    "cu" => array("Old Slavonic"),
-    "cv" => array("Chuvash"),
-    "cy" => array("Welsh", "Cymraeg"),
-    "da" => array("Danish", "Dansk"),
-    "de" => array("German", "Deutsch"),
-    "dv" => array("Maldivian"),
-    "dz" => array("Bhutani"),
-    "ee" => array("Ewe", "Ɛʋɛ"),
-    "el" => array("Greek", "Ελληνικά"),
-    "en" => array("English"),
-    "eo" => array("Esperanto"),
-    "es" => array("Spanish", "Español"),
-    "et" => array("Estonian", "Eesti"),
-    "eu" => array("Basque", "Euskera"),
-    "fa" => array("Persian", /* Left-to-right marker "‭" */ "فارسی", LANGUAGE_RTL),
-    "ff" => array("Fulah", "Fulfulde"),
-    "fi" => array("Finnish", "Suomi"),
-    "fj" => array("Fiji"),
-    "fo" => array("Faeroese"),
-    "fr" => array("French", "Français"),
-    "fy" => array("Frisian", "Frysk"),
-    "ga" => array("Irish", "Gaeilge"),
-    "gd" => array("Scots Gaelic"),
-    "gl" => array("Galician", "Galego"),
-    "gn" => array("Guarani"),
-    "gu" => array("Gujarati"),
-    "gv" => array("Manx"),
-    "ha" => array("Hausa"),
-    "he" => array("Hebrew", /* Left-to-right marker "‭" */ "עברית", LANGUAGE_RTL),
-    "hi" => array("Hindi", "हिन्दी"),
-    "ho" => array("Hiri Motu"),
-    "hr" => array("Croatian", "Hrvatski"),
-    "hu" => array("Hungarian", "Magyar"),
-    "hy" => array("Armenian", "Հայերեն"),
-    "hz" => array("Herero"),
-    "ia" => array("Interlingua"),
-    "id" => array("Indonesian", "Bahasa Indonesia"),
-    "ie" => array("Interlingue"),
-    "ig" => array("Igbo"),
-    "ik" => array("Inupiak"),
-    "is" => array("Icelandic", "Íslenska"),
-    "it" => array("Italian", "Italiano"),
-    "iu" => array("Inuktitut"),
-    "ja" => array("Japanese", "日本語"),
-    "jv" => array("Javanese"),
-    "ka" => array("Georgian"),
-    "kg" => array("Kongo"),
-    "ki" => array("Kikuyu"),
-    "kj" => array("Kwanyama"),
-    "kk" => array("Kazakh", "Қазақ"),
-    "kl" => array("Greenlandic"),
-    "km" => array("Cambodian"),
-    "kn" => array("Kannada", "ಕನ್ನಡ"),
-    "ko" => array("Korean", "한국어"),
-    "kr" => array("Kanuri"),
-    "ks" => array("Kashmiri"),
-    "ku" => array("Kurdish", "Kurdî"),
-    "kv" => array("Komi"),
-    "kw" => array("Cornish"),
-    "ky" => array("Kirghiz", "Кыргыз"),
-    "la" => array("Latin", "Latina"),
-    "lb" => array("Luxembourgish"),
-    "lg" => array("Luganda"),
-    "ln" => array("Lingala"),
-    "lo" => array("Laothian"),
-    "lt" => array("Lithuanian", "Lietuvių"),
-    "lv" => array("Latvian", "Latviešu"),
-    "mg" => array("Malagasy"),
-    "mh" => array("Marshallese"),
-    "mi" => array("Maori"),
-    "mk" => array("Macedonian", "Македонски"),
-    "ml" => array("Malayalam", "മലയാളം"),
-    "mn" => array("Mongolian"),
-    "mo" => array("Moldavian"),
-    "mr" => array("Marathi"),
-    "ms" => array("Malay", "Bahasa Melayu"),
-    "mt" => array("Maltese", "Malti"),
-    "my" => array("Burmese"),
-    "na" => array("Nauru"),
-    "nd" => array("North Ndebele"),
-    "ne" => array("Nepali"),
-    "ng" => array("Ndonga"),
-    "nl" => array("Dutch", "Nederlands"),
-    "nb" => array("Norwegian Bokmål", "Bokmål"),
-    "nn" => array("Norwegian Nynorsk", "Nynorsk"),
-    "nr" => array("South Ndebele"),
-    "nv" => array("Navajo"),
-    "ny" => array("Chichewa"),
-    "oc" => array("Occitan"),
-    "om" => array("Oromo"),
-    "or" => array("Oriya"),
-    "os" => array("Ossetian"),
-    "pa" => array("Punjabi"),
-    "pi" => array("Pali"),
-    "pl" => array("Polish", "Polski"),
-    "ps" => array("Pashto", /* Left-to-right marker "‭" */ "پښتو", LANGUAGE_RTL),
-    "pt-pt" => array("Portuguese, Portugal", "Português"),
-    "pt-br" => array("Portuguese, Brazil", "Português"),
-    "qu" => array("Quechua"),
-    "rm" => array("Rhaeto-Romance"),
-    "rn" => array("Kirundi"),
-    "ro" => array("Romanian", "Română"),
-    "ru" => array("Russian", "Русский"),
-    "rw" => array("Kinyarwanda"),
-    "sa" => array("Sanskrit"),
-    "sc" => array("Sardinian"),
-    "sd" => array("Sindhi"),
-    "se" => array("Northern Sami"),
-    "sg" => array("Sango"),
-    "sh" => array("Serbo-Croatian"),
-    "si" => array("Singhalese"),
-    "sk" => array("Slovak", "Slovenčina"),
-    "sl" => array("Slovenian", "Slovenščina"),
-    "sm" => array("Samoan"),
-    "sn" => array("Shona"),
-    "so" => array("Somali"),
-    "sq" => array("Albanian", "Shqip"),
-    "sr" => array("Serbian", "Српски"),
-    "ss" => array("Siswati"),
-    "st" => array("Sesotho"),
-    "su" => array("Sudanese"),
-    "sv" => array("Swedish", "Svenska"),
-    "sw" => array("Swahili", "Kiswahili"),
-    "ta" => array("Tamil", "தமிழ்"),
-    "te" => array("Telugu", "తెలుగు"),
-    "tg" => array("Tajik"),
-    "th" => array("Thai", "ภาษาไทย"),
-    "ti" => array("Tigrinya"),
-    "tk" => array("Turkmen"),
-    "tl" => array("Tagalog"),
-    "tn" => array("Setswana"),
-    "to" => array("Tonga"),
-    "tr" => array("Turkish", "Türkçe"),
-    "ts" => array("Tsonga"),
-    "tt" => array("Tatar", "Tatarça"),
-    "tw" => array("Twi"),
-    "ty" => array("Tahitian"),
-    "ug" => array("Uighur"),
-    "uk" => array("Ukrainian", "Українська"),
-    "ur" => array("Urdu", /* Left-to-right marker "‭" */ "اردو", LANGUAGE_RTL),
-    "uz" => array("Uzbek", "o'zbek"),
-    "ve" => array("Venda"),
-    "vi" => array("Vietnamese", "Tiếng Việt"),
-    "wo" => array("Wolof"),
-    "xh" => array("Xhosa", "isiXhosa"),
-    "yi" => array("Yiddish"),
-    "yo" => array("Yoruba", "Yorùbá"),
-    "za" => array("Zhuang"),
-    "zh-hans" => array("Chinese, Simplified", "简体中文"),
-    "zh-hant" => array("Chinese, Traditional", "繁體中文"),
-    "zu" => array("Zulu", "isiZulu"),
-  );
-}
-/**
  * @} End of "locale-api-languages-predefined"
  */
 
@@ -2651,3 +2469,18 @@ function _locale_batch_language_finished
 /**
  * @} End of "locale-autoimport"
  */
+
+/**
+ * Get list of all predefined and custom countries.
+ *
+ * @return
+ *   An array of all country code => country name pairs.
+ */
+function country_get_list() {
+  include_once DRUPAL_ROOT . '/includes/iso.inc';
+  $countries = _country_get_predefined_list();
+  // Allow other modules to modify the country list.
+  drupal_alter('countries', $countries);
+  return $countries;
+}
+
Index: modules/system/system.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.admin.inc,v
retrieving revision 1.122
diff -u -p -r1.122 system.admin.inc
--- modules/system/system.admin.inc	22 Jan 2009 12:46:07 -0000	1.122
+++ modules/system/system.admin.inc	24 Jan 2009 18:01:57 -0000
@@ -1514,7 +1514,10 @@ function system_rss_feeds_settings() {
  */
 function system_date_time_settings() {
   drupal_add_js(drupal_get_path('module', 'system') . '/system.js');
-  drupal_add_js(array('dateTime' => array('lookup' => url('admin/settings/date-time/lookup'))), 'setting');
+  drupal_add_js(array('dateTime' => array('lookup' => url('admin/settings/regional-settings/lookup'))), 'setting');
+
+  include_once DRUPAL_ROOT . '/includes/locale.inc';
+  $countries = country_get_list();
 
   // Date settings:
   $zones = system_time_zones();
@@ -1549,13 +1552,24 @@ function system_date_time_settings() {
     '#title' => t('Locale settings'),
   );
 
+  $form['locale']['site_default_country'] = array(
+    '#type' => 'select',
+    '#title' => t('Default country'),
+    '#default_value' => variable_get('site_default_country', ''),
+    '#options' => $countries,
+    '#description' => t('Select the default country for the site.'),
+    '#attributes' => array('class' => 'country-detect'),
+  );
+
   $form['locale']['date_default_timezone'] = array(
     '#type' => 'select',
     '#title' => t('Default time zone'),
     '#default_value' => variable_get('date_default_timezone', date_default_timezone_get()),
     '#options' => $zones,
-    '#description' => t('Select the default site time zone.')
+    '#description' => t('Your time zone setting will be automatically detected if possible. Please confirm the selection and click save.'),
+    '#attributes' => array('class' => 'country-timezone-detect'),
   );
+  drupal_add_js('misc/timezone.js');
 
   $form['locale']['date_first_day'] = array(
     '#type' => 'select',
Index: modules/system/system.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.install,v
retrieving revision 1.301
diff -u -p -r1.301 system.install
--- modules/system/system.install	21 Jan 2009 16:58:42 -0000	1.301
+++ modules/system/system.install	24 Jan 2009 18:02:00 -0000
@@ -3110,7 +3110,7 @@ function system_update_7013() {
     $timezone = 'UTC';
   }
   variable_set('date_default_timezone', $timezone);
-  drupal_set_message('The default time zone has been set to <em>' . check_plain($timezone) . '</em>. Please check the ' . l('date and time configuration page', 'admin/settings/date-time') . ' to configure it correctly.', 'warning');
+  drupal_set_message('The default time zone has been set to <em>' . check_plain($timezone) . '</em>. Please check the ' . l('date and time configuration page', 'admin/settings/regional-settings') . ' to configure it correctly.', 'warning');
   return $ret;
 }
 
Index: modules/system/system.js
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.js,v
retrieving revision 1.18
diff -u -p -r1.18 system.js
--- modules/system/system.js	22 Nov 2008 11:54:40 -0000	1.18
+++ modules/system/system.js	24 Jan 2009 18:02:00 -0000
@@ -98,7 +98,7 @@ Drupal.behaviors.copyFieldValue = {
 };
 
 /**
- * Show/hide custom format sections on the date-time settings page.
+ * Show/hide custom format sections on the regional settings page.
  */
 Drupal.behaviors.dateTime = {
   attach: function(context) {
Index: modules/system/system.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.module,v
retrieving revision 1.660
diff -u -p -r1.660 system.module
--- modules/system/system.module	21 Jan 2009 14:22:32 -0000	1.660
+++ modules/system/system.module	24 Jan 2009 18:02:02 -0000
@@ -70,7 +70,7 @@ function system_help($path, $arg) {
       $output .= '<li>' . t('support for enabling and disabling <a href="@themes">themes</a>, which determine the design and presentation of your site. Drupal comes packaged with several core themes and additional contributed themes are available at the <a href="@drupal-themes">Drupal.org theme page</a>.', array('@themes' => url('admin/build/themes'), '@drupal-themes' => 'http://drupal.org/project/themes')) . '</li>';
       $output .= '<li>' . t('a robust <a href="@cache-settings">caching system</a> that allows the efficient re-use of previously-constructed web pages and web page components. Drupal stores the pages requested by anonymous users in a compressed format; depending on your site configuration and the amount of your web traffic tied to anonymous visitors, Drupal\'s caching system may significantly increase the speed of your site.', array('@cache-settings' => url('admin/settings/performance'))) . '</li>';
       $output .= '<li>' . t('a set of routine administrative operations that rely on a correctly-configured <a href="@cron">cron maintenance task</a> to run automatically. A number of other modules, including the feed aggregator, and search also rely on <a href="@cron">cron maintenance tasks</a>. For more information, see the online handbook entry for <a href="@handbook">configuring cron jobs</a>.', array('@cron' => url('admin/reports/status'), '@handbook' => 'http://drupal.org/cron')) . '</li>';
-      $output .= '<li>' . t('basic configuration options for your site, including <a href="@date-settings">date and time settings</a>, <a href="@file-system">file system settings</a>, <a href="@clean-url">clean URL support</a>, <a href="@site-info">site name and other information</a>, and a <a href="@site-maintenance">site maintenance</a> function for taking your site temporarily offline.', array('@date-settings' => url('admin/settings/date-time'), '@file-system' => url('admin/settings/file-system'), '@clean-url' => url('admin/settings/clean-urls'), '@site-info' => url('admin/settings/site-information'), '@site-maintenance' => url('admin/settings/site-maintenance'))) . '</li></ul>';
+      $output .= '<li>' . t('basic configuration options for your site, including <a href="@regional-settings">date and time settings</a>, <a href="@file-system">file system settings</a>, <a href="@clean-url">clean URL support</a>, <a href="@site-info">site name and other information</a>, and a <a href="@site-maintenance">site maintenance</a> function for taking your site temporarily offline.', array('@regional-settings' => url('admin/settings/regional-settings'), '@file-system' => url('admin/settings/file-system'), '@clean-url' => url('admin/settings/clean-urls'), '@site-info' => url('admin/settings/site-information'), '@site-maintenance' => url('admin/settings/site-maintenance'))) . '</li></ul>';
       $output .= '<p>' . t('For more information, see the online handbook entry for <a href="@system">System module</a>.', array('@system' => 'http://drupal.org/handbook/modules/system/')) . '</p>';
       return $output;
     case 'admin/by-module':
@@ -627,14 +627,14 @@ function system_menu() {
     'page arguments' => array('system_rss_feeds_settings'),
     'access arguments' => array('administer site configuration'),
   );
-  $items['admin/settings/date-time'] = array(
-    'title' => 'Date and time',
+  $items['admin/settings/regional-settings'] = array(
+    'title' => 'Regional settings',
     'description' => "Settings for how Drupal displays date and time, as well as the system's default time zone.",
     'page callback' => 'drupal_get_form',
     'page arguments' => array('system_date_time_settings'),
     'access arguments' => array('administer site configuration'),
   );
-  $items['admin/settings/date-time/lookup'] = array(
+  $items['admin/settings/regional-settings/lookup'] = array(
     'title' => 'Date and time lookup',
     'type' => MENU_CALLBACK,
     'page callback' => 'system_date_time_lookup',
Index: modules/user/user.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/user/user.install,v
retrieving revision 1.17
diff -u -p -r1.17 user.install
--- modules/user/user.install	20 Jan 2009 03:10:00 -0000	1.17
+++ modules/user/user.install	24 Jan 2009 18:02:03 -0000
@@ -351,7 +351,7 @@ function user_update_7002(&$sandbox) {
       $ret[] = array('success' => TRUE, 'query' => "Migrate user time zones.");
       if ($sandbox['user_not_migrated'] > 0) {
         variable_set('empty_timezone_message', 1);
-        drupal_set_message('Some user time zones have been emptied and need to be set to the correct values. Use the new ' . l('time zone options', 'admin/settings/date-time') . ' to choose whether to remind users at login to set the correct time zone.', 'warning');
+        drupal_set_message('Some user time zones have been emptied and need to be set to the correct values. Use the new ' . l('time zone options', 'admin/settings/regional-settings') . ' to choose whether to remind users at login to set the correct time zone.', 'warning');
       }
     }
   }
