Skip to content
Snippets Groups Projects

Resolve #3457200 "Ai translations submodule"

Merged Valery Lourie requested to merge issue/ai-3457200:3457200-ai-translations-submodule into 1.0.x

Closes #3457200

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • 214 * Adding the translation in database and linking it to the original entity.
    215 *
    216 * @param \Drupal\Core\Entity\ContentEntityInterface $entity
    217 * The entity object.
    218 * @param string $target_language
    219 * The target language.
    220 * @param array $bundleFields
    221 * An array of field name and their translation.
    222 */
    223 public function insertTranslation(
    224 ContentEntityInterface $entity,
    225 string $target_language,
    226 array $bundleFields,
    227 ) {
    228 if ($entity->hasTranslation($target_language)) {
    229 return;
  • Marcus Johansson
  • I checked the code and gave some suggestions - the thing that should change is that the formatted text can't have upcasted text format, that could lead to security issues.

    The rest are recommendations, but the current prompt does not give me good results, I got this as title for instance: Sure! The translation of "test" to Swedish is "test"

    The prompt should also be base prompt injection proofed.

  • Marcus Johansson requested changes

    requested changes

  • 1 ai_translate.translate_content:
    2 path: '/ai_translate/translate/{entity_type}/{entity_id}/{lang_from}/{lang_to}'
    3 defaults:
    4 _controller: '\Drupal\ai_translate\Controller\AiTranslateController::translate'
    5 _title: 'AI powered Translation'
    6 requirements:
    7 _permission: 'create ai content translation'
    • In theory a user that does not have the right to manually translate a content will be able to translate the content if they have this permission, because the original modules permissions are more fine grained, but I think that is fine - only "super editors" should have this permission.

    • Please register or sign in to reply
  • Valery Lourie added 1 commit

    added 1 commit

    • 7010a317 - 3457200: Fix comments from Marcus

    Compare with previous version

  • Valery Lourie added 1 commit

    added 1 commit

    • 83c73ce5 - 3457200: Change the prompt, do not use referrer URL for redirect

    Compare with previous version

  • Valery Lourie added 1 commit

    added 1 commit

    • a9b54b72 - 3457200: Handle multiple values

    Compare with previous version

  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Please register or sign in to reply
    Loading