From 6b2be863b5fe5786ac68763526258220b3671bda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pau=20Ferrer=20Oca=C3=B1a?= Date: Thu, 3 Nov 2022 10:44:54 +0100 Subject: [PATCH] MOBILE-4081 lang: Improvements on script and import translations --- .github/workflows/testing.yml | 8 +++----- scripts/create_langindex.sh | 6 ++++-- scripts/lang_functions.php | 4 ++++ scripts/update_lang.sh | 2 ++ src/addons/block/myoverview/lang.json | 4 ++-- src/addons/mod/assign/lang.json | 2 +- src/addons/mod/data/lang.json | 12 ++++++------ src/addons/mod/data/tests/behat/entries.feature | 4 ++-- src/addons/mod/data/tests/behat/sync.feature | 6 +++--- src/core/features/courses/lang.json | 4 ++-- src/core/features/login/lang.json | 2 +- .../features/login/tests/behat/basic_usage.feature | 14 +++++++------- src/core/lang.json | 2 +- 13 files changed, 38 insertions(+), 32 deletions(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 415a873cb..a4718f757 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -23,15 +23,13 @@ jobs: fi gulp langcount=`jq -r '. | length' src/assets/lang/en.json` - freemiumcount=`jq 'keys' src/assets/lang/en.json | grep "freemium\." | wc -l | xargs` - allcount=$(($langcount - $freemiumcount)) langindexcount=`jq -r '. | length' scripts/langindex.json` - if [ $allcount -ne $langindexcount ]; then - echo "Lang file has $langcount ($freemiumcount) while langindex $langindexcount" + if [ $langcount -ne $langindexcount ]; then + echo "Lang file has $langcount while langindex $langindexcount" exit 1 fi - langkeys=`jq -r 'keys[]' src/assets/lang/en.json | grep -v "freemium\."` + langkeys=`jq -r 'keys[]' src/assets/lang/en.json` langindex=`jq -r 'keys[]' scripts/langindex.json` found=0 for i in $langkeys; do diff --git a/scripts/create_langindex.sh b/scripts/create_langindex.sh index a34fe6f6e..43c2a03c6 100755 --- a/scripts/create_langindex.sh +++ b/scripts/create_langindex.sh @@ -40,12 +40,14 @@ function exists_in_file { completeFile="$LANGPACKSFOLDER/en/$file.php" if [ -f "$completeFile" ]; then - coincidence=`grep "string\[\'$id\'\]" $completeFile` - if [ ! -z "$coincidence" ]; then + foundInFile=`grep "string\[\'$id\'\]" $completeFile` + if [ ! -z "$foundInFile" ]; then + coincidence=1 found=$file return fi fi + coincidence=0 found=0 } diff --git a/scripts/lang_functions.php b/scripts/lang_functions.php index 7d2dd3990..18c7252d5 100644 --- a/scripts/lang_functions.php +++ b/scripts/lang_functions.php @@ -533,5 +533,9 @@ function generate_local_module_file($appindex, $translations) { $filecontents = substr_replace($filecontents, $lmsstring, $start, $end - $start); + if (substr($filecontents, -2) != "\n\n") { + $filecontents .= "\n"; + } + file_put_contents($filepath, $filecontents); } diff --git a/scripts/update_lang.sh b/scripts/update_lang.sh index 52aee60cf..153ab0dfd 100755 --- a/scripts/update_lang.sh +++ b/scripts/update_lang.sh @@ -24,4 +24,6 @@ else php -f moodle_to_json.php "$forceLang" fi +cp langindex.json ../../moodle-local_moodlemobileapp + print_ok 'All done!' diff --git a/src/addons/block/myoverview/lang.json b/src/addons/block/myoverview/lang.json index c2180cc2c..5c381252e 100644 --- a/src/addons/block/myoverview/lang.json +++ b/src/addons/block/myoverview/lang.json @@ -1,11 +1,11 @@ { "all": "All", - "allincludinghidden": "All (including archived)", + "allincludinghidden": "All (including removed from view)", "browseallcourses": "Browse all courses", "card": "Card", "favourites": "Starred", "future": "Future", - "hiddencourses": "Archived", + "hiddencourses": "Removed from view", "inprogress": "In progress", "lastaccessed": "Last accessed", "list": "List", diff --git a/src/addons/mod/assign/lang.json b/src/addons/mod/assign/lang.json index 77aa0a70c..050cb5d21 100644 --- a/src/addons/mod/assign/lang.json +++ b/src/addons/mod/assign/lang.json @@ -20,7 +20,7 @@ "cannoteditduetostatementsubmission": "You can't add or edit a submission in the app because the submission statement could not be retrieved from the site.", "cannotgradefromapp": "Certain grading methods are not yet supported by the app and cannot be modified.", "cannotsubmitduetostatementsubmission": "You can't make a submission in the app because the submission statement could not be retrieved from the site.", - "confirmstart": "Your submission will have a time limit of {{$a}}. When you start, the timer will begin to count down and cannot be paused. You must finish your submission before it expires. Are you sure you wish to start now?", + "confirmstart": "You have {{$a}} to complete this assignment. When you begin, the timer will start to count down and can't be paused.", "confirmsubmission": "Are you sure you want to submit your work for grading? You will not be able to make any more changes.", "currentattempt": "This is attempt {{$a}}.", "currentattemptof": "This is attempt {{$a.attemptnumber}} ( {{$a.maxattempts}} attempts allowed ).", diff --git a/src/addons/mod/data/lang.json b/src/addons/mod/data/lang.json index 920d6f014..6e28a0dfe 100644 --- a/src/addons/mod/data/lang.json +++ b/src/addons/mod/data/lang.json @@ -5,8 +5,8 @@ "approve": "Approve", "approved": "Approved", "ascending": "Ascending", - "authorfirstname": "Author first name", - "authorlastname": "Author surname", + "authorfirstname": "First name", + "authorlastname": "Last name", "confirmdeleterecord": "Are you sure you want to delete this entry?", "descending": "Descending", "disapprove": "Undo approval", @@ -22,16 +22,16 @@ "foundrecords": "Found records: {{$a.num}}/{{$a.max}} (Reset filters)", "gettinglocation": "Getting location", "latlongboth": "Both latitude and longitude are required.", - "locationpermissiondenied": "Permission to access your location has been denied.", "locationnotenabled": "Location is not enabled", + "locationpermissiondenied": "Permission to access your location has been denied.", "menuchoose": "Choose...", "modulenameplural": "Databases", "more": "More", "mylocation": "My location", "noaccess": "You do not have access to this page", "nomatch": "No matching entries found!", - "norecords": "No entries in database", - "notapproved": "Entry is not approved yet.", + "norecords": "No entries yet", + "notapproved": "Pending approval", "notopenyet": "Sorry, this activity is not available until {{$a}}", "numrecords": "{{$a}} entries", "other": "Other", @@ -47,4 +47,4 @@ "timeadded": "Time added", "timemodified": "Time modified", "usedate": "Include in search." -} \ No newline at end of file +} diff --git a/src/addons/mod/data/tests/behat/entries.feature b/src/addons/mod/data/tests/behat/entries.feature index 6c38ed893..59320cca3 100644 --- a/src/addons/mod/data/tests/behat/entries.feature +++ b/src/addons/mod/data/tests/behat/entries.feature @@ -28,7 +28,7 @@ Feature: Users can manage entries in database activities Scenario: Create entry Given I entered the data activity "Web links" on course "Course 1" as "student1" in the app - Then I should find "No entries in database" in the app + Then I should find "No entries yet" in the app When I press "Add entries" in the app And I set the following fields to these values in the app: | URL | https://moodle.org/ | @@ -142,7 +142,7 @@ Feature: Users can manage entries in database activities Then I should find "Are you sure you want to delete this entry?" in the app And I press "Delete" in the app And I should not find "Moodle Cloud" in the app - And I should find "No entries in database" in the app + And I should find "No entries yet" in the app Scenario: Delete entry (teacher) & Update entry (teacher) Given I entered the data activity "Web links" on course "Course 1" as "student1" in the app diff --git a/src/addons/mod/data/tests/behat/sync.feature b/src/addons/mod/data/tests/behat/sync.feature index 0e857e408..a9aee09c5 100644 --- a/src/addons/mod/data/tests/behat/sync.feature +++ b/src/addons/mod/data/tests/behat/sync.feature @@ -29,7 +29,7 @@ Feature: Users can store entries in database activities when offline and sync wh Scenario: Create entry (offline) Given I entered the data activity "Web links" on course "Course 1" as "student1" in the app And I switch network connection to offline - And I should find "No entries in database" in the app + And I should find "No entries yet" in the app When I press "Add entries" in the app And I set the following fields to these values in the app: | URL | https://moodle.org/ | @@ -47,7 +47,7 @@ Feature: Users can store entries in database activities when offline and sync wh Scenario: Update entry (offline) & Delete entry (offline) Given I entered the data activity "Web links" on course "Course 1" as "student1" in the app - And I should find "No entries in database" in the app + And I should find "No entries yet" in the app And I press "Add entries" in the app And I set the following fields to these values in the app: | URL | https://moodle.org/ | @@ -97,7 +97,7 @@ Feature: Users can store entries in database activities when offline and sync wh Scenario: Students can undo deleting entries to a database in the app while offline Given I entered the data activity "Web links" on course "Course 1" as "student1" in the app - And I should find "No entries in database" in the app + And I should find "No entries yet" in the app And I press "Add entries" in the app And I set the following fields to these values in the app: | URL | https://moodle.org/ | diff --git a/src/core/features/courses/lang.json b/src/core/features/courses/lang.json index 85ecd6681..71ba772dd 100644 --- a/src/core/features/courses/lang.json +++ b/src/core/features/courses/lang.json @@ -22,7 +22,7 @@ "favourite": "Starred course", "filtermycourses": "Filter my courses", "frontpage": "Site home", - "hidecourse": "Archive", + "hidecourse": "Remove from view", "ignore": "Ignore", "mycourses": "My courses", "mymoodle": "Dashboard", @@ -41,7 +41,7 @@ "searchcourses": "Search courses", "searchcoursesadvice": "You can use the search courses button to find courses to access as a guest or enrol yourself in courses that allow it.", "selfenrolment": "Self enrolment", - "show": "Unarchive", + "show": "Restore to view", "showonlyenrolled": "Show only my courses", "therearecourses": "There are {{$a}} courses", "totalcoursesearchresults": "Total courses: {{$a}}" diff --git a/src/core/features/login/lang.json b/src/core/features/login/lang.json index acbdb3cff..282dc4d93 100644 --- a/src/core/features/login/lang.json +++ b/src/core/features/login/lang.json @@ -4,7 +4,7 @@ "auth_email": "Email-based self-registration", "authenticating": "Authenticating", "cancel": "Cancel", - "changepassword": "Change your password", + "changepassword": "Change password", "changepasswordbutton": "Change password", "changepasswordhelp": "If you have problems changing your password, please contact your site administrator. \"Site Administrators\" are the people who manages the Moodle at your school/university/company or learning organisation. If you don't know how to contact them, please contact your teachers/trainers.", "changepasswordreconnectinstructions": "If you didn't change your password correctly, you'll be asked to do it again.", diff --git a/src/core/features/login/tests/behat/basic_usage.feature b/src/core/features/login/tests/behat/basic_usage.feature index d92501232..07b6e8f19 100755 --- a/src/core/features/login/tests/behat/basic_usage.feature +++ b/src/core/features/login/tests/behat/basic_usage.feature @@ -95,18 +95,18 @@ Feature: Test basic usage of login in app Given I force a password change for user "student1" When I enter the app And I log in as "student1" - Then I should find "Change your password" in the app + Then I should find "Change password" in the app And I should find "You must change your password to proceed." in the app - When I press "Change password" in the app + When I press "Change password" "ion-button" in the app Then the app should have opened a browser tab with url "webserver" When I close the browser tab opened by the app Then I should find "If you didn't change your password correctly, you'll be asked to do it again." in the app - But I should not find "Change your password" in the app + But I should not find "Change password" in the app When I press "Reconnect" in the app - Then I should find "Change your password" in the app + Then I should find "Change password" in the app But I should not find "Reconnect" in the app When I press "Switch account" in the app @@ -114,10 +114,10 @@ Feature: Test basic usage of login in app And I should find "david student" in the app When I press "david student" in the app - Then I should find "Change your password" in the app + Then I should find "Change password" in the app But I should not find "Reconnect" in the app - When I press "Change password" in the app + When I press "Change password" "ion-button" in the app Then the app should have opened a browser tab with url "webserver" When I switch to the browser tab opened by the app @@ -135,7 +135,7 @@ Feature: Test basic usage of login in app When I close the browser tab opened by the app Then I should find "If you didn't change your password correctly, you'll be asked to do it again." in the app - But I should not find "Change your password" in the app + But I should not find "Change password" in the app When I press "Reconnect" in the app Then I should find "Acceptance test site" in the app diff --git a/src/core/lang.json b/src/core/lang.json index bdfd886f4..4a6262737 100644 --- a/src/core/lang.json +++ b/src/core/lang.json @@ -181,7 +181,7 @@ "mod_glossary": "Glossary", "mod_h5pactivity": "H5P", "mod_imscp": "IMS content package", - "mod_label": "Label", + "mod_label": "Text and media", "mod_lesson": "Lesson", "mod_lti": "External tool", "mod_page": "Page",