Problem

  • The entire module seems to consist of UI code and alter hooks only... even the batch to enable/disable translatability entirely consists of custom code... really, no API functions at all?
/**
 * Tests URL aliases for translated nodes.
 */
class PathLanguageTest extends PathTestBase {

  public static $modules = array('locale', 'translation_entity');

  function setUp() {

    // @todo Rewrite entity_translation module to provide proper APIs.
    $edit = array(
      'entity_types[node]' => 'node',
      'settings[node][page][translatable]' => TRUE,
      'settings[node][page][fields][body]' => 'body',
      'settings[node][page][fields][path]' => 'path',
    );
    $this->drupalPost('admin/config/regional/content-language', $edit, t('Save'));

    /*
    // Enable entity translation for the entity type/bundle.
    translation_entity_set_config('node', 'page', 'enabled', TRUE);
    drupal_static_reset();
    entity_info_cache_clear();
    menu_router_rebuild();
    // Enable field translation for the body field.
    $field = field_info_field('body');
    $field['translatable'] = TRUE;
    field_update_field($field);
    // Enable field translation for the default path field.
    $field = field_info_field('path');
    $field['translatable'] = TRUE;
    field_update_field($field);
    */
  }

Comments

sun’s picture

Alas, the drupalPost() fails, if there is only one content type configured... in that case, the form does not contain checkboxes for bundles...

Meanwhile, I've spent a few hours now in order to get that PathLanguageTest to work, and I'm still stuck in the basic test setup :(

sun’s picture

I was wrong... the checkboxes are not displayed, because the user needs the additional "administer entity translation" permission. Why is that a separate permission...?

But even after submitting that form, I still don't get the /translate tabs on the page content type.

sun’s picture

StatusFileSize
new4.13 KB
sun’s picture

StatusFileSize
new4.28 KB

One or more of these permissions was the magic bullet to make the /translate tab appear:

      // Some unknown permission sets for translation_entity module.
      'translate any entity',
      'create entity translations',
      'update entity translations',
      'delete entity translations',
sun’s picture

Assigned: plach » sun
plach’s picture

Is this still alive? Honestly I wouldn't call this major: we are talking about a couple of functions after all.

sun’s picture

Priority: Major » Normal

Yes, this is still a problem. Which functions are that?

If we want to make sure that entity/field translation works in D8, then we need to provide solid + simple APIs for developers and test authors, so they can verify that it actually works in tests.

If it's a problem to programmatically make an entity/field translatable, then we can be sure that no one will test that.

dave reid’s picture

I admit I've looked for and wanted API functions too. Enabling translations for a field via update.php is not fun at all without it. What happens if someone toggles a field switch from untranslatable to translatable and deploys the field settings change CMI to production?

plach’s picture

Well, the migration that now happens when switching field translatability is going away as soon as all entities are converted to NG, since those always store fields in the original language with the 'und' language code.

If I understood the OP correctly, I'd say we need a function doing this:

<?php
    translation_entity_set_config($entity_type, $bundle, 'enabled', $enabled);
    drupal_static_reset();
    entity_info_cache_clear();
    menu_router_rebuild();
?>

and one doing this:

<?php
    $field = field_info_field($field_name);
    $field['translatable'] = $translatable;
    field_update_field($field);
?>

The latter should belong to the Field API.

gábor hojtsy’s picture

Component: translation_entity.module » content_translation.module

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.8.x-dev

Drupal 8.6.x will not receive any further development aside from security fixes. Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

catch’s picture

Issue summary: View changes
Status: Active » Closed (outdated)

There's now ContentTranslationManager. Closing this as outdated.