From d0c7a532ad2e43b4c70e4ce79448dc8ccec540e6 Mon Sep 17 00:00:00 2001 From: Omar Al-Ithawi Date: Wed, 21 Jun 2017 08:13:23 +0300 Subject: [PATCH] Make the platform name translatable --- cms/envs/aws.py | 6 +++--- cms/envs/common.py | 7 +++++-- common/djangoapps/third_party_auth/models.py | 20 +++++++++---------- .../tests/studio/test_studio_help.py | 12 +++++------ lms/envs/aws.py | 2 +- lms/envs/common.py | 4 ++-- lms/envs/devstack.py | 1 - 7 files changed, 27 insertions(+), 25 deletions(-) diff --git a/cms/envs/aws.py b/cms/envs/aws.py index 4484aca24d..6c9e2fd881 100644 --- a/cms/envs/aws.py +++ b/cms/envs/aws.py @@ -246,9 +246,9 @@ LOGGING = get_logger_config(LOG_DIR, service_variant=SERVICE_VARIANT) #theming start: -PLATFORM_NAME = ENV_TOKENS.get('PLATFORM_NAME', 'edX') -STUDIO_NAME = ENV_TOKENS.get('STUDIO_NAME', 'edX Studio') -STUDIO_SHORT_NAME = ENV_TOKENS.get('STUDIO_SHORT_NAME', 'Studio') +PLATFORM_NAME = ENV_TOKENS.get('PLATFORM_NAME', PLATFORM_NAME) +STUDIO_NAME = ENV_TOKENS.get('STUDIO_NAME', STUDIO_NAME) +STUDIO_SHORT_NAME = ENV_TOKENS.get('STUDIO_SHORT_NAME', STUDIO_SHORT_NAME) # Event Tracking if "TRACKING_IGNORE_URL_PATTERNS" in ENV_TOKENS: diff --git a/cms/envs/common.py b/cms/envs/common.py index 18f7068f1d..685184c283 100644 --- a/cms/envs/common.py +++ b/cms/envs/common.py @@ -65,6 +65,9 @@ from lms.envs.common import ( MEDIA_ROOT, MEDIA_URL, + # Lazy Gettext + _, + # Django REST framework configuration REST_FRAMEWORK, @@ -125,8 +128,8 @@ from openedx.core.lib.license import LicenseMixin # Dummy secret key for dev/test SECRET_KEY = 'dev key' -STUDIO_NAME = "Studio" -STUDIO_SHORT_NAME = "Studio" +STUDIO_NAME = _("Your Platform Studio") +STUDIO_SHORT_NAME = _("Studio") FEATURES = { 'GITHUB_PUSH': False, diff --git a/common/djangoapps/third_party_auth/models.py b/common/djangoapps/third_party_auth/models.py index a3778e9494..af3e18a551 100644 --- a/common/djangoapps/third_party_auth/models.py +++ b/common/djangoapps/third_party_auth/models.py @@ -51,14 +51,6 @@ _PSA_OAUTH2_BACKENDS = [backend_class.name for backend_class in _load_backend_cl _PSA_SAML_BACKENDS = [backend_class.name for backend_class in _load_backend_classes(SAMLAuth)] _LTI_BACKENDS = [backend_class.name for backend_class in _load_backend_classes(LTIAuthBackend)] -DEFAULT_SAML_CONTACT = { - # Default contact information to put into the SAML metadata that gets generated by python-saml. - "givenName": u"{} Support".format( - configuration_helpers.get_value('PLATFORM_NAME', settings.PLATFORM_NAME), - ), - "emailAddress": configuration_helpers.get_value('TECH_SUPPORT_EMAIL', settings.TECH_SUPPORT_EMAIL), -} - def clean_json(value, of_type): """ Simple helper method to parse and clean JSON """ @@ -576,6 +568,14 @@ class SAMLConfiguration(ConfigurationModel): def get_setting(self, name): """ Get the value of a setting, or raise KeyError """ + default_saml_contact = { + # Default contact information to put into the SAML metadata that gets generated by python-saml. + "givenName": _("{platform_name} Support").format( + platform_name=configuration_helpers.get_value('PLATFORM_NAME', settings.PLATFORM_NAME) + ), + "emailAddress": configuration_helpers.get_value('TECH_SUPPORT_EMAIL', settings.TECH_SUPPORT_EMAIL), + } + if name == "ORG_INFO": return json.loads(self.org_info_str) if name == "SP_ENTITY_ID": @@ -593,8 +593,8 @@ class SAMLConfiguration(ConfigurationModel): other_config = { # These defaults can be overriden by self.other_config_str "GET_ALL_EXTRA_DATA": True, # Save all attribute values the IdP sends into the UserSocialAuth table - "TECHNICAL_CONTACT": DEFAULT_SAML_CONTACT, - "SUPPORT_CONTACT": DEFAULT_SAML_CONTACT, + "TECHNICAL_CONTACT": default_saml_contact, + "SUPPORT_CONTACT": default_saml_contact, } other_config.update(json.loads(self.other_config_str)) return other_config[name] # SECURITY_CONFIG, SP_EXTRA, or similar extra settings diff --git a/common/test/acceptance/tests/studio/test_studio_help.py b/common/test/acceptance/tests/studio/test_studio_help.py index b21a1ef0b8..f1b524e95b 100644 --- a/common/test/acceptance/tests/studio/test_studio_help.py +++ b/common/test/acceptance/tests/studio/test_studio_help.py @@ -179,7 +179,7 @@ class HomeHelpTest(StudioCourseTest): Scenario: Help link in sidebar links is working on 'Home'(Courses tab) page. Given that I am on the 'Home'(Courses tab) page. And I want help about the courses - And I click the 'Getting Started with edX Studio' in the sidebar links + And I click the 'Getting Started with Your Platform Studio' in the sidebar links Then Help link should open. And help url should be correct """ @@ -190,7 +190,7 @@ class HomeHelpTest(StudioCourseTest): test=self, page=self.home_page, href=expected_url, - help_text='Getting Started with edX Studio', + help_text='Getting Started with Your Platform Studio', as_list_item=True ) @@ -232,7 +232,7 @@ class NewCourseHelpTest(AcceptanceTest): Scenario: Help link in sidebar links is working on 'Create a New Course' page in the dashboard. Given that I am on the 'Create a New Course' page in the dashboard. And I want help about the process - And I click the 'Getting Started with edX Studio' in the sidebar links + And I click the 'Getting Started with Your Platform Studio' in the sidebar links Then Help link should open. And help url should be correct """ @@ -243,7 +243,7 @@ class NewCourseHelpTest(AcceptanceTest): test=self, page=self.dashboard_page, href=expected_url, - help_text='Getting Started with edX Studio', + help_text='Getting Started with Your Platform Studio', as_list_item=True ) @@ -285,7 +285,7 @@ class NewLibraryHelpTest(AcceptanceTest): Scenario: Help link in sidebar links is working on 'Create a New Library' page in the dashboard. Given that I am on the 'Create a New Library' page in the dashboard. And I want help about the process - And I click the 'Getting Started with edX Studio' in the sidebar links + And I click the 'Getting Started with Your Platform Studio' in the sidebar links Then Help link should open. And help url should be correct """ @@ -296,7 +296,7 @@ class NewLibraryHelpTest(AcceptanceTest): test=self, page=self.dashboard_page, href=expected_url, - help_text='Getting Started with edX Studio', + help_text='Getting Started with Your Platform Studio', as_list_item=True ) diff --git a/lms/envs/aws.py b/lms/envs/aws.py index 58dfc6da70..6bbbbf922b 100644 --- a/lms/envs/aws.py +++ b/lms/envs/aws.py @@ -581,7 +581,7 @@ if 'DATADOG_API' in AUTH_TOKENS: # Analytics Dashboard ANALYTICS_DASHBOARD_URL = ENV_TOKENS.get("ANALYTICS_DASHBOARD_URL", ANALYTICS_DASHBOARD_URL) -ANALYTICS_DASHBOARD_NAME = ENV_TOKENS.get("ANALYTICS_DASHBOARD_NAME", PLATFORM_NAME + " Insights") +ANALYTICS_DASHBOARD_NAME = ENV_TOKENS.get("ANALYTICS_DASHBOARD_NAME", ANALYTICS_DASHBOARD_NAME) # Mailchimp New User List MAILCHIMP_NEW_USER_LIST_ID = ENV_TOKENS.get("MAILCHIMP_NEW_USER_LIST_ID") diff --git a/lms/envs/common.py b/lms/envs/common.py index d86079f0ad..9a63804cb6 100644 --- a/lms/envs/common.py +++ b/lms/envs/common.py @@ -45,7 +45,7 @@ from lms.djangoapps.lms_xblock.mixin import LmsBlockMixin ################################### FEATURES ################################### # The display name of the platform to be used in templates/emails/etc. -PLATFORM_NAME = "Your Platform Name Here" +PLATFORM_NAME = _('Your Platform Name Here') CC_MERCHANT_NAME = PLATFORM_NAME PLATFORM_FACEBOOK_ACCOUNT = "http://www.facebook.com/YourPlatformFacebookAccount" @@ -2852,7 +2852,7 @@ OPENID_DOMAIN_PREFIX = 'openid:' ### Analytics Dashboard (Insights) settings ANALYTICS_DASHBOARD_URL = "" -ANALYTICS_DASHBOARD_NAME = PLATFORM_NAME + " Insights" +ANALYTICS_DASHBOARD_NAME = _('Your Platform Insights') # REGISTRATION CODES DISPLAY INFORMATION SUBTITUTIONS IN THE INVOICE ATTACHMENT INVOICE_CORP_ADDRESS = "Please place your corporate address\nin this configuration" diff --git a/lms/envs/devstack.py b/lms/envs/devstack.py index 9169f9a308..c0cbd866e7 100644 --- a/lms/envs/devstack.py +++ b/lms/envs/devstack.py @@ -15,7 +15,6 @@ DEBUG = True USE_I18N = True DEFAULT_TEMPLATE_ENGINE['OPTIONS']['debug'] = True SITE_NAME = 'localhost:8000' -PLATFORM_NAME = ENV_TOKENS.get('PLATFORM_NAME', 'Devstack') # By default don't use a worker, execute tasks as if they were local functions CELERY_ALWAYS_EAGER = True HTTPS = 'off'