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));
}
Comments
Comment #1
victor-shelepen CreditAttribution: victor-shelepen commentedEverything is right. We need simply pass conditions(make it more complicated), if $group_language = FALSE, It is built-in language(We edit functional).
Comment #2
Gábor HojtsySo 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.
Comment #3
victor-shelepen CreditAttribution: victor-shelepen commentedI see this taks depend on http://drupal.org/node/1998540
Comment #4
Gábor HojtsyAlso, 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.
Comment #5
nonsieHere's a bit better patch with suggestions from #2
Comment #7
nonsie#5: config_translation-mixed_type_notices-1998116-5.patch queued for re-testing.
Comment #8
Schnitzel CreditAttribution: Schnitzel commentedthe attached patch updates this patch to work when #2004194: Add getLanguageWithFallback() to ConfigGroupMapper has landed, will fail before
Comment #10
Schnitzel CreditAttribution: Schnitzel commented#8: config_translation-mixed_type_notices-1998116-8_depends_on_2004194.patch queued for re-testing.
Comment #12
Schnitzel CreditAttribution: Schnitzel commented#8: config_translation-mixed_type_notices-1998116-8_depends_on_2004194.patch queued for re-testing.
Comment #14
Schnitzel CreditAttribution: Schnitzel commented#8: config_translation-mixed_type_notices-1998116-8_depends_on_2004194.patch queued for re-testing.
Comment #16
Schnitzel CreditAttribution: Schnitzel commented#8: config_translation-mixed_type_notices-1998116-8_depends_on_2004194.patch queued for re-testing.
Comment #18
Schnitzel CreditAttribution: Schnitzel commentedsometimes $language can be empty, so checking for this
Comment #20
Schnitzel CreditAttribution: Schnitzel commentednext fix.
Comment #21
Schnitzel CreditAttribution: Schnitzel commentedComment #22
Schnitzel CreditAttribution: Schnitzel commentedadding tests, here tests only
Comment #24
Schnitzel CreditAttribution: Schnitzel commentednew version with tests only, also needed to delete the english language as testbot uses english per default
Comment #25
Schnitzel CreditAttribution: Schnitzel commentedand also with the fix itself, this should not fail
Comment #26
Gábor HojtsyThanks, committed.
Comment #27.0
(not verified) CreditAttribution: commentedUpdated issue summary.