While I add the translation I receive this notices.

It is used in the code:

 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

 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));
    }
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

victor-shelepen’s picture

Status: Active » Needs review
FileSize
691 bytes

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.

victor-shelepen’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
FileSize
1.33 KB

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

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
FileSize
1.75 KB

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

Schnitzel’s picture

Status: Needs work » Needs review
Schnitzel’s picture

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
FileSize
1.52 KB

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

Schnitzel’s picture

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.