From 00af45f2441fbd9986b8894a70c8b5d936e963db Mon Sep 17 00:00:00 2001
From: "Kyle D. McCormick" <kyle@axim.org>
Date: Tue, 18 Feb 2025 15:50:44 -0500
Subject: [PATCH] feat: Only display Preview Language Setting (dark_lang) in
 LMS

Previously, there were two (identical) ways to preview dark language:

1. <CMS_ROOT_URL>/update_lang
2. <LMS_ROOT_URL>/update_lang

Now, (1) will simply redirect to (2). So, the Preview Language Setting
page will only render in an LMS context. This has no impact on end-user
functionality. It has only a very minor UX end-user impact.

The purpose of this is to allow us to completely retire the legacy
Studio frontend without losing any end-user functionality. This page is
not yet available in an MFE, which will need to be the eventual
solution.
---
 cms/urls.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/cms/urls.py b/cms/urls.py
index 58503f9ed92f..bd103c460321 100644
--- a/cms/urls.py
+++ b/cms/urls.py
@@ -9,6 +9,7 @@
 from django.urls import path, re_path
 from django.utils.translation import gettext_lazy as _
 from django.contrib import admin
+from django.shortcuts import redirect
 from drf_spectacular.views import SpectacularAPIView, SpectacularSwaggerView
 from auth_backends.urls import oauth2_urlpatterns
 from edx_api_doc_tools import make_docs_urls
@@ -86,7 +87,7 @@
          ),
 
     # Darklang View to change the preview language (or dark language)
-    path('update_lang/', include('openedx.core.djangoapps.dark_lang.urls', namespace='dark_lang')),
+    path('update_lang/', lambda request: redirect(f'{settings.LMS_ROOT_URL}/update_lang/')),
 
     # For redirecting to help pages.
     path('help_token/', include('help_tokens.urls')),