D8 installer is broken if selecting a non-English language on installation.
Exception shown is:
[Thu Aug 16 02:26:48 2012] [error] [client 127.0.0.1] PHP Fatal error: Class 'Drupal\\locale\\Gettext' not found in /var/www/d8/core/includes/install.inc on line 704
[Thu Aug 16 02:26:48 2012] [error] [client 127.0.0.1] PHP Stack trace:
[Thu Aug 16 02:26:48 2012] [error] [client 127.0.0.1] PHP 1. {main}() /var/www/d8/core/install.php:0
[Thu Aug 16 02:26:48 2012] [error] [client 127.0.0.1] PHP 2. install_drupal() /var/www/d8/core/install.php:36
[Thu Aug 16 02:26:48 2012] [error] [client 127.0.0.1] PHP 3. install_begin_request() /var/www/d8/core/includes/install.core.inc:83
[Thu Aug 16 02:26:48 2012] [error] [client 127.0.0.1] PHP 4. install_verify_database_settings() /var/www/d8/core/includes/install.core.inc:315
[Thu Aug 16 02:26:48 2012] [error] [client 127.0.0.1] PHP 5. install_database_errors() /var/www/d8/core/includes/install.core.inc:880
[Thu Aug 16 02:26:48 2012] [error] [client 127.0.0.1] PHP 6. db_run_tasks() /var/www/d8/core/includes/install.core.inc:1019
[Thu Aug 16 02:26:48 2012] [error] [client 127.0.0.1] PHP 7. Drupal\\Core\\Database\\Install\\Tasks->runTasks() /var/www/d8/core/includes/install.inc:887
[Thu Aug 16 02:26:48 2012] [error] [client 127.0.0.1] PHP 8. call_user_func_array() /var/www/d8/core/lib/Drupal/Core/Database/Install/Tasks.php:136
[Thu Aug 16 02:26:48 2012] [error] [client 127.0.0.1] PHP 9. Drupal\\Core\\Database\\Install\\Tasks->runTestQuery() /var/www/d8/core/lib/Drupal/Core/Database/Install/Tasks.php:0
[Thu Aug 16 02:26:48 2012] [error] [client 127.0.0.1] PHP 10. Drupal\\Core\\Database\\Driver\\mysql\\Install\\Tasks->name() /var/www/d8/core/lib/Drupal/Core/Database/Install/Tasks.php:185
[Thu Aug 16 02:26:48 2012] [error] [client 127.0.0.1] PHP 11. st() /var/www/d8/core/lib/Drupal/Core/Database/Driver/mysql/Install/Tasks.php:27
Steps to reproduce:
1. Create folder sites/default/files/translations
2. Download there a translation from http://localize.drupal.org/translate/downloads, e.g. Spanish
3. Rename the file to install.es.po
4. Open core/install.php and select Spanish.
Comment | File | Size | Author |
---|---|---|---|
#17 | 1733746-17.patch | 1.88 KB | Gábor Hojtsy |
#15 | cleaned_up_previous_patch-1733746-14.patch | 1.89 KB | sxnc |
#12 | added_comment-1733746-12.patch | 3.18 KB | sxnc |
#8 | 1733746-installing-other-language-4.patch | 1.73 KB | jsbalsera |
#8 | interdiff.txt | 1.4 KB | jsbalsera |
Comments
Comment #1
penyaskitoFirst problem is that Drupal\\locale is not registered in the classloader in st() on installation.
I tested using drupal_classloader_register, but no luck. Including the class manually seems to fix the first problem, but not sure if it's an acceptable workaround.
Comment #2
penyaskitoComment #3
penyaskitoWith the patch above I've been able of succesfully installing D8, but Drupal\\locale warnings are everywhere when trying to import the language.
Front page (/) is in English, but if navigating away from the frontpage (e.g. /node) the UI is in Spanish. Pretty confusing.
Comment #4
penyaskitoThe patch removes the warnings, and the installation process now is translated to the selected language on step 1.
However, when visiting the frontpage (/), it's shown in English instead of the selected language.
Seems like a totally unrelated issue.
Comment #5
penyaskitoInstalled a new site in English, changed default language to Spanish, and / is in Spanish, so the bug seems to be on the localized installation, against my initial thoughts.
Comment #6
Gábor HojtsyThis should be referenced in a "use ..." clause above, instead of including the file, no? This is what you referenced above as "First problem is that Drupal\\locale is not registered in the classloader in st() on installation."?
Just use $context instead of calling getContext() again AFAIS.
Comment #7
penyaskitoThe use clause is there. The problem here seems to be that the ClassLoader doesn't know yet that it should be looking for that class at core/modules/locale/lib/Drupal/locale. If I debug
$classloader
,Drupal\\locale
is not a registered namespace. Trieddrupal_classloader_register('locale', drupal_get_path('module', 'locale'))
instead of theinclude_once
, but didn't work either.I'll attach a new patch later today.
Comment #8
jsbalseraHi!
I've made the requested changes and it works for me, although when you access to the / page its content is presented in english. If I access to /node its presented in the installed language.
Comment #9
maxtorete CreditAttribution: maxtorete commentedI have tried jsbalsera's patch and it works fine.
Comment #10
maxtorete CreditAttribution: maxtorete commentedSorry about the status change, I fix it :-(
Comment #11
Gábor HojtsyLooks better! One more note:
This is pretty unusual to see, so I'd add some comments to the effect of:
// Register locale classes with the classloader. Locale module is not yet enabled at this stage, so this is not happening automatically.
(Wrap the comment to 80 chars of course :).
Comment #12
sxnc CreditAttribution: sxnc commentedTestest the patch from comment #8 with 3 languages:
-German
-Japanese
-Swiss German
worked like a charm, no errors. Also added the comment from #11 to the patch from #8
Comment #13
Gábor HojtsyLooks like this got unrelated code at the end from another patch from #1737186: Fix code style issues in new OOP Gettext parser. Let's remove that from here.
Comment #14
lazysoundsystem CreditAttribution: lazysoundsystem commentedComment #15
sxnc CreditAttribution: sxnc commentedSorry about that!
Here's a clean version.
Comment #16
lazysoundsystem CreditAttribution: lazysoundsystem commentedJust tested this and the last patch works cleanly for me.
Comment #17
Gábor HojtsyThe comment should wrap as close to 80 chars as possible (it fits on 2 lines instead of 3 lines that way). This is minor, but is our coding standard. Should not change RTBC status, however, best wait for it to come back green :)
Comment #18
sxnc CreditAttribution: sxnc commentedI see! Will remember that for the next time, thanks! :)
Comment #19
webchickChecked with Gábor, and unfortunately we can't add test coverage for this. Sad panda. :(
However, this definitely needs to be fixed, and then fix looks good to me!
Committed and pushed to 8.x. Thanks!
Comment #20
Gábor HojtsyOff of the sprint.
Comment #21
penyaskitoSaid error on #4 is at #1738330: Confusing Language negotiation when accessing /.
Comment #22
Gábor HojtsyPutting back on sprint just for easier tracking of our work. Will remove later next week.
Comment #23
Gábor HojtsyRemoving as promised. We do not need a change notice or changelog entry for this.