def _get_custom_template_and_language(course_id, course_mode, course_language): """ Return the custom certificate template, if any, that should be rendered for the provided course/mode/language combination, along with the language that should be used to render that template. """ closest_released_language = get_closest_released_language( course_language) if course_language else None log.info( "closest released language for {course_id} is {closest_released_language} and course language was:" " {course_language}".format( course_id=course_id, closest_released_language=closest_released_language, course_language=course_language)) template = get_certificate_template(course_id, course_mode, closest_released_language) if template and template.language: log.info( "Returning template for course: {course_id} and template language is {language}" .format(course_id=course_id, language=template.language)) return (template, closest_released_language) elif template: user_language = translation.get_language() log.info( "Returning template for course: {course_id} and template language is returned from settings" " {language}".format(course_id=course_id, language=user_language)) return (template, user_language) else: log.info("No template found for course: {course_id}".format( course_id=course_id)) return (None, None)
def closest_released_language(self): """ Returns the language code that most closely matches this course' language and is fully supported by the LMS, or None if there are no fully supported languages that match the target. """ return get_closest_released_language(self.language) if self.language else None
def closest_released_language(self): """ Returns the language code that most closely matches this course' language and is fully supported by the LMS, or None if there are no fully supported languages that match the target. """ return get_closest_released_language(self.language) if self.language else None
def _get_custom_template_and_language(course_id, course_mode, course_language): """ Return the custom certificate template, if any, that should be rendered for the provided course/mode/language combination, along with the language that should be used to render that template. """ closest_released_language = get_closest_released_language(course_language) if course_language else None template = get_certificate_template(course_id, course_mode, closest_released_language) if template and template.language: return (template, closest_released_language) elif template: return (template, settings.LANGUAGE_CODE) else: return (None, None)
def _get_custom_template_and_language(course_id, course_mode, course_language): """ Return the custom certificate template, if any, that should be rendered for the provided course/mode/language combination, along with the language that should be used to render that template. """ closest_released_language = get_closest_released_language(course_language) if course_language else None template = get_certificate_template(course_id, course_mode, closest_released_language) if template and template.language: return (template, closest_released_language) elif template: return (template, settings.LANGUAGE_CODE) else: return (None, None)
def _get_custom_template_and_language(course_id, course_mode, course_language): """ Return the custom certificate template, if any, that should be rendered for the provided course/mode/language combination, along with the language that should be used to render that template. """ closest_released_language = get_closest_released_language( course_language) if course_language else None log.info( u"closest released language for %s is %s and course language was: %s", course_id, closest_released_language, course_language) template = get_certificate_template(course_id, course_mode, closest_released_language) if template and template.language: return (template, closest_released_language) elif template: user_language = translation.get_language() return (template, user_language) else: return (None, None)
def _get_custom_template_and_language(course_id, course_mode, course_language): """ Return the custom certificate template, if any, that should be rendered for the provided course/mode/language combination, along with the language that should be used to render that template. """ closest_released_language = get_closest_released_language(course_language) if course_language else None log.info( u"closest released language for %s is %s and course language was: %s", course_id, closest_released_language, course_language ) template = get_certificate_template(course_id, course_mode, closest_released_language) if template and template.language: return (template, closest_released_language) elif template: user_language = translation.get_language() return (template, user_language) else: return (None, None)