Skip to content

Issue 35647 translate content on page not working#36231

Open
gortiz-dotcms wants to merge 12 commits into
mainfrom
issue-35647-translate-content-on-page-not-working
Open

Issue 35647 translate content on page not working#36231
gortiz-dotcms wants to merge 12 commits into
mainfrom
issue-35647-translate-content-on-page-not-working

Conversation

@gortiz-dotcms

@gortiz-dotcms gortiz-dotcms commented Jun 18, 2026

Copy link
Copy Markdown
Member

Summary

Fixes #35647

When a user selected a language that had no page version yet, the UVE editor showed a confirmation dialog asking to create a new translation. Clicking "No" previously navigated the user back to the previous language. This made it impossible to view or translate the content that already exists on the page in that language without first creating a full page version.

What changed

edit-ema-editor.component.ts — stay on selected language when declining to create a translation

The reject handler in createNewTranslation previously called #goBackToCurrentLanguage() to navigate back to the previous language. It now does nothing — the page is already loaded in the target language when the dialog appears, so dismissing the dialog naturally keeps the user there.

Content already on the page is shown in the selected language where versions exist, with fallback to the default language where they don't. The page is read-only (no editing) since there is no page version in that language.

withPageApi.ts — sync mode to Preview when page has no translation

When a page loads in an untranslated language, pageParams.mode is forced to UVE_MODE.PREVIEW so the store's mode matches the read-only state the iframe is already in.

withEditor.ts — expose $isMissingTranslation signal

Made the internal isMissingTranslation computed public so the mode selector can react to it.

dot-editor-mode-selector.component.ts — restrict the mode dropdown

  • Draft hidden: always hidden when $isMissingTranslation = true — there is nothing to draft-edit.
  • Published hidden: also hidden — the fallback content shown is not the published state of that language.
  • $syncSelectedMode effect: replaced one-time ngOnInit initialization with a reactive effect so the dropdown updates whenever the mode or available options change (e.g. when switching languages).

Behavior after fix

Action Before After
Select untranslated language Dialog appears → clicking "No" returns to previous language Dialog appears → clicking "No" stays on selected language (read-only)
Grabacion.de.pantalla.2026-06-19.a.la.s.1.02.33.p.m.mov

@github-actions

github-actions Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

🤖 Bedrock Review — deepseek.v3.2

[🟠 High] core-web/libs/portlets/edit-ema/portlet/src/lib/edit-ema-editor/edit-ema-editor.component.ts:270-276 — Removed $showDialogs computed property without updating the template, which still references it. This will cause a runtime error because the template condition @if ($showDialogs()) depends on this signal.

[🟠 High] core-web/libs/portlets/edit-ema/portlet/src/lib/edit-ema-editor/edit-ema-editor.component.html:6-10 — Template still contains @if ($showDialogs()) { ... } wrapper around <dot-edit-ema-dialog>, but the $showDialogs signal was removed. This will break the dialog rendering.

[🟡 Medium] core-web/libs/portlets/edit-ema/portlet/src/lib/edit-ema-editor/edit-ema-editor.component.ts:1719 — Removed #goBackToCurrentLanguage method but its logic is still referenced in the reject callback of createNewTranslation (line 1709). The callback now does nothing, which may be intentional, but the removal of the method without updating its call site is a potential oversight.

[🟡 Medium] core-web/libs/portlets/edit-ema/portlet/src/lib/edit-ema-editor/edit-ema-editor.component.ts:412 — The $translatePageEffect effect now includes a guard for status === UVE_STATUS.LOADED. This is correct, but the effect also uses untracked(() => this.createNewTranslation(...)). Since createNewTranslation calls confirmationService.confirm, which may read signals, this could cause issues if those signals change while the dialog is open. Ensure this is safe.

[🟡 Medium] core-web/libs/portlets/edit-ema/portlet/src/lib/store/features/page-api/withPageApi.ts:197 — Clearing pageLanguages on every page load to prevent stale translation data is correct, but this could cause a brief flash of missing language data in the UI. Ensure dependent computed signals handle the empty array gracefully.

[🟡 Medium] core-web/libs/portlets/edit-ema/portlet/src/lib/store/features/page-api/withPageApi.ts:310-316 — When isMissingTranslation is true, the code patches pageParams.mode to UVE_MODE.PREVIEW. However, it spreads store.pageParams() which may include other params; ensure this doesn't unintentionally override other necessary params like personaId or deviceInode.


Run: #27832687430 · tokens: in: 8318 · out: 570 · total: 8888

@github-actions github-actions Bot added the Area : Frontend PR changes Angular/TypeScript frontend code label Jun 18, 2026
@claude

claude Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Claude finished @gortiz-dotcms's task in 1m 0s —— View job


Rollback Safety Analysis

  • Read rollback-unsafe categories reference
  • Get full PR diff
  • Analyze diff against unsafe categories
  • Apply appropriate label (AI: Safe To Rollback)

Verdict: Safe to Rollback — all 10 changed files are purely frontend (Angular TypeScript + spec files). No database migrations, no Elasticsearch mapping changes, no REST/GraphQL API contract changes, no Java backend changes.

Checked against every category:

  • C-1/C-2/C-3/C-4: No DB schema, ES mapping, or serialization model changes
  • H-1 through H-8: No data migrations, column renames, PK changes, field types, storage providers, stored procedures, or VTL viewtool contract changes
  • M-1/M-2/M-3/M-4: No column type changes, bundle format changes, REST/GraphQL API changes, or OSGi interface changes

The changes affect only Angular component behavior (UVE toolbar language selection flow, mode selector dropdown, store $isMissingTranslation signal). Rolling back to N-1 restores the previous frontend behavior with no data loss or service degradation.

@semgrep-code-dotcms-test

Copy link
Copy Markdown
Contributor

Legal Risk

The following dependencies were released under a license that
has been flagged by your organization for consideration.

Recommendation

While merging is not directly blocked, it's best to pause and consider what it means to use this license before continuing. If you are unsure, reach out to your security team or Semgrep admin to address this issue.

GPL-2.0

MPL-2.0

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… behavior

- Add $isMissingTranslation to UVEStore mock in dot-editor-mode-selector spec
- Add $isMissingTranslation to baseUVEState in toolbar spec
- Add tests: only Preview shown when missing translation, Draft hidden even
  with lock feature enabled, $syncSelectedMode effect sets Preview selection

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- dot-editor-mode-selector.spec: add $isMissingTranslation signal to mock
  store; add missing-translation describe block with 3 new tests
- dot-uve-toolbar.spec: add $isMissingTranslation: signal(false) to baseUVEState
- dot-ema-shell.spec: update expected mode to PREVIEW for language 2 (untranslated)
- edit-ema-editor.spec: patch pageLanguages + pageParams after language-2 load
  so editorHasAccessToEditMode=true and dialog renders for LANGUAGE_IS_CHANGED test

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…lation dialog

Add 4 tests to edit-ema-editor.component.spec.ts that verify the confirm
dialog lifecycle when a user loads a page in an untranslated language:
- dialog opens for untranslated language
- dialog does not open for already-translated language
- rejecting the dialog does not trigger pageLoad (stays on selected language)
- accepting the dialog calls translatePage with the correct language id

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The dot-edit-ema-dialog was inside @if ($showDialogs()), which evaluates
to false when isMissingTranslation=true (because editorCanEditContent=false
and viewMode=PREVIEW). This made this.dialog undefined when the user
accepted the confirm dialog, silently breaking the translatePage call.

Move dot-edit-ema-dialog outside the guard — the component renders
nothing visible when its store is IDLE, so there is no UX impact.
Also remove the now-dead $showDialogs computed and update the stale
comment in the spec.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@gortiz-dotcms gortiz-dotcms marked this pull request as ready for review June 19, 2026 17:27
@mergify

mergify Bot commented Jun 19, 2026

Copy link
Copy Markdown

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI: Safe To Rollback Area : Frontend PR changes Angular/TypeScript frontend code

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

Edit Page: "Create New Language Version?" dialog appears when switching to existing language translation

2 participants