Translate calendar - #2359
Translate calendar#2359Yago004 wants to merge 5 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR extends Ravada’s i18n support on the Schedule/Bookings UI by propagating the user’s language into the page (<html lang>), Angular datepicker locale data, and the FullCalendar/Moment locale configuration, and by adding a few missing translation strings.
Changes:
- Set the Schedule/Bookings page HTML
langattribute and use it to drive Moment/FullCalendar locale selection. - Load AngularJS
angular-i18nlocale data dynamically based on the active language. - Add/extend translation strings and localize a few UI labels (e.g., LDAP groups header, datepicker button texts).
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| templates/ng-templates/booking/calendar.html.ep | Adds lang attribute to the Bookings calendar page HTML root. |
| templates/main/machine_access_group.html.ep | Localizes “LDAP groups” header. |
| templates/bootstrap/scripts.html.ep | Loads AngularJS locale file dynamically; adds locale include to fallback branch too. |
| templates/booking/formEvent.component.html.ep | Localizes datepicker button labels for one datepicker instance. |
| public/js/booking/calendar.component.js | Uses document language to set FullCalendar locale and Moment week settings; adjusts calendar height. |
| public/js/booking/booking.module.js | Sets angular-moment locale from document language at module startup. |
| lib/Ravada/I18N/messages.pot | Adds new msgids for newly localized strings. |
| lib/Ravada/I18N/es.po | Adds Spanish translations for new strings. |
| lib/Ravada/I18N/en.po | Adds English translations for new strings. |
| lib/Ravada/I18N/ca.po | Adds Catalan translations for new strings. |
Comments suppressed due to low confidence (1)
templates/bootstrap/scripts.html.ep:40
- The locale script fallback uses 'es' even though the app I18N plugin default is 'en' (script/rvd_front: plugin I18N => {... default => 'en'}). Defaulting to Spanish here can load the wrong Angular locale when no language is set.
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular-i18n/1.8.2/angular-locale_<%= stash('language') || (stash('i18n') ? stash('i18n')->{language} : 'es') %>.js"></script>
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| <script src="/fallback/angular-1.8.2/angular.min.js"></script> | ||
| <script src="https://cdnjs.cloudflare.com/ajax/libs/angular-i18n/1.8.2/angular-locale_<%= stash('language') || (stash('i18n') ? stash('i18n')->{language} : 'es') %>.js"></script> | ||
|
|
There was a problem hiding this comment.
🟡 Changes recommended
Several supported locale identifiers resolve incorrectly, and fallback mode introduces an external CDN dependency.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
Suppressed comments (1)
templates/bootstrap/scripts.html.ep:40
- The fallback branch is intended to serve dependencies from
/fallback, but this newly added locale still comes from Cloudflare. On installations using fallback mode because external CDNs are unavailable, the request fails and the datepicker remains in the default locale. Bundle the required AngularJS locale files with the other fallback assets and load the mapped local file here.
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular-i18n/1.8.2/angular-locale_<%= stash('language') || (stash('i18n') ? stash('i18n')->{language} : 'en') %>.js"></script>
- Files reviewed: 10/10 changed files
- Comments generated: 2
- Review effort level: Balanced
| <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script> | ||
|
|
||
| <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.8.2/angular.min.js"></script> | ||
| <script src="https://cdnjs.cloudflare.com/ajax/libs/angular-i18n/1.8.2/angular-locale_<%= stash('language') || (stash('i18n') ? stash('i18n')->{language} : 'en') %>.js"></script> |
| @@ -1,5 +1,5 @@ | |||
| <!DOCTYPE html> | |||
| <html ng-app="ravada.app"> | |||
| <html ng-app="ravada.app" lang="<%= stash('language') || (stash('i18n') ? stash('i18n')->{language} : 'en') %>"> | |||
changed some languages identificators issue UPC#2320
There was a problem hiding this comment.
🟡 Changes recommended
Several Angular locale URLs are invalid, fallback mode retains an external dependency, and persisted legacy locale IDs lack migration.
Get a fresh assessment by requesting another Copilot review.
Review details
Suppressed comments (2)
templates/bootstrap/scripts.html.ep:7
- The application locale is not always an Angular i18n asset name. Angular 1.8.2 provides
ca-es-valencia,nb-no, andzh-cn, but this URL generatesca-valencia,nb-NO, andzh-CN; those requests return no locale module, leaving the datepicker in English. Lowercase the code and explicitly map Valencian before building the URL.
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular-i18n/1.8.2/angular-locale_<%= stash('language') || (stash('i18n') ? stash('i18n')->{language} : 'en') %>.js"></script>
templates/bootstrap/scripts.html.ep:40
- This is inside the
$fallbackbranch, but it still loads from cdnjs while every other script in the branch is local. An offline/fallback installation therefore loses the Angular locale and renders the booking datepicker in English. Load the locale from the Angular archive under/fallback/angular-1.8.2/i18n/(with the normalized/mapped asset name), or add the locale assets tofallback.conf.
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular-i18n/1.8.2/angular-locale_<%= stash('language') || (stash('i18n') ? stash('i18n')->{language} : 'en') %>.js"></script>
- Files reviewed: 16/16 changed files
- Comments generated: 1
- Review effort level: Balanced
| ,ko => 'Korean' | ||
| ,my => 'Melayu' | ||
| ,nb_NO => 'Norwegian' | ||
| ,ms => 'Melayu' |
Translated Schedule page, its calendar and the booking date selector (day names, months...).
Also added translation of a few more frases.