diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0e5920ae80..854b0cfef0 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,7 @@
### Adds
* Translation strings added for the layout- and layout-column-widgets.
+* 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.
### Changes
diff --git a/modules/@apostrophecms/doc-type/ui/apos/components/AposDocEditor.vue b/modules/@apostrophecms/doc-type/ui/apos/components/AposDocEditor.vue
index 5068ba165a..d7e2e7e9fa 100644
--- a/modules/@apostrophecms/doc-type/ui/apos/components/AposDocEditor.vue
+++ b/modules/@apostrophecms/doc-type/ui/apos/components/AposDocEditor.vue
@@ -526,6 +526,7 @@ export default {
draft: true
});
+ this.currentId = docData._id;
if (docData.archived) {
this.restoreOnly = true;
} else {
@@ -533,7 +534,7 @@ export default {
}
const canEdit = docData._edit || this.moduleOptions.canEdit;
this.readOnly = canEdit === false;
- if (canEdit && !await this.lock(this.getOnePath, this.currentId)) {
+ if (canEdit && !await this.lock(this.getOnePath)) {
this.lockNotAvailable();
}
} catch {
@@ -860,10 +861,11 @@ export default {
this.modal.showModal = false;
},
async switchLocale({
- locale, localized, save
+ locale, save, localized, toLocalize
}) {
+ let saved;
if (save) {
- const saved = await this.saveHandler('onSave', {
+ saved = await this.saveHandler('onSave', {
keepOpen: true,
andPublish: false
});
@@ -874,18 +876,37 @@ export default {
this.referenceDocId = saved._id;
}
}
- this.updateModalData(this.modalData.id, { locale });
- this.localeSwitched = locale !== apos.i18n.locale;
- this.published = null;
if (localized) {
this.currentId = localized._id;
+ this.switchModalLocale(locale.name);
await this.instantiateExistingDoc();
- } else {
+ return;
+ }
+ if (!toLocalize) {
+ this.switchModalLocale(locale.name);
this.currentId = '';
this.docType = this.moduleName;
await this.instantiateNewDoc();
+ return;
+ }
+
+ const isLocalized = await apos.modal.execute('AposI18nLocalize', {
+ doc: saved || this.original,
+ locale,
+ moduleName: this.moduleName,
+ shouldRedirect: false
+ });
+
+ if (isLocalized) {
+ this.switchModalLocale(locale.name);
+ await this.instantiateExistingDoc();
}
},
+ switchModalLocale(locale) {
+ this.updateModalData(this.modalData.id, { locale });
+ this.localeSwitched = locale !== apos.i18n.locale;
+ this.published = null;
+ },
getRequestBody({ newInstance = false, update = false }) {
const body = newInstance
? { _newInstance: true }
diff --git a/modules/@apostrophecms/doc-type/ui/apos/components/AposDocLocalePicker.vue b/modules/@apostrophecms/doc-type/ui/apos/components/AposDocLocalePicker.vue
index 235d19ba96..7cba0405e7 100644
--- a/modules/@apostrophecms/doc-type/ui/apos/components/AposDocLocalePicker.vue
+++ b/modules/@apostrophecms/doc-type/ui/apos/components/AposDocLocalePicker.vue
@@ -16,11 +16,11 @@
>
@@ -53,19 +53,18 @@ const props = defineProps({
type: Boolean,
required: true
},
- showLocalized: {
+ isManager: {
type: Boolean,
- default: true
+ default: false
}
});
const $t = inject('i18n');
const i18nAction = apos.modules['@apostrophecms/i18n'].action;
-const forbiddenTooltip = $t('apostrophe:localeSwitcherPermissionToCreate', {
- docType: props.moduleOptions.label.toLowerCase()
-});
+const docType = $t(props.moduleOptions.label)?.toLowerCase();
+const forbiddenTooltip = $t('apostrophe:localeSwitcherPermissionToCreate', { docType });
const menu = ref(null);
-const localized = ref({});
+const docLocalized = ref({});
const forbidden = ref([]);
const isOpen = ref(false);
const button = computed(() => {
@@ -91,7 +90,7 @@ async function open() {
const docs = await apos.http.get(
`${props.moduleOptions.action}/${props.docId}/locales`, { busy: true }
);
- localized.value = Object.fromEntries(
+ docLocalized.value = Object.fromEntries(
docs.results
.filter(doc => doc.aposLocale.endsWith(':draft'))
.map(doc => [ doc.aposLocale.split(':')[0], doc ])
@@ -106,7 +105,7 @@ async function open() {
async function checkCreatePermission() {
const localesWithNoDocs = Object.keys(apos.i18n.locales)
- .filter((locale) => !localized.value[locale]);
+ .filter((locale) => !docLocalized.value[locale]);
const allowed = await apos.http.get(`${i18nAction}/locales-permissions`, {
qs: {
@@ -131,19 +130,24 @@ async function switchLocale(locale) {
return;
}
+ if (props.isManager) {
+ emit('switch-locale', { locale });
+ return;
+ }
+
const save = props.isModified
? await apos.confirm({
heading: 'apostrophe:unsavedChanges',
- description: $t(
- 'apostrophe:localeSwitcherDiscardChangesPrompt',
- { docType: props.moduleOptions.label.toLowerCase() }
- ),
+ description: 'apostrophe:localeSwitcherDiscardChangesPrompt',
negativeLabel: 'apostrophe:localeSwitcherDiscardChangesNegative',
affirmativeLabel: 'apostrophe:localeSwitcherDiscardChangesAffirmative',
icon: false
}, {
hasCloseButton: true,
- tiny: true
+ tiny: true,
+ interpolate: {
+ docType
+ }
})
: false;
@@ -151,9 +155,33 @@ async function switchLocale(locale) {
return;
}
+ const docExist = docLocalized.value[props.locale];
+ const isDocLocalized = docLocalized.value[locale.name];
+ const toLocalize = (docExist && !isDocLocalized)
+ ? await apos.confirm({
+ heading: 'apostrophe:switchLocalesAndLocalizeDoc',
+ description: 'apostrophe:notInLocaleDoc',
+ negativeLabel: 'apostrophe:noCreateBlankDoc',
+ affirmativeLabel: 'apostrophe:yesLocalizeAndSwitchLocalesDoc'
+ }, {
+ hasCloseButton: true,
+ tiny: true,
+ interpolate: {
+ docType,
+ label: locale.label,
+ currentLocale: props.locale
+ }
+ })
+ : false;
+
+ if (toLocalize === null) {
+ return;
+ }
+
emit('switch-locale', {
- locale: locale.name,
- localized: localized.value[locale.name],
+ locale,
+ localized: docLocalized.value[locale.name],
+ toLocalize,
save
});
}
diff --git a/modules/@apostrophecms/i18n/i18n/de.json b/modules/@apostrophecms/i18n/i18n/de.json
index 55c2a0988b..571d32b571 100644
--- a/modules/@apostrophecms/i18n/i18n/de.json
+++ b/modules/@apostrophecms/i18n/i18n/de.json
@@ -62,9 +62,9 @@
"batchPublishCompleted": "{{ count }} {{ type }} veröffentlicht.",
"batchPublishProgress": "Veröffentlichung {{ type }}...",
"batchRestoreCompleted": "{{ count }} {{ type }} wiederhergestellt.",
+ "batchRestoreProgress": "Wiederherstellung {{ type }}...",
"batchTagProgress": "Taggen von {{ count }} {{ type }}...",
"batchUntagProgress": "Entfernen der Markierung von {{ count }} {{ type }}...",
- "batchRestoreProgress": "Wiederherstellung {{ type }}...",
"breakpointPreviewClear": "Klarer Haltepunkt",
"breakpointPreviewDesktop": "Desktop",
"breakpointPreviewExit": "Beenden",
@@ -85,9 +85,9 @@
"clearSelection": "Auswahl löschen",
"close": "Schliessen",
"closeGlobal": "Globale Einstellungen schliessen",
+ "collapseAll": "Alles einklappen",
"colorFieldClickToSelect": "Klicken, um eine Farbe auszuwählen",
"colorFieldColorValue": "Farbe {{ color }}.",
- "collapseAll": "Alles einklappen",
"commandMenuArchiveSelected": "Archiv ausgewählt",
"commandMenuContent": "Inhalt",
"commandMenuCreateNew": "Neuen {{ type }} erstellenCreate new {{ type }}",
@@ -114,6 +114,7 @@
"commandMenuWidgetDuplicate": "Duplizieren Widget",
"commandMenuWidgetPaste": "Einfügen Widget",
"commandMenuWidgetRemove": "Entfernen Widget",
+ "confirm": "Bestätigen",
"confirmArchive": "{{ type }} {{ title }} archivieren?",
"confirmSettings": "Einstellungen bestätigen",
"contentArchived": "Inhalt archiviert",
@@ -354,8 +355,8 @@
"mergeCells": "Zellen zusammenführen",
"minLabel": "Min:",
"minSize": "Minimale Grösse {{ width }}x{{ height }}",
- "minimumSize": "Mindestgröße von {{ width }} x {{ height }} px",
"minUi": "Min: {{ number }}",
+ "minimumSize": "Mindestgröße von {{ width }} x {{ height }} px",
"modalBreadcrumbsDefaultLabel": "Eine Bezeichnung festlegen",
"modalTabsError": "Fehler",
"modalTabsErrors": "Fehler",
@@ -375,6 +376,7 @@
"next": "Weiter",
"nextPage": "Nächste Seite",
"no": "Nein",
+ "noCreateBlankDoc": "Nein, leeres {{ docType }} erstellen",
"noDraftSubmissions": "Keine Entwürfe",
"noItemsAdded": "Keine Elemente hinzugefügt",
"noItemsSelected": "Keine Elemente ausgewählt",
@@ -390,6 +392,7 @@
"notFoundPageStatusCode": "404",
"notFoundPageTitle": "404 - Seite nicht gefunden",
"notInLocale": "Die Seite existiert nicht in {{ label }}. Aus {{ currentLocale }} übersetzen?",
+ "notInLocaleDoc": "Das aktuelle {{ docType }} existiert nicht in {{ label }}. Version aus {{ currentLocale }} lokalisieren?",
"notYetPublished": "Dieses Dokument wurde noch nicht veröffentlicht.",
"notificationClearEventError": "Fehler beim Löschen der Benachrichtigung",
"nudgeDown": "Nach unten verschieben",
@@ -399,6 +402,7 @@
"oembedTypeNotSupported": "Einbettungstyp nicht unterstützt",
"oembedVideoUrlInvalid": "Video-URL ungültig",
"office": "Büro",
+ "ok": "OK",
"openGlobal": "Globale Einstellungen öffnen",
"openLinkInNewTab": "Link in neuem Tab öffnen",
"page": "Seite",
@@ -572,6 +576,7 @@
"subscript": "Tiefgestellt",
"suggestionsHeader": "Probiere einen der folgenden Vorschläge:",
"superscript": "Hochgestellt",
+ "switchLocalesAndLocalizeDoc": "Sprache wechseln und {{ docType }} für {{ label }} lokalisieren?",
"switchLocalesAndLocalizePage": "Sprache ändern zu {{ label }}?",
"table": "Tabelle",
"tableDescription": "Fügen Sie tabellarische Inhalte zu Ihrer Seite hinzu",
@@ -651,6 +656,7 @@
"willMoveImageToArchive": "Bild ins Archiv verschieben.",
"yes": "Ja",
"yesLocalizeAndSwitchLocales": "Ja, diese Seite übersetzen und zu der Sprache wechseln.",
+ "yesLocalizeAndSwitchLocalesDoc": "Ja, dieses {{ docType }} lokalisieren und Sprache wechseln",
"youTookControl": "Du hast die Kontrolle über dieses Dokument in einer anderen Registerkarte oder einem anderen Fenster übernommen. Ein Dokument kann immer nur an einer Stelle bearbeitet werden.",
"yourDevice": "Ihr Gerät"
}
diff --git a/modules/@apostrophecms/i18n/i18n/en.json b/modules/@apostrophecms/i18n/i18n/en.json
index 5a09e4e285..0d237cad71 100644
--- a/modules/@apostrophecms/i18n/i18n/en.json
+++ b/modules/@apostrophecms/i18n/i18n/en.json
@@ -87,9 +87,9 @@
"clearSelection": "Clear Selection",
"close": "Close",
"closeGlobal": "Close Global Site Settings",
+ "collapseAll": "Collapse all",
"colorFieldClickToSelect": "Click to select a color",
"colorFieldColorValue": "Color {{ color }}.",
- "collapseAll": "Collapse all",
"commandMenuArchiveSelected": "Archive selected",
"commandMenuContent": "Content",
"commandMenuCreateNew": "Create new {{ type }}",
@@ -116,6 +116,7 @@
"commandMenuWidgetDuplicate": "Duplicate Widget",
"commandMenuWidgetPaste": "Paste Widget",
"commandMenuWidgetRemove": "Remove Widget",
+ "confirm": "Confirm",
"confirmArchive": "You are going to archive the {{ type }} {{ title }}.",
"confirmSettings": "Confirm Settings",
"contentArchived": "Content Archived",
@@ -380,6 +381,7 @@
"next": "Next",
"nextPage": "Next Page",
"no": "No",
+ "noCreateBlankDoc": "No, create a blank {{ docType }}",
"noDraftSubmissions": "No Draft Submissions to Manage",
"noItemsAdded": "No Items Added",
"noItemsSelected": "No Items Selected",
@@ -395,6 +397,7 @@
"notFoundPageStatusCode": "404",
"notFoundPageTitle": "404 - Page not found",
"notInLocale": "The current page doesn’t exist in {{ label }}. Localize the version from {{ currentLocale }}?",
+ "notInLocaleDoc": "The current {{ docType }} doesn’t exist in {{ label }}. Localize the version from {{ currentLocale }}?",
"notYetPublished": "This document hasn't been published yet.",
"notificationClearEventError": "There was an error clearing a registered notification event.",
"nudgeDown": "Nudge Down",
@@ -404,6 +407,7 @@
"oembedTypeNotSupported": "Embed type not supported",
"oembedVideoUrlInvalid": "Video URL invalid",
"office": "Office",
+ "ok": "OK",
"openGlobal": "Open Global Site Settings",
"openLinkInNewTab": "Open link in new tab",
"page": "Page",
@@ -578,6 +582,7 @@
"suggestionsHeader": "Try one of these suggestions:",
"superscript": "Superscript",
"switchLocalesAndLocalizePage": "Switch locales and localize page to {{ label }}?",
+ "switchLocalesAndLocalizeDoc": "Switch locales and localize {{ docType }} to {{ label }}?",
"table": "Table",
"tableDescription": "Add tabular content to your page",
"tableImport": "Import Table",
@@ -658,6 +663,7 @@
"willMoveImageToArchive": "This will move the image to the archive.",
"yes": "Yes",
"yesLocalizeAndSwitchLocales": "Yes, localize this page and switch locales",
+ "yesLocalizeAndSwitchLocalesDoc": "Yes, localize this {{ docType }} and switch locales",
"youTookControl": "You took control of this document in another tab or window. A document can only be edited in one place at a time.",
"yourDevice": "your device"
}
diff --git a/modules/@apostrophecms/i18n/i18n/es.json b/modules/@apostrophecms/i18n/i18n/es.json
index 52a07d79fb..f3019f89db 100644
--- a/modules/@apostrophecms/i18n/i18n/es.json
+++ b/modules/@apostrophecms/i18n/i18n/es.json
@@ -85,9 +85,9 @@
"clearSelection": "Borrar Selección",
"close": "Cerrar",
"closeGlobal": "Cerrar Configuración Global del Sitio",
+ "collapseAll": "Colapsar todo",
"colorFieldClickToSelect": "Haz clic para seleccionar un color",
"colorFieldColorValue": "Color {{ color }}.",
- "collapseAll": "Colapsar todo",
"commandMenuArchiveSelected": "Archivo seleccionado",
"commandMenuContent": "Contenido",
"commandMenuCreateNew": "Nuevo {{ type }}",
@@ -114,6 +114,7 @@
"commandMenuWidgetDuplicate": "Duplicar Componente",
"commandMenuWidgetPaste": "Pegar Componente",
"commandMenuWidgetRemove": "Eliminar Componente",
+ "confirm": "Confirmar",
"confirmArchive": "Va a archivar el {{ type }} {{ title }}.",
"confirmSettings": "Confirmar Configuración",
"contentArchived": "Contenido Archivado",
@@ -354,8 +355,8 @@
"mergeCells": "Combinar celdas",
"minLabel": "Mín:",
"minSize": "Tamaño mínimo de {{ width }}x{{ height }}",
- "minimumSize": "Tamaño mínimo de {{ ancho }} x {{ alto }} px",
"minUi": "Mín: {{ number }}",
+ "minimumSize": "Tamaño mínimo de {{ ancho }} x {{ alto }} px",
"modalBreadcrumbsDefaultLabel": "Establecer una etiqueta",
"modalTabsError": "Error",
"modalTabsErrors": "Errores",
@@ -375,6 +376,7 @@
"next": "Siguiente",
"nextPage": "Siguiente Página",
"no": "No",
+ "noCreateBlankDoc": "No, crear un {{ docType }} en blanco",
"noDraftSubmissions": "Ninguna Propuesta de Borrador a Administrar",
"noItemsAdded": "No se añadieron elementos",
"noItemsSelected": "Ningún Elemento Seleccionado",
@@ -390,6 +392,7 @@
"notFoundPageStatusCode": "404",
"notFoundPageTitle": "404 - Página no encontrada",
"notInLocale": "La página actual no existe en {{ label }}. ¿Traducir la versión desde la configuración regional {{ currentLocale }}?",
+ "notInLocaleDoc": "El {{ docType }} actual no existe en {{ label }}. ¿Localizar la versión desde {{ currentLocale }}?",
"notYetPublished": "Este documento aún no ha sido publicado.",
"notificationClearEventError": "Hubo un error al limpiar un evento de notificación registrado.",
"nudgeDown": "Mover Hacia Arriba",
@@ -399,6 +402,7 @@
"oembedTypeNotSupported": "Tipo de inserción no soportado",
"oembedVideoUrlInvalid": "URL de video inválido",
"office": "Oficina",
+ "ok": "OK",
"openGlobal": "Abrir Configuración Global del Sitio",
"openLinkInNewTab": "Abrir enlace en una nueva pestaña",
"page": "Página",
@@ -572,6 +576,7 @@
"subscript": "Subíndice",
"suggestionsHeader": "Intente una de estas sugerencias:",
"superscript": "Superíndice",
+ "switchLocalesAndLocalizeDoc": "¿Cambiar idiomas y localizar {{ docType }} a {{ label }}?",
"switchLocalesAndLocalizePage": "¿Cambiar de configuracion regional y traducir la página a la configuracion regional {{ label }}?",
"table": "Tabla",
"tableDescription": "Agregar contenido tabular a tu página",
@@ -651,6 +656,7 @@
"willMoveImageToArchive": "Esto moverá la imagen al archivo de documentos.",
"yes": "Sí",
"yesLocalizeAndSwitchLocales": "Sí, traducir esta página y cambiar de configuración regional",
+ "yesLocalizeAndSwitchLocalesDoc": "Sí, localizar este {{ docType }} y cambiar idiomas",
"youTookControl": "Tomó el control de este documento en otra pestaña o ventana. Un documento sólo puede ser editado en un lugar a la vez.",
"yourDevice": "su dispositivo"
}
diff --git a/modules/@apostrophecms/i18n/i18n/fr.json b/modules/@apostrophecms/i18n/i18n/fr.json
index d218d2741a..1f4a27fe84 100644
--- a/modules/@apostrophecms/i18n/i18n/fr.json
+++ b/modules/@apostrophecms/i18n/i18n/fr.json
@@ -85,9 +85,9 @@
"clearSelection": "Effacer la sélection",
"close": "Fermer",
"closeGlobal": "Fermer les paramètres globaux du site",
+ "collapseAll": "Tout réduire",
"colorFieldClickToSelect": "Cliquez pour sélectionner une couleur",
"colorFieldColorValue": "Couleur {{ color }}.",
- "collapseAll": "Tout réduire",
"commandMenuArchiveSelected": "Archiver la sélection.",
"commandMenuContent": "Contenu",
"commandMenuCreateNew": "Nouveau: {{ type }}",
@@ -114,6 +114,7 @@
"commandMenuWidgetDuplicate": "Dupliquer Widget",
"commandMenuWidgetPaste": "Coller Widget",
"commandMenuWidgetRemove": "Supprimer Widget",
+ "confirm": "Confirmer",
"confirmArchive": "Vous vous apprêtez à archiver {{ type }} {{ title }}.",
"confirmSettings": "Confirmer les paramètres",
"contentArchived": "Contenu archivé",
@@ -354,8 +355,8 @@
"mergeCells": "Fusionner les cellules",
"minLabel": "Min :",
"minSize": "Taille minimale de {{ width }}x{{ height }}",
- "minimumSize": "Taille minimale de {{ width }} x {{ height }} px",
"minUi": "Min : {{ number }}",
+ "minimumSize": "Taille minimale de {{ width }} x {{ height }} px",
"modalBreadcrumbsDefaultLabel": "Définir une étiquette",
"modalTabsError": "Erreur",
"modalTabsErrors": "Erreurs",
@@ -375,6 +376,7 @@
"next": "Suivant",
"nextPage": "Page suivante",
"no": "Non",
+ "noCreateBlankDoc": "Non, créer un {{ docType }} vierge",
"noDraftSubmissions": "Pas de soumission de brouillon à gérer",
"noItemsAdded": "Aucun élément ajouté",
"noItemsSelected": "Pas d'élément sélectionné",
@@ -390,6 +392,7 @@
"notFoundPageStatusCode": "404",
"notFoundPageTitle": "404 - Page non trouvée",
"notInLocale": "La page courante n'existe pas en {{ label }}. Changez la langue en {{ currentLocale }} ?",
+ "notInLocaleDoc": "Le {{ docType }} actuel n'existe pas en {{ label }}. Localiser la version depuis {{ currentLocale }} ?",
"notYetPublished": "Ce document n'a pas encore été publié.",
"notificationClearEventError": "Une erreur s'est produite lors de la suppression d'un événement de notification enregistré.",
"nudgeDown": "Déplacer vers le bas",
@@ -399,6 +402,7 @@
"oembedTypeNotSupported": "Type d'intégration non pris en charge",
"oembedVideoUrlInvalid": "URL de la vidéo invalide",
"office": "Bureau",
+ "ok": "OK",
"openGlobal": "Ouvrir les paramètres globaux du site",
"openLinkInNewTab": "Ouvrir le lien dans un nouvel onglet",
"page": "Page",
@@ -572,6 +576,7 @@
"subscript": "Indice",
"suggestionsHeader": "Essayez l'une de ces suggestions :",
"superscript": "Exposant",
+ "switchLocalesAndLocalizeDoc": "Changer de langue et localiser {{ docType }} en {{ label }} ?",
"switchLocalesAndLocalizePage": "Changer la langue et basculer la page vers {{ label }} ?",
"table": "Tableau",
"tableDescription": "Ajouter du contenu tabulaire à votre page",
@@ -651,6 +656,7 @@
"willMoveImageToArchive": "Cela déplacera l'image vers l'archive.",
"yes": "Oui",
"yesLocalizeAndSwitchLocales": "Oui, changer la langue de cette page et basculer de langue",
+ "yesLocalizeAndSwitchLocalesDoc": "Oui, localiser ce {{ docType }} et changer de langue",
"youTookControl": "Vous avez pris le contrôle de ce document dans un autre onglet ou une autre fenêtre. Un document ne peut être modifié qu'à un seul endroit à la fois.",
"yourDevice": "votre appareil"
}
diff --git a/modules/@apostrophecms/i18n/i18n/it.json b/modules/@apostrophecms/i18n/i18n/it.json
index 1fd9cc71fc..fdaf5c091b 100644
--- a/modules/@apostrophecms/i18n/i18n/it.json
+++ b/modules/@apostrophecms/i18n/i18n/it.json
@@ -85,9 +85,9 @@
"clearSelection": "Cancella selezione",
"close": "Chiudi",
"closeGlobal": "Chiudi impostazioni globali del sito",
+ "collapseAll": "Collassa tutto",
"colorFieldClickToSelect": "Fai clic per selezionare un colore",
"colorFieldColorValue": "Colore {{ color }}.",
- "collapseAll": "Collassa tutto",
"commandMenuArchiveSelected": "Archivia selezionato",
"commandMenuContent": "Contenuto",
"commandMenuCreateNew": "Crea nuovo/a {{ type }}",
@@ -114,6 +114,7 @@
"commandMenuWidgetDuplicate": "Duplica Widget",
"commandMenuWidgetPaste": "Incolla Widget",
"commandMenuWidgetRemove": "Rimuovi Widget",
+ "confirm": "Conferma",
"confirmArchive": "Stai per archiviare {{ type }} {{ title }}.",
"confirmSettings": "Conferma le impostazioni",
"contentArchived": "Contenuto archiviato",
@@ -354,8 +355,8 @@
"mergeCells": "Unisci celle",
"minLabel": "Minimo:",
"minSize": "Dimensione minima di {{ width }}x{{ height }}",
- "minimumSize": "Dimensione minima di {{ width }} x {{ height }} px",
"minUi": "Minimo: {{ number }}",
+ "minimumSize": "Dimensione minima di {{ width }} x {{ height }} px",
"modalBreadcrumbsDefaultLabel": "Imposta un'etichetta",
"modalTabsError": "Errore",
"modalTabsErrors": "Errori",
@@ -375,6 +376,7 @@
"next": "Successivo",
"nextPage": "Pagina successiva",
"no": "No",
+ "noCreateBlankDoc": "No, crea un {{ docType }} vuoto",
"noDraftSubmissions": "Nessuna proposta in bozza da gestire",
"noItemsAdded": "Nessun elemento aggiunto",
"noItemsSelected": "Nessun elemento selezionato",
@@ -390,6 +392,7 @@
"notFoundPageStatusCode": "404",
"notFoundPageTitle": "404 - Pagina non trovata",
"notInLocale": "La pagina attuale non esiste in {{ label }}. Localizza la versione da {{ currentLocale }}?",
+ "notInLocaleDoc": "Il {{ docType }} corrente non esiste in {{ label }}. Localizzare la versione da {{ currentLocale }}?",
"notYetPublished": "Questo documento non è ancora stato pubblicato.",
"notificationClearEventError": "Si è verificato un errore durante la cancellazione di un evento di notifica registrato.",
"nudgeDown": "Spostamento in giù",
@@ -399,6 +402,7 @@
"oembedTypeNotSupported": "Tipo di incorporamento non supportato",
"oembedVideoUrlInvalid": "URL video non valido",
"office": "Ufficio",
+ "ok": "OK",
"openGlobal": "Apri le impostazioni globali del sito",
"openLinkInNewTab": "Apri il link in una nuova scheda",
"page": "Pagina",
@@ -572,6 +576,7 @@
"subscript": "Pedice",
"suggestionsHeader": "Prova uno di questi suggerimenti:",
"superscript": "Apice",
+ "switchLocalesAndLocalizeDoc": "Cambiare lingua e localizzare {{ docType }} in {{ label }}?",
"switchLocalesAndLocalizePage": "Passare alle località e localizzare la pagina su {{ label }}?",
"table": "Tabella",
"tableDescription": "Aggiungi una tabella alla tua pagina",
@@ -651,6 +656,7 @@
"willMoveImageToArchive": "Ciò sposterà l'immagine nell'archivio.",
"yes": "Sì",
"yesLocalizeAndSwitchLocales": "Sì, localizza questa pagina e passa alle località",
+ "yesLocalizeAndSwitchLocalesDoc": "Sì, localizza questo {{ docType }} e cambia lingua",
"youTookControl": "Hai preso il controllo di questo documento in un'altra scheda o finestra. Un documento può essere modificato in un solo luogo alla volta.",
"yourDevice": "il tuo dispositivo"
}
diff --git a/modules/@apostrophecms/i18n/i18n/pt-BR.json b/modules/@apostrophecms/i18n/i18n/pt-BR.json
index 894ad8c2a6..4682293e70 100644
--- a/modules/@apostrophecms/i18n/i18n/pt-BR.json
+++ b/modules/@apostrophecms/i18n/i18n/pt-BR.json
@@ -85,9 +85,9 @@
"clearSelection": "Limpar Seleção",
"close": "Fechar",
"closeGlobal": "Fechar Configurações Globais do Site",
+ "collapseAll": "Colapsar todos",
"colorFieldClickToSelect": "Clique para selecionar uma cor",
"colorFieldColorValue": "Cor {{ color }}.",
- "collapseAll": "Colapsar todos",
"commandMenuArchiveSelected": "Arquivo selecionado",
"commandMenuContent": "Conteúdo",
"commandMenuCreateNew": "Novo(a) {{ type }}",
@@ -114,6 +114,7 @@
"commandMenuWidgetDuplicate": "Duplicar Widget",
"commandMenuWidgetPaste": "Colar Widget",
"commandMenuWidgetRemove": "Remover Widget",
+ "confirm": "Confirmar",
"confirmArchive": "Você vai arquivar o(a) {{ type }} {{ title }}.",
"confirmSettings": "Confirmar Configurações",
"contentArchived": "Conteúdo Arquivado",
@@ -354,8 +355,8 @@
"mergeCells": "Mesclar Células",
"minLabel": "Mín:",
"minSize": "Tamanho mínimo de {{ width }}x{{ height }}",
- "minimumSize": "Tamanho mínimo de {{ width }} x {{ height }} px",
"minUi": "Mín: {{ number }}",
+ "minimumSize": "Tamanho mínimo de {{ width }} x {{ height }} px",
"modalBreadcrumbsDefaultLabel": "Defina uma etiqueta",
"modalTabsError": "Erro",
"modalTabsErrors": "Erros",
@@ -375,6 +376,7 @@
"next": "Próximo(a)",
"nextPage": "Próxima Página",
"no": "Não",
+ "noCreateBlankDoc": "Não, criar um {{ docType }} em branco",
"noDraftSubmissions": "Nenhum envio de rascunho para gerenciar",
"noItemsAdded": "Nenhum Item Adicionado",
"noItemsSelected": "Nenhum item selecionado",
@@ -390,6 +392,7 @@
"notFoundPageStatusCode": "404",
"notFoundPageTitle": "404 - Página não encontrada",
"notInLocale": "A página atual não existe em {{ label }}. Fazer a localização de {{ currentLocale }}?",
+ "notInLocaleDoc": "O {{ docType }} atual não existe em {{ label }}. Localizar a versão de {{ currentLocale }}?",
"notYetPublished": "Este documento ainda não foi publicado.",
"notificationClearEventError": "Ocorreu um erro ao limpar um evento de notificação registrado.",
"nudgeDown": "Arrastar para baixo",
@@ -399,6 +402,7 @@
"oembedTypeNotSupported": "Tipo de incorporação não suportado",
"oembedVideoUrlInvalid": "URL do vídeo inválido",
"office": "Office",
+ "ok": "OK",
"openGlobal": "Abrir Configurações Globais do Site",
"openLinkInNewTab": "Abrir link em nova aba",
"page": "Página",
@@ -572,6 +576,7 @@
"subscript": "Subscrito",
"suggestionsHeader": "Tente uma dessas sugestões:",
"superscript": "Sobrescrito",
+ "switchLocalesAndLocalizeDoc": "Trocar idiomas e localizar {{ docType }} para {{ label }}?",
"switchLocalesAndLocalizePage": "Mudar de localidade e localizar página para {{ label }}?",
"table": "Tabela",
"tableDescription": "Adicionar conteúdo tabular à sua página",
@@ -651,6 +656,7 @@
"willMoveImageToArchive": "Isso moverá a imagem para o arquivo.",
"yes": "Sim",
"yesLocalizeAndSwitchLocales": "Sim, localize esta página e mude de local",
+ "yesLocalizeAndSwitchLocalesDoc": "Sim, localizar este {{ docType }} e trocar idiomas",
"youTookControl": "Você assumiu o controle deste documento em outra guia ou janela. Um documento só pode ser editado em um lugar de cada vez.",
"yourDevice": "seu dispositivo"
}
diff --git a/modules/@apostrophecms/i18n/i18n/sk.json b/modules/@apostrophecms/i18n/i18n/sk.json
index e0ca8919a0..bb7839abf5 100644
--- a/modules/@apostrophecms/i18n/i18n/sk.json
+++ b/modules/@apostrophecms/i18n/i18n/sk.json
@@ -85,9 +85,9 @@
"clearSelection": "Vymazať Výber",
"close": "Zavrieť",
"closeGlobal": " Zatvorte globálne nastavenia webu",
+ "collapseAll": "Zbaliť všetko",
"colorFieldClickToSelect": "Kliknite pre výber farby",
"colorFieldColorValue": "Farba {{ color }}.",
- "collapseAll": "Zbaliť všetko",
"commandMenuArchiveSelected": "Vybratý archív",
"commandMenuContent": "Obsah",
"commandMenuCreateNew": "Vytvoriť {{ type }}",
@@ -114,6 +114,7 @@
"commandMenuWidgetDuplicate": "Duplikovať Prvok Stránky",
"commandMenuWidgetPaste": "Prilepiť Prvok Stránky",
"commandMenuWidgetRemove": "Odstrániť Prvok Stránky",
+ "confirm": "Potvrdiť",
"confirmArchive": " Budete archivovať súbor {{ type }} {{ title }}.",
"confirmSettings": "Potvrďiť nastavenia",
"contentArchived": "Obsah archivovaný",
@@ -354,8 +355,8 @@
"mergeCells": "Zlúčiť bunky",
"minLabel": "Min:",
"minSize": "Minimálna veľkosť {{ width }}x{{ height }}",
- "minimumSize": "Minimálna veľkosť {{ šírka }} x {{ výška }} px",
"minUi": "Min: {{ number }}",
+ "minimumSize": "Minimálna veľkosť {{ šírka }} x {{ výška }} px",
"modalBreadcrumbsDefaultLabel": "Nastaviť názov",
"modalTabsError": "Chyba",
"modalTabsErrors": "Chyby",
@@ -375,6 +376,7 @@
"next": "Ďalej",
"nextPage": "Ďalšia strana",
"no": "Nie",
+ "noCreateBlankDoc": "Nie, vytvoriť prázdny {{ docType }}",
"noDraftSubmissions": "Žiadne návrhy, ktoré by bolo možné spravovať",
"noItemsAdded": "Nebol pridaný žiadny prvok",
"noItemsSelected": "Nie sú vybraté žiadne položky",
@@ -390,6 +392,7 @@
"notFoundPageStatusCode": "404",
"notFoundPageTitle": "404 - Stránka nenájdená",
"notInLocale": "Aktuálna stránka v {{ label }} neexistuje. Preložte verziu z {{ currentLocale }}?",
+ "notInLocaleDoc": "Aktuálny {{ docType }} neexistuje v {{ label }}. Lokalizovať verziu z {{ currentLocale }}?",
"notYetPublished": "Tento dokument ešte nebol zverejnený.",
"notificationClearEventError": "Pri vymazávaní zaregistrovanej notifikačnej udalosti sa vyskytla chyba.",
"nudgeDown": "Posunúť nadol",
@@ -399,6 +402,7 @@
"oembedTypeNotSupported": "Typ vloženia nie je podporovaný",
"oembedVideoUrlInvalid": "Neplatná URL videa",
"office": "Kancelária",
+ "ok": "OK",
"openGlobal": "Otvorte globálne nastavenia webu",
"openLinkInNewTab": "Otvoriť odkaz v novej karte",
"page": "Stránka",
@@ -572,6 +576,7 @@
"subscript": "Dolný index",
"suggestionsHeader": "Skúste jednu z týchto možností:",
"superscript": "Horný index",
+ "switchLocalesAndLocalizeDoc": "Prepnúť jazyk a lokalizovať {{ docType }} do {{ label }}?",
"switchLocalesAndLocalizePage": "Prepnúť jazyk a preložiť stránku na {{ label }}?",
"table": "Tabuľka",
"tableDescription": "Pridať tabuľkový obsah na vašu stránku",
@@ -651,6 +656,7 @@
"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": "Áno, lokalizovať tento {{ docType }} a prepnúť jazyk",
"youTookControl": "Nad týmto dokumentom ste prevzali kontrolu na inej karte alebo v inom okne. Dokument je možné naraz upravovať iba na jednom mieste.",
"yourDevice": "vaše zariadenie"
}
diff --git a/modules/@apostrophecms/i18n/ui/apos/components/AposI18nLocalize.vue b/modules/@apostrophecms/i18n/ui/apos/components/AposI18nLocalize.vue
index 96a4cd6ddd..538f26424e 100644
--- a/modules/@apostrophecms/i18n/ui/apos/components/AposI18nLocalize.vue
+++ b/modules/@apostrophecms/i18n/ui/apos/components/AposI18nLocalize.vue
@@ -27,7 +27,7 @@
type="default"
label="apostrophe:cancel"
:modifiers="[ 'block' ]"
- @click="close"
+ @click="cancel"
/>
@@ -324,6 +324,10 @@ export default {
moduleName: {
required: true,
type: String
+ },
+ shouldRedirect: {
+ type: Boolean,
+ default: true
}
},
emits: [ 'modal-result' ],
@@ -662,9 +666,22 @@ export default {
this.toLocalizeChoices = this.toLocalizeChoicesStandalone;
}
},
+ confirm() {
+ if (!this.modal.busy) {
+ this.modal.showModal = false;
+ this.$emit('modal-result', true);
+ }
+ },
+ cancel() {
+ if (!this.modal.busy) {
+ this.modal.showModal = false;
+ this.$emit('modal-result', false);
+ }
+ },
close() {
if (!this.modal.busy) {
this.modal.showModal = false;
+ this.$emit('modal-result', null);
}
},
goTo(name) {
@@ -842,7 +859,7 @@ export default {
relationship: doc._id === this.fullDoc._id
});
- if (this.locale) {
+ if (this.locale && this.shouldRedirect) {
// Ask for the redirect URL, this way it still works if we
// need to carry a session across hostnames
const result = await apos.http.post(`${this.moduleOptions.action}/locale`, {
@@ -940,7 +957,7 @@ export default {
// Prevent flashing of the UI if the request returns quickly
setTimeout(() => {
this.modal.busy = false;
- this.close();
+ this.confirm();
}, 250);
},
async submitBatch() {
@@ -972,7 +989,7 @@ export default {
});
} finally {
this.modal.busy = false;
- this.close();
+ this.confirm();
}
},
getRelatedSchemaTypes(types) {
diff --git a/modules/@apostrophecms/modal/ui/apos/components/AposModalConfirm.vue b/modules/@apostrophecms/modal/ui/apos/components/AposModalConfirm.vue
index 1ac5b3fc72..a43222894f 100644
--- a/modules/@apostrophecms/modal/ui/apos/components/AposModalConfirm.vue
+++ b/modules/@apostrophecms/modal/ui/apos/components/AposModalConfirm.vue
@@ -61,7 +61,7 @@
v-if="mode !== 'alert'"
:attrs="{'data-apos-focus-priority': mode !== 'alert' ? true : null}"
class="apos-confirm__btn"
- :label="content.negativeLabel || 'apostrophe:cancel'"
+ :label="negativeLabel"
@click="cancel"
/>
diff --git a/modules/@apostrophecms/page/ui/apos/logic/AposPagesManager.js b/modules/@apostrophecms/page/ui/apos/logic/AposPagesManager.js
index 3592b0a9a2..eee25a3042 100644
--- a/modules/@apostrophecms/page/ui/apos/logic/AposPagesManager.js
+++ b/modules/@apostrophecms/page/ui/apos/logic/AposPagesManager.js
@@ -587,9 +587,9 @@ export default {
}
}
},
- async switchLocale({ locale, localized }) {
- this.updateModalData(this.modalData.id, { locale });
- this.localeSwitched = locale !== apos.i18n.locale;
+ async switchLocale({ locale }) {
+ this.updateModalData(this.modalData.id, { locale: locale.name });
+ this.localeSwitched = locale.name !== apos.i18n.locale;
this.currentPage = 1;
diff --git a/modules/@apostrophecms/piece-type/ui/apos/components/AposDocsManager.vue b/modules/@apostrophecms/piece-type/ui/apos/components/AposDocsManager.vue
index 2607ef7cde..acc049e9c4 100644
--- a/modules/@apostrophecms/piece-type/ui/apos/components/AposDocsManager.vue
+++ b/modules/@apostrophecms/piece-type/ui/apos/components/AposDocsManager.vue
@@ -30,7 +30,7 @@
:locale="modalData.locale"
:module-options="moduleOptions"
:is-modified="false"
- :show-localized="false"
+ :is-manager="true"
@switch-locale="switchLocale"
/>
@@ -194,7 +194,7 @@ export default {
};
},
computed: {
- ...mapState(useModalStore, [ 'activeModal', 'updateModalData' ]),
+ ...mapState(useModalStore, [ 'activeModal' ]),
moduleOptions() {
return window.apos.modules[this.moduleName];
},
@@ -585,9 +585,9 @@ export default {
}
}
},
- async switchLocale({ locale, localized }) {
- this.updateModalData(this.modalData.id, { locale });
- this.localeSwitched = locale !== apos.i18n.locale;
+ async switchLocale({ locale }) {
+ this.updateModalData(this.modalData.id, { locale: locale.name });
+ this.localeSwitched = locale.name !== apos.i18n.locale;
this.currentPage = 1;