Custom Block support

Created on 11 February 2023, almost 2 years ago
Updated 27 April 2023, over 1 year ago

This module is very powerful. We have used it to modernize our international website.
Nodes translate wonderfully through Google Translate API.

The only area of our pages not translated are custom blocks. Would a separate module or extension of this module be possible to add auto translation to custom blocks?

✨ Feature request
Status

Fixed

Version

2.1

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States dehacker

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @dehacker
  • Assigned to jmauricio
  • πŸ‡΅πŸ‡ΉPortugal jmauricio

    Thanks for the feedback.
    I will look into the custom blocks translation.

  • Issue was unassigned.
  • Status changed to Needs review almost 2 years ago
  • πŸ‡΅πŸ‡ΉPortugal jmauricio

    @dehecker

    I created a separate module for custom block translations:

    - https://www.drupal.org/project/auto_block_translate β†’

    Can you test it?

  • πŸ‡ΊπŸ‡ΈUnited States dehacker

    I have been testing the combination of auto node and auto block modules on the same page.
    The auto block does work to translate the block to Spanish with Google Translate v2 api.

    I am seeing an intermittent problem with the auto node translating a new Spanish translation on some types. It also converts the English translation to Spanish, so both version are then in Spanish. Not sure if this behavior is related to the new module.

    I have not tried this on a generic install but I am using an existing content type on a site with D9 core 9.5.1

    Set content type:
    Language Settings - Enable translation selected.

    Edit existing node and select Auto Translation.
    select: Spanish (new translation)

    Result is all node content is now Spanish.

    Log errors show:
    php 8.1.10
    Date Tuesday, February 14, 2023 - 14:16

    Location http://xyz.lndo.site/
    Referrer http://xyz.lndo.site/es
    Message Warning: Undefined array key 1 in Drupal\Core\Asset\LibraryDependencyResolver->doGetDependencies() (line 67 of /app/web/core/lib/Drupal/Core/Asset/LibraryDependencyResolver.php)
    #0 /app/web/core/includes/bootstrap.inc(347): _drupal_error_handler_real(2, 'Undefined array...', '/app/web/core/l...', 67)
    #1 /app/web/core/lib/Drupal/Core/Asset/LibraryDependencyResolver.php(67): _drupal_error_handler(2, 'Undefined array...', '/app/web/core/l...', 67)
    #2 /app/web/core/lib/Drupal/Core/Asset/LibraryDependencyResolver.php(70): Drupal\Core\Asset\LibraryDependencyResolver->doGetDependencies(Array, Array)

  • πŸ‡΅πŸ‡ΉPortugal jmauricio

    @dehacker

    I can't replicate this behavior, tested in multiple installations and on both Drupal 9 and 10.
    Are you using the latest version of the module?

    Are the content fields translatable? Does de manual translation work as expected?

  • πŸ‡ΊπŸ‡ΈUnited States dehacker

    Thank you. Using latest versions. Content fields and Custom block are translatable.
    I did experience some unexpected behavior with basic manual translation on my site earlier. Still investigating.

    I notice at Block Layout -> Configure block -> Title is not translated.

    Also, when in Spanish language switcher mode.
    Using Translation tab Operations dropdown -> Update Automatic Translation option,
    the Spanish translation only displays English translate.
    xyz.lndo.site/es/block/3/auto-translate-form?destination=/es/node/3

  • πŸ‡΅πŸ‡ΉPortugal jmauricio

    I notice at Block Layout -> Configure block -> Title is not translated.

    This is because that title is not the custom block title, it is the block instance title, for that theme, that behavior is the same as if you do a manual translation.

    Also, when in Spanish language switcher mode.
    Using Translation tab Operations dropdown -> Update Automatic Translation option,
    the Spanish translation only displays English translate.
    xyz.lndo.site/es/block/3/auto-translate-form?destination=/es/node/3

    This is independent of the current language, it will always show the available languages to translate to, excluding the block original language, you can't update the original language based on a translation.

    Hope this helped.

  • πŸ‡΅πŸ‡ΉPortugal jmauricio

    marking as fixed

  • Status changed to Fixed over 1 year ago
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024