Skip to content

fix(i18n): load translations at startup and translate missed LMS strings - #3296

Merged
raizasafeel merged 4 commits into
frappe:developfrom
raizasafeel:fix/arabic-translations
Nov 16, 2026
Merged

raizasafeel merged 4 commits into
frappe:developfrom
raizasafeel:fix/arabic-translations

Conversation

@raizasafeel

@raizasafeel raizasafeel commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Fixes LMS text that stayed in English when the UI language is Arabic.

Why

  • Arabic users saw many English labels, sentences in the wrong word order, and server messages in English.
  • Translations loaded after the app had already rendered, so text shown during startup stayed English.
  • About 216 strings in .ts files were never extracted for translation.
  • Many labels were never wrapped for translation at all.
  • Sentences built from separate pieces read in the wrong order in Arabic.

What changed

  • index.html requests translations (get_boot_translations) alongside the app bundle, like Desk does. The request is cached.
  • The app waits for translations for at most 3 seconds, so a slow request cannot leave the page blank. Late translations still apply.
  • Users without their own language setting fall back to the site language.
  • babel_extractors.csv extracts frontend/src/**.ts.
  • Wrapped labels for translation: settings definitions, field placeholders and select options, empty states, statistics, status and option values from the database, and email provider descriptions.
  • Replaced sentences built from pieces with single translatable templates, such as {0} of {1} lessons completed and {0} students. Word order now works in Arabic.
  • The sidebar Collapse label in frappe-ui is hardcoded in English, so LMS uses its own translated button.
  • Reworded two English strings that named a side that is wrong in RTL: "left sidebar" is now "sidebar", and "on the right" is now "under Details". This resets the existing translations for those two strings.
  • Server messages in lms/auth.py and course_import_export.py use _() with placeholders.
  • Translation files (lms/locale/*.po, main.pot) are not in this PR. The Crowdin bot regenerates main.pot weekly and overwrites the .po files from Crowdin. The full Arabic translation is ready and will be uploaded to Crowdin once the new strings reach it.

Screenshots

Arabic UI, right to left. Each pair is cropped to the part of the page whose text changed. Before: Arabic UI without this PR (strings left in English, glued in the wrong order). After: this PR with the Arabic translations it makes possible (to be uploaded to Crowdin).

Sidebar (1)
Screen Before After
Home while the admin's evaluations request is out
Admin pages (6)
Screen Before After
Settings opened from the user menu, on its first section
Settings, Payment Configuration
The student's learning streak dialog, opened from the flame counter.
Settings, Progress
Settings, Services
Settings, Communication General
Assignments (6)
Screen Before After
All 21 assignment submissions across the four assignments, newest first
Enable Scheduling switched on
A row opened
Create pressed with nothing filled in
Ashley on her own Not Graded submission
Submit pressed with no answer
Batch learning (6)
Screen Before After
Dashboard tab for a student
Enrolled tab
A staff form route (Add Course) opened by a student
A student's search that matches no batch.
Python Data Bootcamp, which Ashley is not in
The ended Autumn Cohort 2026 opened by a student who was in it.
Batches (6)
Screen Before After
The Generate Certificates route opened directly
New Email Template form, opened from the confirmation email field's Create New.
Settings tab
Add Course form, opened from the Courses section in Settings.
Dashboard tab
Ashley's row opened
Course admin (6)
Screen Before After
Title cleared
Delete Course confirmation, warning that chapters and lessons go too.
The draft's Settings tab, where the header offers Publish instead of Unpublish.
Edit Chapter form opened by URL, prefilled with the Introduction chapter's title.
Lesson Completion sorted by completion rate. This course's lessons already run highest fir
A student search nothing matches
Courses (5)
Screen Before After
New Course form, opened over the list.
A course card opened
The course list request failed. There is no error state
A search nothing matches
The Import menu
Jobs (6)
Screen Before After
Submit with no resume
Open jobs as the admin
Send with no message
Filtered to Freelance, which no job is
The job list request failed. There is no error state
More actions on the first application
Learning (6)
Screen Before After
Enroll Now pressed signed out
Building Your First Frappe App, enrolled but untouched
Product Management Essentials, a featured course with a certificate that she is not enroll
The demo course for an enrolled learner
The last lesson, picked in the sidebar
The certification page for a learner who bought the certificate and holds it (response sha
Profile (6)
Screen Before After
A Tuesday slot added
Monday's end moved before its start
Both saved slots removed but not saved
First name cleared and Save pressed
The admin on Jannat's Slots tab
The admin on Ashley's Roles tab
Programming Exercises (6)
Screen Before After
One exercise ticked and Delete pressed
Code edited, then Reset
All 11 programming exercise submissions across the three exercises, nine Passed and two Fa
The exercise list request failed. There is no error state
The exercise form while its record is still out
FizzBuzz submissions filtered to Failed, which matches nothing
Programs (6)
Screen Before After
Delete program asks to confirm; nothing is deleted.
The enroll dialog for Data Analyst Track
Create clicked with no title
Progress Summary for Product Designer Track
The program list request failed. There is no error state
Ashley opens Data Analyst Track from the Published tab while the program request is still
Taking a quiz (6)
Screen Before After
The quiz served with 3 attempts and Show Submission History on (shaped)
The same quiz embedded in its lesson, Quiz Time, in the course's learning view.
The quiz served with max_attempts 1 (shaped; the seeded quiz is unlimited), so Ashley's on
The server refuses the quiz with a PermissionError (shaped response; Ashley is enrolled)
Check pressed with no option chosen
The result after submitting
Quizzes (6)
Screen Before After
New Quiz with Enable Scheduling switched on
The first question card opened inline
Preview
New question pressed
Delete pressed
The New question dialog, empty, with Save disabled until it is valid.

raizasafeel and others added 2 commits November 16, 2026 18:37
- Load translations before mounting: __() in setup() and module scope ran
  before the messages arrived and stayed English.
- Extract frontend/src/**.ts (babel_extractors.csv): ~216 strings in .ts
  files never reached the pot.
- Wrap untranslated copy (settings definitions, shared field renderers,
  empty states, statistics, status and option values) and replace glued
  fragments with single templates ("{0}% completed", "{0} of {1}",
  "Active Batches", counts with plural forms).
- Fill lms/locale/ar.po: every msgid has Arabic, and 243 wrong Crowdin
  entries are corrected against one glossary (Score, Clear, Edit,
  Collapse, Title, Notifications...).
- Translated sidebar collapse button in place of frappe-ui's hardcoded one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Translate at render what module scope evaluated before the messages
  loaded: settings page titles (Categories, Coupons), the list's create
  label (Assign) and ChildTable's column headers (test case Input,
  Expected Output, Hidden).
- Extract strings that never reached the pot: Payment Gateways and
  Google Meet Settings empty states, the mobile Pages heading and the
  Custom email provider tile (now a translated label on the service).
- Template the evaluation event title ("{0}'s Evaluation") and the job
  application email subject; give the job form selects a translated
  placeholder.
- Make side-specific copy direction-neutral: the new-quiz empty state and
  the brand settings no longer say "on the right" / "left sidebar".
- Localize dates: timeAgo uses dayjs (with the site locale) instead of
  vueuse's English-only useTimeAgo, and the quiz submission date and
  times use dayjs formats instead of the browser locale.
- Show the error's message in the job applications toasts; they were
  handed the Error object and rendered blank.
- ar.po: Arabic for the new msgids, and «{0}» in place of "{0}" / '{0}'
  so quoted values stay attached in RTL.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
raizasafeel added a commit to raizasafeel/lms that referenced this pull request Nov 16, 2026
@raizasafeel

Copy link
Copy Markdown
Contributor Author

@greptile review

@greptile-apps

greptile-apps Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[High impact] Appears safe to merge with the remaining non-blocking translation issue.

Reviews (3) · Last reviewed commit: "fix(i18n): allow boot translations throu..." · Reviewed by Greptile

Comment thread frontend/index.html Resolved
Comment on lines +48 to +54
const request = (window.lmsTranslations || fetchTranslations()).then(
(messages) => {
window.translatedMessages = messages
}
)
const timeout = new Promise((resolve) => setTimeout(resolve, MOUNT_WAIT_MS))
return Promise.race([request, timeout])

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Late translations leave English text

When translations take more than three seconds, the app mounts in English. Assigning window.translatedMessages later does not tell Vue to redraw, and setup-time strings such as submission filters stay English until remount. Make late messages trigger updates and rebuild those strings. Add a mounted-component test rather than checking only __().

Prompt To Fix With AI
This is a comment left during a code review.
Path: frontend/src/translation.js
Line: 48-54

Comment:
**Late translations leave English text**

When translations take more than three seconds, the app mounts in English. Assigning `window.translatedMessages` later does not tell Vue to redraw, and setup-time strings such as submission filters stay English until remount. Make late messages trigger updates and rebuild those strings. Add a mounted-component test rather than checking only `__()`.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

…late messages

With block_endpoints on, students and guests were refused
frappe.translate.get_boot_translations, which index.html now loads
translations from, so they saw English. Allow that read-only path.

Messages that arrive after the mount wait now re-render templates: __()
reads a version ref that the arrival bumps.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@raizasafeel

Copy link
Copy Markdown
Contributor Author

@greptile review

@raizasafeel
raizasafeel merged commit ebc7385 into frappe:develop Nov 16, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant