Skip to content

Commit ebc7385

Browse files
authored
Merge pull request #3296 from raizasafeel/fix/arabic-translations
fix(i18n): load translations at startup and translate missed LMS strings
2 parents 3097dc7 + 8b1dcce commit ebc7385

124 files changed

Lines changed: 962 additions & 562 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎babel_extractors.csv‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
frontend/src/tests/**,ignore
2+
frontend/src/**.ts,frappe.gettext.extractors.html_template.extract

‎frontend/index.html‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,24 @@ <h1>{{ meta.title | e }}</h1>
266266
<script>
267267
document.getElementById('seo-content').style.display = 'none';
268268
</script>
269+
<script>
270+
/* Started here so the messages download alongside the bundle. A GET
271+
keyed by the translations version, so the browser caches it, as
272+
frappe/www/desk.html does. src/translation.js waits for it. */
273+
window.lmsTranslations = fetch(
274+
'/api/method/frappe.translate.get_boot_translations?v={{ boot.translations_version }}&lang={{ boot.lang }}',
275+
{ credentials: 'same-origin', headers: { Accept: 'application/json' } }
276+
)
277+
.then(function (response) {
278+
return response.ok ? response.json() : {}
279+
})
280+
.then(function (data) {
281+
return data.message || {}
282+
})
283+
.catch(function () {
284+
return {}
285+
})
286+
</script>
269287
<script type="module" src="/src/main.js"></script>
270288
</body>
271289
</html>

‎frontend/src/components/Assessment/QuizStats.vue‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<div class="space-y-0.5 bg-surface-base px-3 py-2">
1313
<dt class="text-xs text-ink-gray-6">{{ __('Time limit') }}</dt>
1414
<dd class="text-base font-medium text-ink-gray-9">
15-
{{ duration ? `${duration} ${__('min')}` : __('None') }}
15+
{{ duration ? __('{0} min').format(duration) : __('None') }}
1616
</dd>
1717
</div>
1818
<div v-if="questions" class="space-y-0.5 bg-surface-base px-3 py-2">

‎frontend/src/components/Assignment.vue‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
<div v-if="assignment.data" ref="root" :class="rootClass">
33
<div v-if="showTitle" class="mb-4 text-lg-semibold text-ink-gray-9">
44
<div v-if="currentSubmission === 'new'">
5-
{{ __('Submission by') }} {{ user.data?.full_name }}
5+
{{ __('Submission by {0}').format(user.data?.full_name ?? '') }}
66
</div>
77
<div v-else>
8-
{{ __('Submission by') }} {{ submissionDoc?.member_name }}
8+
{{ __('Submission by {0}').format(submissionDoc?.member_name ?? '') }}
99
</div>
1010
</div>
1111
<AssessmentCard>
@@ -60,7 +60,7 @@
6060
:theme="statusTheme"
6161
size="sm"
6262
>
63-
{{ submissionDoc?.status }}
63+
{{ __(submissionDoc?.status) }}
6464
</Badge>
6565
</div>
6666

@@ -602,9 +602,9 @@ const saveLabel = computed(() =>
602602
603603
const submissionStatusOptions = computed(() => {
604604
return [
605-
{ label: 'Not Graded', value: 'Not Graded' },
606-
{ label: 'Pass', value: 'Pass' },
607-
{ label: 'Fail', value: 'Fail' },
605+
{ label: __('Not Graded'), value: 'Not Graded' },
606+
{ label: __('Pass'), value: 'Pass' },
607+
{ label: __('Fail'), value: 'Fail' },
608608
]
609609
})
610610

‎frontend/src/components/Controls/ChildTable.vue‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
class="text-sm text-ink-gray-6"
2626
:class="{ 'text-center': isCheckboxColumn(column) }"
2727
>
28-
{{ column }}
28+
{{ __(column) }}
2929
</div>
3030
<div role="columnheader">
3131
<span class="sr-only">{{ actionsLabel }}</span>

‎frontend/src/components/Controls/Link.vue‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
:open="isOpen"
55
:modelValue="value"
66
:options="resolvedOptions"
7-
:placeholder="attrs.placeholder as string"
7+
:placeholder="(attrs.placeholder as string) || __('Select option')"
88
:disabled="attrs.readonly as boolean"
99
:size="(attrs.size as ComboboxSize) || 'sm'"
1010
:aria-label="label ? undefined : (attrs['aria-label'] as string)"

‎frontend/src/components/Controls/MultiLink.vue‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
v-model:query="query"
66
:options="mergedOptions"
77
:placeholder="placeholder"
8-
:emptyText="emptyText"
8+
:emptyText="__(emptyText)"
99
:variant="variant"
1010
:disabled="disabled"
1111
:loading="loading"

‎frontend/src/components/Controls/Select.vue‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
:options="options"
77
:size="size"
88
:variant="variant"
9-
:placeholder="placeholder"
9+
:placeholder="placeholder || __('Select option')"
1010
:disabled="disabled"
1111
:emptyText="emptyText"
1212
:required="required"

‎frontend/src/components/Controls/Uploader.vue‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
>
5959
{{
6060
uploading
61-
? `${__('Uploading')} ${progress}%`
61+
? __('Uploading {0}%').format(progress)
6262
: modelValue
6363
? __('Replace')
6464
: __('Upload')

‎frontend/src/components/CourseCard.vue‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@
122122
/>
123123

124124
<div v-if="user && course.membership" class="text-sm mt-2 mb-4">
125-
{{ Math.ceil(course.membership.progress) }}% {{ __('completed') }}
125+
{{ __('{0}% completed').format(Math.ceil(course.membership.progress)) }}
126126
</div>
127127

128128
<div class="flex items-center justify-between mt-auto">

0 commit comments

Comments
 (0)