diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index fe408683cf..bb5fe97661 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -8,6 +8,7 @@ Changelog
* Added `ancestor_of` API filter (Jaap Roes)
* Added support for customising group management views (Jan Seifert)
* Added `full_url` property to image renditions (Shreyash Srivastava)
+ * Added locale selector when choosing translatable snippets (Karl Hobley)
* Fix: Invalid filter values for foreign key fields in the API now give an error instead of crashing (Tidjani Dia)
* Fix: Ordering specified in `construct_explorer_page_queryset` hook is now taken into account again by the page explorer API (Andre Fonseca)
* Fix: Deleting a page from its listing view no longer results in a 404 error (Tidjani Dia)
diff --git a/client/src/entrypoints/snippets/snippet-chooser.js b/client/src/entrypoints/snippets/snippet-chooser.js
index f3923ce32e..6a8ed5f50b 100644
--- a/client/src/entrypoints/snippets/snippet-chooser.js
+++ b/client/src/entrypoints/snippets/snippet-chooser.js
@@ -1,5 +1,7 @@
import $ from 'jquery';
+/* global wagtailConfig */
+
function createSnippetChooser(id, modelString) {
const chooserElement = $('#' + id + '-chooser');
const docTitle = chooserElement.find('.title');
@@ -53,9 +55,18 @@ function createSnippetChooser(id, modelString) {
$('.action-choose', chooserElement).focus();
},
openChooserModal: () => {
+ let urlQuery = '';
+ if (wagtailConfig.ACTIVE_CONTENT_LOCALE) {
+ // The user is editing a piece of translated content.
+ // Pass the locale along as a request parameter. If this
+ // snippet is also translatable, the results will be
+ // pre-filtered by this locale.
+ urlQuery = '?locale=' + wagtailConfig.ACTIVE_CONTENT_LOCALE;
+ }
+
// eslint-disable-next-line no-undef, new-cap
ModalWorkflow({
- url: chooserBaseUrl,
+ url: chooserBaseUrl + urlQuery,
// eslint-disable-next-line no-undef
onload: SNIPPET_CHOOSER_MODAL_ONLOAD_HANDLERS,
responses: {
diff --git a/docs/releases/2.14.rst b/docs/releases/2.14.rst
index baf168f354..53973de91d 100644
--- a/docs/releases/2.14.rst
+++ b/docs/releases/2.14.rst
@@ -16,6 +16,7 @@ Other features
* Added ``ancestor_of`` API filter. See :ref:`apiv2_filter_by_tree_position`. (Jaap Roes)
* Added support for customising group management views. See :ref:`customising_group_views`. (Jan Seifert)
* Added ``full_url`` property to image renditions (Shreyash Srivastava)
+ * Added locale selector when choosing translatable snippets (Karl Hobley)
Bug fixes
~~~~~~~~~
diff --git a/wagtail/admin/templates/wagtailadmin/pages/create.html b/wagtail/admin/templates/wagtailadmin/pages/create.html
index 0790a5cc03..1b64a34bee 100644
--- a/wagtail/admin/templates/wagtailadmin/pages/create.html
+++ b/wagtail/admin/templates/wagtailadmin/pages/create.html
@@ -103,6 +103,13 @@
{{ edit_handler.html_declarations }}
+
+
+
+ {% endif %}