Needs review
Project:
Entity Translation
Version:
7.x-1.x-dev
Component:
Base system
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
31 May 2015 at 22:31 UTC
Updated:
13 May 2017 at 10:01 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
b-prod commentedThis patch permits such feature.
Comment #3
b-prod commentedFixes the typo of the previous patch.
Comment #4
b-prod commentedThis is a reroll of the patch in #3, that do not change the README file (automatic correction of the IDE).
EDIT: Sorry for the patch number, I looked on another issue I was working on to set the comment number :-(
Comment #6
b-prod commentedSorry, wrong issue, wrong project... I was definitively tired last days :-(
Comment #7
b-prod commentedTake care of including the
language.incfile when there is only 1 enabled language, but some disabled ones. In such cases, this files is not included by Drupal and we get a PHP fatal error when calling the missing functionlanguage_negotiation_get_switch_links().Comment #8
stefanos.petrakisComment #9
stefanos.petrakisThanks for the report. Picking this up since recently the
entity_translation_languages_enabledvariable was exposed to the Admin UI (see #1175170: Optionally enable disabled languages for entity translation.), which loosely relates to this issue.This feature request is still quite far from covering the case mentioned in this issue IMO.
Even if editing would be possible - by using an idea like the one in the patch from #7 - viewing and previewing the content at hand is not going to be possible. That is because the needed language-aware routing will not be available for the disabled language(s).
In other words, even if one can edit content in a disabled language, it won't be visible since Drupal will not produce a URL for displaying it for a disabled language.
Here are a couple of questions:
+ Why not use the "Translation is published" checkbox in order to control whether a translation is published or not? This setting in combination with the "Language fallback" one can allow you to control whether the content of a WIP-translation is visible or not.
+ What are you SEO-specific concerns? Would be interesting to know a bit about this.
Setting this to needs work based on the missing view/preview functionality. Comments and ideas very welcome.
Comment #10
plachIn D8 we got the rid of the ability of disabling languages because that was not deemed as an effective way to allow for bulk translations, as we have existing staging/site preview solutions that are way more powerful and generic. However, if I’m not mistaken, ET has been allowing to edit disabled languages so far, so there may be lots of sites exploiting this ability so we can’t match the D8 behavior.
For that reason, I think it would probably make sense to ensure editing translations works properly also for disabled languages.
I guess we could try to make language negotiation work with disabled languages by implementing
hook_language_negotiation_info_alter()and override negotiation callbacks, but I bet this would become tricky pretty quickly. All considered, I’d like to reduce complexity to the very minimum required to provide an acceptable behavior and not having view/preview available should be, given that we lived without it so far and this is not a primary use case. If people really need to check their translated content they can always use the edit form.Here's a code review for #7:
I'd simply call this
entity_translation_is_multilingual()and count how many languages are returned byentity_translation_languages()to avoid duplicating its logic.Comment #11
stefanos.petrakisThanks for the update on this one, helped me figure out that this patch actually covers the special case where there is only one enabled language. If there are more than one enabled language, the UI already allows editing content using disabled languages. So, this is true; the requested functionality is already working, i.e. translation of disabled languages is allowed. Therefore I agree that it should continue to be supported.
I rerolled the patch and added a few tests to test the count of languages returned by
entity_translation_languages()as well as the outcome ofentity_translation_is_multilingual(). I also noticed that theEntityTranslationTestCase::disableLanguage()method was not working as expected (seems it's not possible to uncheck and submit a checkbox viadrupalPost()).Comment #13
stefanos.petrakisRerolling this, tests were failing for a reason :-/
Comment #14
plachNice work! I have only a few cosmetic remarks, otherwise I think we're good to go :)
This is an implementation detail I'd leave out from the PHP doc. What about: "Returns TRUE if multiple languages are available for translation."?
Also, we're missing the
@returndocumentation.Missing
@paramdoc and the verb should use the third person singular ("Enables").Here and below: I'd prefer to always add the method visibility modifier, even if it's redundant, as this prevents me from inadvertently mark something as public, when I simply forgot to mark it protected :)
I know this policy is not currently applied consistently, it was a later addition to my toolbox ;)
Disables :)
Why :langcode and not @langcode or !langcode?
Mmh, weird that we have to do this, I thought we got a new installation for each test method.
Tests :)
Comment #15
stefanos.petrakisRerolling (against the updated dev), thanks for the scrutiny! Especially regarding 6., absolutely correct, had to read the manuals again.
P.S.: I opened a task for cleaning up the entity_translation.test file. #2878191: Clean up entity_translation.test (standards, cosmetic)