summaryrefslogtreecommitdiff
path: root/includes/install.core.inc
diff options
context:
space:
mode:
authorAngie Byron <webchick@24967.no-reply.drupal.org>2011-01-03 15:48:11 +0000
committerAngie Byron <webchick@24967.no-reply.drupal.org>2011-01-03 15:48:11 +0000
commite193ae2b73ef46f35e49ddf415573523e57ec2d5 (patch)
tree9f10f9b3cb5ab64f80896e587781a447ffbf057e /includes/install.core.inc
parent8a6c97a1ceaf648bdbff6b8cb80d24c00935e300 (diff)
downloadbrdo-e193ae2b73ef46f35e49ddf415573523e57ec2d5.tar.gz
brdo-e193ae2b73ef46f35e49ddf415573523e57ec2d5.tar.bz2
#1007488 by Gábor Hojtsy, plach, droplet: Fixed Drupal cannot be installed in a non-predefined language
Diffstat (limited to 'includes/install.core.inc')
-rw-r--r--includes/install.core.inc20
1 files changed, 18 insertions, 2 deletions
diff --git a/includes/install.core.inc b/includes/install.core.inc
index 1acb78fd2..c7b4053d9 100644
--- a/includes/install.core.inc
+++ b/includes/install.core.inc
@@ -1123,6 +1123,11 @@ function install_find_locales($profilename) {
foreach ($locales as $key => $locale) {
// The locale (file name) might be drupal-7.2.cs.po instead of cs.po.
$locales[$key]->langcode = preg_replace('!^(.+\.)?([^\.]+)$!', '\2', $locale->name);
+ // Language codes cannot exceed 12 characters to fit into the {languages}
+ // table.
+ if (strlen($locales[$key]->langcode) > 12) {
+ unset($locales[$key]);
+ }
}
return $locales;
}
@@ -1370,8 +1375,19 @@ function install_profile_modules(&$install_state) {
function install_import_locales(&$install_state) {
include_once DRUPAL_ROOT . '/includes/locale.inc';
$install_locale = $install_state['parameters']['locale'];
- // Enable installation language as default site language.
- locale_add_language($install_locale, NULL, NULL, NULL, '', NULL, 1, TRUE);
+
+ include_once DRUPAL_ROOT . '/includes/iso.inc';
+ $predefined = _locale_get_predefined_list();
+ if (!isset($predefined[$install_locale])) {
+ // Drupal does not know about this language, so we prefill its values with
+ // our best guess. The user will be able to edit afterwards.
+ locale_add_language($install_locale, $install_locale, $install_locale, LANGUAGE_LTR, '', '', TRUE, TRUE);
+ }
+ else {
+ // A known predefined language, details will be filled in properly.
+ locale_add_language($install_locale, NULL, NULL, NULL, '', '', TRUE, TRUE);
+ }
+
// Collect files to import for this language.
$batch = locale_batch_by_language($install_locale, NULL);
if (!empty($batch)) {