From d1ae884ab5521fee5e414ca8bd9a8bcbab9cb3d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrey=20Ca=C3=B1on?= <36200299+andrey-canon@users.noreply.github.com> Date: Mon, 9 Dec 2024 16:15:48 -0500 Subject: [PATCH] feat: allow to include translations for extended profile fields (#49) (cherry picked from 5ad0e35547ce263c879882a726365b3243b9c272 and 4d24257f741672b6936d6774061ea7aa4ffa0071 ) --- .../djangoapps/user_api/accounts/settings_views.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/openedx/core/djangoapps/user_api/accounts/settings_views.py b/openedx/core/djangoapps/user_api/accounts/settings_views.py index 05b9f84f0593..5945c0736a66 100644 --- a/openedx/core/djangoapps/user_api/accounts/settings_views.py +++ b/openedx/core/djangoapps/user_api/accounts/settings_views.py @@ -28,6 +28,7 @@ from openedx.core.djangoapps.lang_pref.api import all_languages, released_languages from openedx.core.djangoapps.programs.models import ProgramsApiConfig from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers +from openedx.core.djangoapps.theming import helpers as theming_helpers from openedx.core.djangoapps.user_api.accounts.toggles import ( should_redirect_to_account_microfrontend, should_redirect_to_order_history_microfrontend, @@ -276,6 +277,15 @@ def _get_extended_profile_fields(): "specialty": _("Specialty"), "work_experience": _("Work experience") } + request = theming_helpers.get_current_request() + + if request: + extended_profile_fields_translations = configuration_helpers.get_value( + 'extended_profile_fields_translations', + {}, + ) + translations = extended_profile_fields_translations.get(request.LANGUAGE_CODE, {}) + field_labels_map.update(translations) extended_profile_field_names = configuration_helpers.get_value('extended_profile_fields', []) for field_to_exclude in fields_already_showing: