Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Enabled translation on html files in LMS [Proposal] #21582

Merged
merged 8 commits into from Jun 22, 2020
22 changes: 11 additions & 11 deletions erpnext/www/lms/content.html
Expand Up @@ -59,7 +59,7 @@
{% macro title() %}
<div class="mb-3">
<a href="/lms/course?name={{ course }}&program={{ program }}" class="text-muted">
Back to Course
{{_('Back to Course')}}
</a>
</div>
<div>
Expand All @@ -69,15 +69,15 @@ <h2>{{ content.name }} <span class="small text-muted">({{ position + 1 }}/{{leng

{% macro navigation() %}
{% if previous %}
<a href="/lms/content?program={{ program }}&course={{ course }}&topic={{ topic }}&type={{ previous.content_type }}&content={{ previous.content }}" class='btn text-muted' style="box-shadow: none;">Previous</a>
<a href="/lms/content?program={{ program }}&course={{ course }}&topic={{ topic }}&type={{ previous.content_type }}&content={{ previous.content }}" class='btn text-muted' style="box-shadow: none;">{{_('Previous')}}</a>
{% else %}
<a href="/lms/course?name={{ course }}&program={{ program }}" class='btn text-muted' style="box-shadow: none;">Back to Course</a>
<a href="/lms/course?name={{ course }}&program={{ program }}" class='btn text-muted' style="box-shadow: none;">{{ _('Back to Course') }}</a>
{% endif %}

{% if next %}
<button id="nextButton" onclick="handle('/lms/content?program={{ program }}&course={{ course }}&topic={{ topic }}&type={{ next.content_type }}&content={{ next.content }}')" class='btn btn-primary' disabled="true">Next</button>
<button id="nextButton" onclick="handle('/lms/content?program={{ program }}&course={{ course }}&topic={{ topic }}&type={{ next.content_type }}&content={{ next.content }}')" class='btn btn-primary' disabled="true">{{_('Next')}}</button>
{% else %}
<button id="nextButton" onclick="handle('/lms/course?name={{ course }}&program={{ program }}')" class='btn btn-primary' disabled="true">Finish Topic</button>
<button id="nextButton" onclick="handle('/lms/course?name={{ course }}&program={{ program }}')" class='btn btn-primary' disabled="true">{{_('Finish Topic')}}</button>
{% endif %}
{% endmacro %}

Expand All @@ -86,15 +86,15 @@ <h2>{{ content.name }} <span class="small text-muted">({{ position + 1 }}/{{leng
{{ title() }}
<div class="text-muted">
{% if content.duration %}
{{ content.duration }} Mins
{{ content.duration }} {{_('Mins')}}
{% endif %}

{% if content.publish_date and content.duration%}
-
{% endif %}

{% if content.publish_date %}
Published on {{ content.publish_date.strftime('%d, %b %Y') }}
{{_('Published on')}} {{ content.publish_date.strftime('%d, %b %Y') }}
{% endif %}
</div>
</div>
Expand All @@ -109,13 +109,13 @@ <h2>{{ content.name }} <span class="small text-muted">({{ position + 1 }}/{{leng
{{ title() }}
<div class="text-muted">
{% if content.author or content.publish_date %}
Published
{{_('Published')}}
{% endif %}
{% if content.author %}
by {{ content.author }}
{{_('by')}} {{ content.author }}
{% endif %}
{% if content.publish_date %}
on {{ content.publish_date.strftime('%d, %b %Y') }}
{{_('on')}} {{ content.publish_date.strftime('%d, %b %Y') }}
{% endif %}
</div>
</div>
Expand Down Expand Up @@ -205,4 +205,4 @@ <h2>{{ content.name }} <span class="small text-muted">({{ position + 1 }}/{{leng

{% endif %}
</script>
{% endblock %}
{% endblock %}
6 changes: 3 additions & 3 deletions erpnext/www/lms/course.html
Expand Up @@ -72,11 +72,11 @@ <h5 class='card-title'>{{ topic.topic_name }}</h5>
{% if has_access %}
<div class='card-footer'>
{% if progress[topic.name].completed %}
<span class="indicator green">Completed</span>
<span class="indicator green">{{_('Completed')}}</span>
{% elif progress[topic.name].started %}
<span class="indicator orange">In Progress</span>
<span class="indicator orange">{{_('In Progress')}}</span>
{% else %}
<span class="indicator blue">Start</span>
<span class="indicator blue">{{_('Start')}}</span>
{% endif %}
</div>
</a>
Expand Down
2 changes: 1 addition & 1 deletion erpnext/www/lms/index.html
Expand Up @@ -45,7 +45,7 @@ <h1>{{ education_settings.portal_title }}</h1>
<p class='lead'>{{ education_settings.description }}</p>
<p class="mt-4">
{% if frappe.session.user == 'Guest' %}
<a class="btn btn-primary btn-lg" href="'/login#signup'">Sign Up</a>
<a class="btn btn-primary btn-lg" href="'/login#signup'">{{_('Sign Up')}}</a>
{% endif %}
</p>
</div>
Expand Down
4 changes: 2 additions & 2 deletions erpnext/www/lms/macros/card.html
Expand Up @@ -15,8 +15,8 @@ <h5 class='card-title'>{{ program.program_name }}</h5>
</div>
{% if has_access or program.intro_video%}
<div class='card-footer'>
{% if has_access %} <span class="indicator green">Enrolled</span>
{% elif program.intro_video %} <span><a href="{{ program.intro_video }}" target="blank">Watch Intro</a></span>
{% if has_access %} <span class="indicator green">{{_('Enrolled')}}</span>
{% elif program.intro_video %} <span><a href="{{ program.intro_video }}" target="blank">{{_('Watch Intro')}}</a></span>
{% endif %}
</div>
{% endif %}
Expand Down
10 changes: 5 additions & 5 deletions erpnext/www/lms/macros/hero.html
Expand Up @@ -2,16 +2,16 @@
<div class='container pb-5'>
<div class="mb-3">
<a href="{{ back.url }}" class="text-muted">
Back to {{ back.name }}
{{_('Back to')}} {{ _(back.name) }}
</a>
</div>
<h1>{{ title }}</h1>
<p class='lead' style="max-width: 100%;">{{ description or ''}}</p>
<p class="mt-4">
{% if frappe.session.user == 'Guest' %}
<a id="signup" class="btn btn-primary btn-lg" href="/login#signup">Sign Up</a>
<a id="signup" class="btn btn-primary btn-lg" href="/login#signup">{{_('Sign Up')}}</a>
{% elif not has_access %}
<button id="enroll" class="btn btn-primary btn-lg" onclick="enroll()" disabled>Enroll</button>
<button id="enroll" class="btn btn-primary btn-lg" onclick="enroll()" disabled>{{_('Enroll')}}</button>
{% endif %}
</p>
</div>
Expand All @@ -28,7 +28,7 @@ <h1>{{ title }}</h1>

let btn = document.getElementById('enroll');
btn.disbaled = true;
btn.innerText = 'Enrolling...'
btn.innerText = __('Enrolling...')

let opts = {
method: 'erpnext.education.utils.enroll_in_program',
Expand All @@ -44,7 +44,7 @@ <h1>{{ title }}</h1>
window.location.reload()
}
})
success_dialog.set_message('You have successfully enrolled for the program ');
success_dialog.set_message(__('You have successfully enrolled for the program '));
success_dialog.$message.show()
success_dialog.show();
btn.disbaled = false;
Expand Down
8 changes: 4 additions & 4 deletions erpnext/www/lms/profile.html
Expand Up @@ -30,7 +30,7 @@ <h5 class='card-title'>{{ program.program }}</h5>
</ul>
</div>
<div class='card-footer'>
<span class="small">{{ program.completion }}% Complete</span>
<span class="small">{{ program.completion }}{{_('% Complete')}}</span>
</div>
</div>
</a>
Expand All @@ -43,11 +43,11 @@ <h5 class='card-title'>{{ program.program }}</h5>
<div class="mb-3 row">
<div class="col-md-7">
<a href="/lms" class="text-muted">
Back to Home
{{_('Back to Home')}}
</a>
</div>
<div class="col-md-5 text-right">
<a href="/update-profile?name={{ frappe.session.user }}" target="blank" class="mt-0 text-muted">Edit Profile</a>
<a href="/update-profile?name={{ frappe.session.user }}" target="blank" class="mt-0 text-muted">{{_('Edit Profile')}}</a>
</div>
</div>
<h1>{{ student.first_name }} {{ student.last_name or '' }}</h1>
Expand All @@ -61,4 +61,4 @@ <h1>{{ student.first_name }} {{ student.last_name or '' }}</h1>
</div>
</div>
</section>
{% endblock %}
{% endblock %}
6 changes: 3 additions & 3 deletions erpnext/www/lms/program.html
Expand Up @@ -55,11 +55,11 @@ <h5 class='card-title'>{{ course.course_name }}</h5>
{% if has_access and progress[course.name] %}
<div class='card-footer'>
{% if progress[course.name].completed %}
<span class="indicator green">Completed</span>
<span class="indicator green">{{_('Completed')}}</span>
{% elif progress[course.name].started %}
<span class="indicator orange">In Progress</span>
<span class="indicator orange">{{_('In Progress')}}</span>
{% else %}
<span class="indicator blue">Start</span>
<span class="indicator blue">{{_('Start')}}</span>
{% endif %}
</div>
{% endif %}
Expand Down
10 changes: 5 additions & 5 deletions erpnext/www/lms/topic.html
Expand Up @@ -23,13 +23,13 @@ <h5 class='card-title'>{{ content.content.name }}</h5>
{% if has_access %}
<div class='card-footer'>
{% if content.content_type == 'Quiz' %}
{% if content.result == 'Fail' %} <span class="indicator red">Fail <span class="text-muted">({{ content.score }}/100)</span></span>
{% elif content.result == 'Pass' %} <span class="indicator green">Pass <span class="text-muted">({{ content.score }}/100)</span>
{% else %} <span class="indicator blue">Start</span>
{% if content.result == 'Fail' %} <span class="indicator red">{{_('Fail')}} <span class="text-muted">({{ content.score }}/100)</span></span>
{% elif content.result == 'Pass' %} <span class="indicator green">{{_('Pass')}} <span class="text-muted">({{ content.score }}/100)</span>
{% else %} <span class="indicator blue">{{_('Start')}}</span>
{% endif %}
{% else %}
{% if content.completed %} <span class="indicator green">Completed</span>
{% else %} <span class="indicator blue">Start</span>
{% if content.completed %} <span class="indicator green">{{_('Completed')}}</span>
{% else %} <span class="indicator blue">{{_('Start')}}</span>
{% endif %}
{% endif %}
</div>
Expand Down