While I add the translation I receive this notices.

It is used in the code:

<?php
 
return (
     
user_access('translate configuration') &&
       
$group->hasSchema() &&
       
$group->hasTranslatable() &&
        !
$group_language->locked &&
        (empty(
$language) || (!$language->locked && $language->langcode != $group_language->langcode))
    );
?>

$group_language - mixed(object|FALSE)

The first way is to complicate conditions. I think the main problem is that we define The English as the built-in language. Built-in language does not has a key - en. There two extra built-in languages. I do not know why exactly.

The problem in here:
modules/config_translation/lib/Drupal/config_translation/Controller/ConfigTranslationController.php

<?php
 
if (!isset($languages[$original_langcode])) {
     
$language_name = language_name($original_langcode);
      if (
$original_langcode == 'en') {
       
$language_name = t('Built-in English');
      }
     
// Create a dummy language object for this listing only.
     
$languages[$original_langcode] = new Language(array('langcode' => $original_langcode, 'name' => $language_name));
    }
?>
Files: 
CommentFileSizeAuthor
#25 config_translation-mixed_type_notices-1998116-25.patch3 KBSchnitzel
PASSED: [[SimpleTest]]: [MySQL] 269 pass(es).
[ View ]
#24 config_translation-mixed_type_notices-1998116-24-testonly.patch1.52 KBSchnitzel
FAILED: [[SimpleTest]]: [MySQL] 269 pass(es), 0 fail(s), and 4 exception(s).
[ View ]
#22 config_translation-mixed_type_notices-1998116-22-testonly.patch964 bytesSchnitzel
FAILED: [[SimpleTest]]: [MySQL] 258 pass(es), 1 fail(s), and 0 exception(s).
[ View ]
#20 config_translation-mixed_type_notices-1998116-20.patch1.48 KBSchnitzel
PASSED: [[SimpleTest]]: [MySQL] 238 pass(es).
[ View ]
#18 config_translation-mixed_type_notices-1998116-18.patch1.75 KBSchnitzel
FAILED: [[SimpleTest]]: [MySQL] 239 pass(es), 1 fail(s), and 0 exception(s).
[ View ]
#8 config_translation-mixed_type_notices-1998116-8_depends_on_2004194.patch1.1 KBSchnitzel
FAILED: [[SimpleTest]]: [MySQL] 241 pass(es), 1 fail(s), and 64 exception(s).
[ View ]
#5 config_translation-mixed_type_notices-1998116-5.patch1.33 KBnonsie
PASSED: [[SimpleTest]]: [MySQL] 244 pass(es).
[ View ]
#1 config_translation-mixed_type_notices-1998116-1.patch691 byteslikin
PASSED: [[SimpleTest]]: [MySQL] 213 pass(es).
[ View ]

Comments

likin’s picture

Status:Active» Needs review
StatusFileSize
new691 bytes
PASSED: [[SimpleTest]]: [MySQL] 213 pass(es).
[ View ]

Everything is right. We need simply pass conditions(make it more complicated), if $group_language = FALSE, It is built-in language(We edit functional).

Gábor Hojtsy’s picture

Status:Needs review» Needs work
Issue tags:+D8MI, +language-config

So this is for the use case when you don't have English setup on the site and want to translate from English. That is a supported case. I think instead of checking if there was no such language (which is a problem), we should IMHO take $group->getLangcode() into its own variable and check if it was 'en' if the $group_language was not loadable. And only allow access here, if the language was 'en' originally.

likin’s picture

I see this taks depend on http://drupal.org/node/1998540

Gábor Hojtsy’s picture

Also, maybe we want to in fact use the same logic that getLanguage() uses on the group mapper, so we return an English instance even if it was not a configured language. Needs to be explored.

nonsie’s picture

Status:Needs work» Needs review
StatusFileSize
new1.33 KB
PASSED: [[SimpleTest]]: [MySQL] 244 pass(es).
[ View ]

Here's a bit better patch with suggestions from #2

Status:Needs review» Needs work
Issue tags:-D8MI, -language-config

The last submitted patch, config_translation-mixed_type_notices-1998116-5.patch, failed testing.

nonsie’s picture

Status:Needs work» Needs review
Issue tags:+D8MI, +language-config
Schnitzel’s picture

StatusFileSize
new1.1 KB
FAILED: [[SimpleTest]]: [MySQL] 241 pass(es), 1 fail(s), and 64 exception(s).
[ View ]

the attached patch updates this patch to work when #2004194: Add getLanguageWithFallback() to ConfigGroupMapper has landed, will fail before

Status:Needs review» Needs work
Issue tags:-D8MI, -language-config
Schnitzel’s picture

Status:Needs work» Needs review

Status:Needs review» Needs work
Schnitzel’s picture

Status:Needs work» Needs review

Status:Needs review» Needs work
Schnitzel’s picture

Status:Needs work» Needs review

Status:Needs review» Needs work
Schnitzel’s picture

Status:Needs work» Needs review

Status:Needs review» Needs work
Issue tags:+D8MI, +language-config
Schnitzel’s picture

Status:Needs work» Needs review
StatusFileSize
new1.75 KB
FAILED: [[SimpleTest]]: [MySQL] 239 pass(es), 1 fail(s), and 0 exception(s).
[ View ]

sometimes $language can be empty, so checking for this

Status:Needs review» Needs work

The last submitted patch, config_translation-mixed_type_notices-1998116-18.patch, failed testing.

Schnitzel’s picture

StatusFileSize
new1.48 KB
PASSED: [[SimpleTest]]: [MySQL] 238 pass(es).
[ View ]

next fix.

Schnitzel’s picture

Status:Needs work» Needs review
Schnitzel’s picture

StatusFileSize
new964 bytes
FAILED: [[SimpleTest]]: [MySQL] 258 pass(es), 1 fail(s), and 0 exception(s).
[ View ]

adding tests, here tests only

Status:Needs review» Needs work

The last submitted patch, config_translation-mixed_type_notices-1998116-22-testonly.patch, failed testing.

Schnitzel’s picture

Status:Needs work» Needs review
StatusFileSize
new1.52 KB
FAILED: [[SimpleTest]]: [MySQL] 269 pass(es), 0 fail(s), and 4 exception(s).
[ View ]

new version with tests only, also needed to delete the english language as testbot uses english per default

Schnitzel’s picture

StatusFileSize
new3 KB
PASSED: [[SimpleTest]]: [MySQL] 269 pass(es).
[ View ]

and also with the fix itself, this should not fail

Gábor Hojtsy’s picture

Status:Needs review» Fixed

Thanks, committed.

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

Anonymous’s picture

Issue summary:View changes

Updated issue summary.