When having file in sites/default/files/translation/install.nl.po and installing in Dutch the following error comes

Notice: Use of undefined constant LOCALE_NOT_CUSTOMIZED - assumed 'LOCALE_NOT_CUSTOMIZED' in _locale_import_read_po() (line 98 of /Users/clemens/Sites/drupal/d8/www/core/includes/gettext.inc).

Do we have to include core/modules/locale/locale.module which defines it?

const LOCALE_NOT_CUSTOMIZED = 0;

This probably related to #1445004: Implement customized translation bit on translations

CommentFileSizeAuthor
#2 1617598-2.patch758 bytesGábor Hojtsy
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Gábor Hojtsy’s picture

Yes, looks like it (for now). As you know but others reading the issue might not, #1189184: OOP & PSR-0-ify gettext .po file parsing and generation is targeted to decouple locale from the gettext parser though, at which point this should not be an issue anymore. Currently they are hopelessly intertwined.

Gábor Hojtsy’s picture

Status: Active » Needs review
FileSize
758 bytes

I think this should do it. I'm not sure we should elaborate on the fact that a better solution is being worked on at #1189184: OOP & PSR-0-ify gettext .po file parsing and generation, just get this simple fix in if we need this bug fixed ASAP and get moving on #1189184: OOP & PSR-0-ify gettext .po file parsing and generation instead :)

clemens.tolboom’s picture

Issue tags: +Needs tests

He ... this issue was intended for the sprint :p

The guy who solved it could then help me with #1189184: OOP & PSR-0-ify gettext .po file parsing and generation.

I wonder why #1445004: Implement customized translation bit on translations passed the testbot install process. Thus +needs tests.

Let's briefly talk (office hours) about this issue esp. tests as I need loads of info about install tests for #1189184: OOP & PSR-0-ify gettext .po file parsing and generation.

Gábor Hojtsy’s picture

I think #1189184: OOP & PSR-0-ify gettext .po file parsing and generation is complex enough on its own. The installer does not have tests to cover multilingual installation, and we are to work to change that process anyway. It would be good to focus on finally solving #1189184: OOP & PSR-0-ify gettext .po file parsing and generation instead of finding new ways to extend its scope. :/

Gábor Hojtsy’s picture

Status: Needs review » Needs work
Gábor Hojtsy’s picture

re: Tests, I think the main complication we encountered before with this is that we'd need to set the .po file directory to some custom directory *before* invoking install.php for it to display/recognize a list of languages, at which point there is no DB available yet for the site being tested. The only place where install.php seems to be invoked from tests is core/modules/simpletest/lib/Drupal/simpletest/Tests/SimpleTestTest.php, which does not really test the installer, it tests the simpletest browser. So sounds like writing tests for this would require #630446: Allow SimpleTest to test the non-interactive installer being fixed first. I'm not sure we want to postpone our fix getting in sooner though.

Gábor Hojtsy’s picture

I think some manual testing of the patch would be useful and then we can get in the fix to advance work like #1189184: OOP & PSR-0-ify gettext .po file parsing and generation without waiting on changing the testing system.

rvilar’s picture

The patch in #2 works for me.

Gábor Hojtsy’s picture

@rvilar: can you explain what did you do and what did you experience? Could you reproduce the error? Could you reproduce that it was fixed by this patch? A little bit more background on what you did would be useful.

rvilar’s picture

Status: Needs work » Needs review

First of all, I downloaded the Catalan translation for Drupal core and located to sites/default/files/translations/install.ca.po

When trying to install Drupal in another language different from English, Catalan for example, the following errors comes in every page in the installation process:

Notice: Use of undefined constant LOCALE_NOT_CUSTOMIZED - assumed 'LOCALE_NOT_CUSTOMIZED' in _locale_import_read_po() (line 98 of /home/ramon/dev/drupal8/core/includes/gettext.inc).
Notice: Use of undefined constant LOCALE_NOT_CUSTOMIZED - assumed 'LOCALE_NOT_CUSTOMIZED' in _locale_import_one_string() (line 385 of /home/ramon/dev/drupal8/core/includes/gettext.inc).

When applying the patch from #2, the message disappears and everything works fine.

Gábor Hojtsy’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: -Needs tests

Thanks, that looks good. Given that we cannot do automated tests for this, I think this should be good to go now.

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Ok, this looks reasonable as a stop-gap fix.

Courtesy of the great #d8mi sprint in #drupaldevdays, committed and pushed to 8.x! This is my first 8.x-only patch. Gulp. :)

Gábor Hojtsy’s picture

Issue tags: -sprint

Done, removing sprint tag. Thanks all!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Gábor Hojtsy’s picture

Issue tags: +language-ui

Fix tag.