Skip to content

Pro 8541 switch locale empty doc - #5135

Merged
ValJed merged 30 commits into
mainfrom
pro-8541-switch-locale-empty-doc
Nov 12, 2025
Merged

ValJed merged 30 commits into
mainfrom
pro-8541-switch-locale-empty-doc

Conversation

@ValJed

@ValJed ValJed commented Nov 3, 2025 •

Copy link
Copy Markdown
Contributor

Summary

See ticket, flow support:

  • Save draft or not before to switch (confirmation modal)
  • Ask user if he want to localize current doc or start blank
  • If localize, opens the localize modal

Cypress tests: https://github.com/apostrophecms/testbed/pull/399

What kind of change does this PR introduce?

  • Bug fix
  • New feature
  • Refactor
  • Documentation
  • Build-related changes
  • Other

Make sure the PR fulfills these requirements:

  • It includes a) the existing issue ID being resolved, b) a convincing reason for adding this feature, or c) a clear description of the bug it resolves
  • The changelog is updated
  • Related documentation has been updated
  • Related tests have been updated

@ValJed ValJed self-assigned this Nov 3, 2025
@ValJed
ValJed marked this pull request as draft November 3, 2025 14:39
@ValJed
ValJed requested a review from haroun November 4, 2025 14:43
@ValJed
ValJed marked this pull request as ready for review November 4, 2025 14:44
"willMoveImageToArchive": "Tým sa obrázok presunie do archívu.",
"yes": "Áno",
"yesLocalizeAndSwitchLocales": "Áno, preložte túto stránku a prepnite jazykovú mutáciu",
"yesLocalizeAndSwitchLocalesDoc": "Sim, localizar este {{ docType }} e trocar idiomas",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is portugese

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

},
computed: {
...mapState(useModalStore, [ 'activeModal', 'updateModalData' ]),
...mapState(useModalStore, [ 'activeModal' ]),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we still use updateModalData, why did we removed it?

@ValJed ValJed Nov 5, 2025 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it was already here in the methods, so when you added it in the computed it created a duplicates warning. (methods should be added to methods not computed which is for reactive data: refs / computed).

Comment thread CHANGELOG.md Outdated

### Adds

* When switching locale from the doc editor, ask the user if he wants to localize the current one in the target locale or want to start a blank document.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* When switching locale from the doc editor, ask the user if he wants to localize the current one in the target locale or want to start a blank document.
* When switching locale from the doc editor, ask if the user wants to localize the current document in the target locale or want to start a blank document.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed

@ValJed
ValJed force-pushed the pro-8541-switch-locale-empty-doc branch from b28a981 to c03f0e3 Compare November 5, 2025 11:20
@ValJed
ValJed requested a review from haroun November 5, 2025 13:59
Comment thread modules/@apostrophecms/i18n/ui/apos/components/AposI18nLocalize.vue
Comment thread modules/@apostrophecms/i18n/ui/apos/components/AposI18nLocalize.vue Outdated
Comment thread modules/@apostrophecms/i18n/ui/apos/components/AposI18nLocalize.vue Outdated
const forbiddenTooltip = $t('apostrophe:localeSwitcherPermissionToCreate', {
docType: props.moduleOptions.label.toLowerCase()
});
const docType = $t(props.moduleOptions.label)?.toLowerCase();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is a reliable way to get the doc type. It should be props.moduleOptions.name.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checked together.


if (isLocalized) {
this.switchModalLocale(locale.name);
await this.$nextTick();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why here only?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought it was necessary somehow, when testing now it looks working without it.. Removing.

@ValJed
ValJed requested a review from haroun November 11, 2025 10:45
@ValJed
ValJed force-pushed the pro-8541-switch-locale-empty-doc branch 3 times, most recently from c7a6e09 to 80407dd Compare November 12, 2025 10:00
@ValJed
ValJed force-pushed the pro-8541-switch-locale-empty-doc branch from 80407dd to 50e7895 Compare November 12, 2025 10:02
@ValJed
ValJed merged commit 55d4435 into main Nov 12, 2025
9 checks passed
@ValJed
ValJed deleted the pro-8541-switch-locale-empty-doc branch November 12, 2025 10:42
haroun added a commit that referenced this pull request Nov 12, 2025
* main:
  Pro 8541 switch locale empty doc (#5135)
haroun added a commit that referenced this pull request Nov 12, 2025
…ation

* main:
  Pro 8541 switch locale empty doc (#5135)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants