From b1c886a88e33bef2c7589c3c780c410c178f800e Mon Sep 17 00:00:00 2001 From: Saket Hatwar Date: Mon, 15 Sep 2025 08:09:44 -0400 Subject: [PATCH 01/10] Add Translation --- Makefile | 1 + .../locale/hi/LC_MESSAGES/my_preferences.po | 52 +++++++++++++++++++ .../my_preferences/locale/my_preferences.pot | 52 +++++++++++++++++++ .../templates/form_my_preferences.tpl | 24 ++++----- 4 files changed, 117 insertions(+), 12 deletions(-) create mode 100644 modules/my_preferences/locale/hi/LC_MESSAGES/my_preferences.po create mode 100644 modules/my_preferences/locale/my_preferences.pot diff --git a/Makefile b/Makefile index 35cbef1f065..d09709e86ed 100755 --- a/Makefile +++ b/Makefile @@ -113,6 +113,7 @@ locales: msgfmt -o modules/media/locale/ja/LC_MESSAGES/media.mo modules/media/locale/ja/LC_MESSAGES/media.po msgfmt -o modules/module_manager/locale/ja/LC_MESSAGES/module_manager.mo modules/module_manager/locale/ja/LC_MESSAGES/module_manager.po msgfmt -o modules/mri_violations/locale/ja/LC_MESSAGES/mri_violations.mo modules/mri_violations/locale/ja/LC_MESSAGES/mri_violations.po + msgfmt -o modules/my_preferences/locale/hi/LC_MESSAGES/my_preferences.mo modules/my_preferences/locale/hi/LC_MESSAGES/my_preferences.po msgfmt -o modules/next_stage/locale/ja/LC_MESSAGES/next_stage.mo modules/next_stage/locale/ja/LC_MESSAGES/next_stage.po msgfmt -o modules/oidc/locale/ja/LC_MESSAGES/oidc.mo modules/oidc/locale/ja/LC_MESSAGES/oidc.po msgfmt -o modules/publication/locale/ja/LC_MESSAGES/publication.mo modules/publication/locale/ja/LC_MESSAGES/publication.po diff --git a/modules/my_preferences/locale/hi/LC_MESSAGES/my_preferences.po b/modules/my_preferences/locale/hi/LC_MESSAGES/my_preferences.po new file mode 100644 index 00000000000..3c911f4f212 --- /dev/null +++ b/modules/my_preferences/locale/hi/LC_MESSAGES/my_preferences.po @@ -0,0 +1,52 @@ +# Default LORIS strings to be translated (English). +# Copy this to a language specific file and add translations to the +# new file. +# Copyright (C) 2025 +# This file is distributed under the same license as the LORIS package. +# Dave MacFarlane , 2025. +# +msgid "" +msgstr "" +"Project-Id-Version: LORIS 27\n" +"Report-Msgid-Bugs-To: https://github.com/aces/Loris/issues\n" +"POT-Creation-Date: 2025-04-08 14:37-0400\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: hi\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +msgid "My Preferences" +msgstr "मेरी प्राथमिकताएँ" + +msgid "Password Rules" +msgstr "पासवर्ड के नियम" + +msgid "The password must be at least 8 characters long." +msgstr "पासवर्ड कम से कम 8 अक्षरों का होना चाहिए।" + +msgid "The password cannot be your username or email address." +msgstr "पासवर्ड आपका उपयोगकर्ता नाम या ईमेल पता नहीं हो सकता।" + +msgid "No special characters are required but your password must be sufficiently complex to be accepted." +msgstr "कोई विशेष अक्षर आवश्यक नहीं हैं, लेकिन पासवर्ड पर्याप्त जटिल होना चाहिए ताकि स्वीकार किया जा सके।" + +msgid "Please choose a unique password." +msgstr "कृपया एक अद्वितीय पासवर्ड चुनें।" + +msgid "We suggest using a password manager to generate one for you." +msgstr "हम सुझाव देते हैं कि आपके लिए पासवर्ड बनाने के लिए पासवर्ड प्रबंधक का उपयोग करें।" + +msgid "Edit My Information" +msgstr "मेरी जानकारी संपादित करें" + +msgid "Notifications" +msgstr "सूचनाएँ" + +msgid "Save" +msgstr "सहेजें" + +msgid "Reset" +msgstr "रीसेट करें" diff --git a/modules/my_preferences/locale/my_preferences.pot b/modules/my_preferences/locale/my_preferences.pot new file mode 100644 index 00000000000..7b0f8795627 --- /dev/null +++ b/modules/my_preferences/locale/my_preferences.pot @@ -0,0 +1,52 @@ +# Default LORIS strings to be translated (English). +# Copy this to a language specific file and add translations to the +# new file. +# Copyright (C) 2025 +# This file is distributed under the same license as the LORIS package. +# Dave MacFarlane , 2025. +# +msgid "" +msgstr "" +"Project-Id-Version: LORIS 27\n" +"Report-Msgid-Bugs-To: https://github.com/aces/Loris/issues\n" +"POT-Creation-Date: 2025-04-08 14:37-0400\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +msgid "My Preferences" +msgstr "" + +msgid "Password Rules" +msgstr "" + +msgid "The password must be at least 8 characters long." +msgstr "" + +msgid "The password cannot be your username or email address." +msgstr "" + +msgid "No special characters are required but your password must be sufficiently complex to be accepted." +msgstr "" + +msgid "Please choose a unique password." +msgstr "" + +msgid "We suggest using a password manager to generate one for you." +msgstr "" + +msgid "Edit My Information" +msgstr "" + +msgid "Notifications" +msgstr "" + +msgid "Save" +msgstr "" + +msgid "Reset" +msgstr "" diff --git a/modules/my_preferences/templates/form_my_preferences.tpl b/modules/my_preferences/templates/form_my_preferences.tpl index 7a1534f6740..4ae950b2e9c 100644 --- a/modules/my_preferences/templates/form_my_preferences.tpl +++ b/modules/my_preferences/templates/form_my_preferences.tpl @@ -1,13 +1,13 @@
-

Password Rules

+

{dgettext("my_preferences", "Password Rules")}

    -
  • The password must be at least 8 characters long.
  • -
  • The password cannot be your username or email address.
  • -
  • No special characters are required but your password must be sufficiently complex to be accepted.
  • +
  • {dgettext("my_preferences", "The password must be at least 8 characters long.")}
  • +
  • {dgettext("my_preferences", "The password cannot be your username or email address.")}
  • +
  • {dgettext("my_preferences", "No special characters are required but your password must be sufficiently complex to be accepted.")}
-

Please choose a unique password.

-

We suggest using a password manager to generate one for you.

-

Edit My Information

+

{dgettext("my_preferences", "Please choose a unique password.")}

+

{dgettext("my_preferences", "We suggest using a password manager to generate one for you.")}

+

{dgettext("my_preferences", "Edit My Information")}

{foreach from=$form.errors item=error}
  • {$error}
  • @@ -38,7 +38,8 @@
    {$form.Last_name.html}
    -
    +
    +
    @@ -71,7 +72,7 @@


    -

    Notifications

    +

    {dgettext("my_preferences", "Notifications")}

    {foreach key=gkey item=gitem from=$form.notification_headers.elements} @@ -110,13 +111,12 @@
    - +
    - +
    - {$form.hidden|default} From 2cdf78a44820b141642327a51d4e453bfd1eb63d Mon Sep 17 00:00:00 2001 From: Saket Hatwar Date: Fri, 19 Sep 2025 07:14:14 -0400 Subject: [PATCH 02/10] move translations --- locale/hi/LC_MESSAGES/loris.po | 6 ++++++ locale/loris.pot | 6 ++++++ .../my_preferences/locale/hi/LC_MESSAGES/my_preferences.po | 6 ------ modules/my_preferences/locale/my_preferences.pot | 6 ------ modules/my_preferences/templates/form_my_preferences.tpl | 4 ++-- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/locale/hi/LC_MESSAGES/loris.po b/locale/hi/LC_MESSAGES/loris.po index 6d0ee737be8..1258eec45dd 100644 --- a/locale/hi/LC_MESSAGES/loris.po +++ b/locale/hi/LC_MESSAGES/loris.po @@ -187,6 +187,12 @@ msgstr "उन्नत फ़िल्टर दिखाएँ" msgid "Hide Advanced Filters" msgstr "उन्नत फ़िल्टर छुपाएँ" +msgid "Save" +msgstr "सहेजें" + +msgid "Reset" +msgstr "रीसेट करें" + # Data table strings msgid "{{pageCount}} rows displayed of {{totalCount}}." msgstr "{{totalCount}} में से {{pageCount}} पंक्तियाँ प्रदर्शित" diff --git a/locale/loris.pot b/locale/loris.pot index 0577bf99096..e93866d1337 100644 --- a/locale/loris.pot +++ b/locale/loris.pot @@ -186,6 +186,12 @@ msgstr "" msgid "Hide Advanced Filters" msgstr "" +msgid "Save" +msgstr "" + +msgid "Reset" +msgstr "" + # Data table strings msgid "{{pageCount}} rows displayed of {{totalCount}}." msgstr "" diff --git a/modules/my_preferences/locale/hi/LC_MESSAGES/my_preferences.po b/modules/my_preferences/locale/hi/LC_MESSAGES/my_preferences.po index 3c911f4f212..7ca2001d101 100644 --- a/modules/my_preferences/locale/hi/LC_MESSAGES/my_preferences.po +++ b/modules/my_preferences/locale/hi/LC_MESSAGES/my_preferences.po @@ -44,9 +44,3 @@ msgstr "मेरी जानकारी संपादित करें" msgid "Notifications" msgstr "सूचनाएँ" - -msgid "Save" -msgstr "सहेजें" - -msgid "Reset" -msgstr "रीसेट करें" diff --git a/modules/my_preferences/locale/my_preferences.pot b/modules/my_preferences/locale/my_preferences.pot index 7b0f8795627..65b05b3043a 100644 --- a/modules/my_preferences/locale/my_preferences.pot +++ b/modules/my_preferences/locale/my_preferences.pot @@ -44,9 +44,3 @@ msgstr "" msgid "Notifications" msgstr "" - -msgid "Save" -msgstr "" - -msgid "Reset" -msgstr "" diff --git a/modules/my_preferences/templates/form_my_preferences.tpl b/modules/my_preferences/templates/form_my_preferences.tpl index 4ae950b2e9c..0dbabc9a49f 100644 --- a/modules/my_preferences/templates/form_my_preferences.tpl +++ b/modules/my_preferences/templates/form_my_preferences.tpl @@ -111,10 +111,10 @@
    - +
    - +
    From 41d56c4a92b8a97b75ef0a67001e5d8d311cd449 Mon Sep 17 00:00:00 2001 From: Saket Hatwar Date: Fri, 19 Sep 2025 08:06:02 -0400 Subject: [PATCH 03/10] additional translations --- locale/hi/LC_MESSAGES/loris.po | 6 +- locale/loris.pot | 6 +- .../locale/hi/LC_MESSAGES/my_preferences.po | 66 ++++++++++++++++++- .../my_preferences/locale/my_preferences.pot | 60 +++++++++++++++++ .../php/my_preferences.class.inc | 58 ++++++++-------- 5 files changed, 156 insertions(+), 40 deletions(-) diff --git a/locale/hi/LC_MESSAGES/loris.po b/locale/hi/LC_MESSAGES/loris.po index 1258eec45dd..68187f904dd 100644 --- a/locale/hi/LC_MESSAGES/loris.po +++ b/locale/hi/LC_MESSAGES/loris.po @@ -113,6 +113,9 @@ msgstr "रिपोर्ट्स" msgid "TimePoint" msgstr "समय बिंदु" +msgid "Module" +msgstr "मॉड्यूल" + # Common select option labels msgid "Yes" msgstr "हाँ" @@ -133,9 +136,6 @@ msgstr "दौरे का लेबल" msgid "Site" msgstr "साइट" -msgid "Module" -msgstr "मॉड्यूल" - msgid "Project" msgstr "परियोजना" diff --git a/locale/loris.pot b/locale/loris.pot index e93866d1337..2d706aa8307 100644 --- a/locale/loris.pot +++ b/locale/loris.pot @@ -112,6 +112,9 @@ msgstr "" msgid "TimePoint" msgstr "" +msgid "Module" +msgstr "" + # Common select option labels msgid "Yes" msgstr "" @@ -132,9 +135,6 @@ msgstr "" msgid "Site" msgstr "" -msgid "Module" -msgstr "" - msgid "Project" msgstr "" diff --git a/modules/my_preferences/locale/hi/LC_MESSAGES/my_preferences.po b/modules/my_preferences/locale/hi/LC_MESSAGES/my_preferences.po index 7ca2001d101..98fe439183f 100644 --- a/modules/my_preferences/locale/hi/LC_MESSAGES/my_preferences.po +++ b/modules/my_preferences/locale/hi/LC_MESSAGES/my_preferences.po @@ -22,7 +22,7 @@ msgid "My Preferences" msgstr "मेरी प्राथमिकताएँ" msgid "Password Rules" -msgstr "पासवर्ड के नियम" +msgstr "पासवर्ड नियम" msgid "The password must be at least 8 characters long." msgstr "पासवर्ड कम से कम 8 अक्षरों का होना चाहिए।" @@ -31,16 +31,76 @@ msgid "The password cannot be your username or email address." msgstr "पासवर्ड आपका उपयोगकर्ता नाम या ईमेल पता नहीं हो सकता।" msgid "No special characters are required but your password must be sufficiently complex to be accepted." -msgstr "कोई विशेष अक्षर आवश्यक नहीं हैं, लेकिन पासवर्ड पर्याप्त जटिल होना चाहिए ताकि स्वीकार किया जा सके।" +msgstr "कोई विशेष अक्षर आवश्यक नहीं हैं, लेकिन पासवर्ड पर्याप्त जटिल होना चाहिए ताकि उसे स्वीकार किया जा सके।" msgid "Please choose a unique password." msgstr "कृपया एक अद्वितीय पासवर्ड चुनें।" msgid "We suggest using a password manager to generate one for you." -msgstr "हम सुझाव देते हैं कि आपके लिए पासवर्ड बनाने के लिए पासवर्ड प्रबंधक का उपयोग करें।" +msgstr "हम सुझाव देते हैं कि आपके लिए पासवर्ड बनाने हेतु पासवर्ड मैनेजर का उपयोग करें।" msgid "Edit My Information" msgstr "मेरी जानकारी संपादित करें" msgid "Notifications" msgstr "सूचनाएँ" + +msgid "User name" +msgstr "उपयोगकर्ता नाम" + +msgid "First name" +msgstr "पहला नाम" + +msgid "First name is required and should not exceed 120 characters" +msgstr "पहला नाम आवश्यक है और 120 अक्षरों से अधिक नहीं होना चाहिए।" + +msgid "Last name" +msgstr "अंतिम नाम" + +msgid "Last name is required and should not exceed 120 characters" +msgstr "अंतिम नाम आवश्यक है और 120 अक्षरों से अधिक नहीं होना चाहिए।" + +msgid "Email address" +msgstr "ईमेल पता" + +msgid "Email address is required" +msgstr "ईमेल पता आवश्यक है" + +msgid "Your email address must be less than 255 characters long" +msgstr "आपका ईमेल पता 255 अक्षरों से कम होना चाहिए।" + +msgid "New Password" +msgstr "नया पासवर्ड" + +msgid "Confirm Password" +msgstr "पासवर्ड की पुष्टि करें" + +msgid "Language preference" +msgstr "भाषा वरीयता" + +msgid "Operation" +msgstr "क्रिया" + +msgid "Description" +msgstr "विवरण" + +msgid "N/A" +msgstr "लागू नहीं" + +msgid "Invalid email address" +msgstr "अमान्य ईमेल पता" + +msgid "The email address already exists" +msgstr "ईमेल पता पहले से मौजूद है" + +msgid "Your password cannot be your email." +msgstr "आपका पासवर्ड आपका ईमेल नहीं हो सकता।" + +msgid "Your password cannot be your user name." +msgstr "आपका पासवर्ड आपका उपयोगकर्ता नाम नहीं हो सकता।" + +msgid "The passwords do not match." +msgstr "पासवर्ड मेल नहीं खाते।" + +msgid "New and old passwords are identical: please choose another one" +msgstr "नया और पुराना पासवर्ड समान हैं: कृपया कोई और चुनें।" \ No newline at end of file diff --git a/modules/my_preferences/locale/my_preferences.pot b/modules/my_preferences/locale/my_preferences.pot index 65b05b3043a..77254dfea2f 100644 --- a/modules/my_preferences/locale/my_preferences.pot +++ b/modules/my_preferences/locale/my_preferences.pot @@ -44,3 +44,63 @@ msgstr "" msgid "Notifications" msgstr "" + +msgid "User name" +msgstr "" + +msgid "First name" +msgstr "" + +msgid "First name is required and should not exceed 120 characters" +msgstr "" + +msgid "Last name" +msgstr "" + +msgid "Last name is required and should not exceed 120 characters" +msgstr "" + +msgid "Email address" +msgstr "" + +msgid "Email address is required" +msgstr "" + +msgid "Your email address must be less than 255 characters long" +msgstr "" + +msgid "New Password" +msgstr "" + +msgid "Confirm Password" +msgstr "" + +msgid "Language preference" +msgstr "" + +msgid "Operation" +msgstr "" + +msgid "Description" +msgstr "" + +msgid "N/A" +msgstr "" + +msgid "Invalid email address" +msgstr "" + +msgid "The email address already exists" +msgstr "" + +msgid "Your password cannot be your email." +msgstr "" + +msgid "Your password cannot be your user name." +msgstr "" + +msgid "The passwords do not match." +msgstr "" + +msgid "New and old passwords are identical: please choose another one" +msgstr "" diff --git a/modules/my_preferences/php/my_preferences.class.inc b/modules/my_preferences/php/my_preferences.class.inc index 8ff9e520452..cd853dc9436 100644 --- a/modules/my_preferences/php/my_preferences.class.inc +++ b/modules/my_preferences/php/my_preferences.class.inc @@ -9,12 +9,11 @@ namespace LORIS\my_preferences; */ class My_Preferences extends \NDB_Form { + // Use gettext for error messages private const PASSWORD_ERROR_IS_EMAIL = 'Your password cannot be your email.'; - private const PASSWORD_ERROR_IS_USER = 'Your password cannot be ' . - 'your user name.'; + private const PASSWORD_ERROR_IS_USER = 'Your password cannot be your user name.'; private const PASSWORD_ERROR_NO_MATCH = 'The passwords do not match.'; - private const PASSWORD_ERROR_NO_CHANGE = 'New and old passwords are ' . - 'identical: please choose another one'; + private const PASSWORD_ERROR_NO_CHANGE = 'New and old passwords are identical: please choose another one'; /** * Computes the initial values this page will be filled with. @@ -223,21 +222,19 @@ class My_Preferences extends \NDB_Form //get notification details $notifier_list = \NDB_Notifier::getNotificationModuleServices(); $notifier_services = \NDB_Notifier::getNotificationServices(); - //------------------------------------------------------------ // user name - $this->addScoreColumn('UserID', 'User name'); + $this->addScoreColumn('UserID', dgettext('my_preferences', 'User name')); // full name // The supplied pattern is: // - must have at least one non-whitespace characters (i.e. required) // - once leading and trailing spaces are stripped, the field should // not exceed 120 chars - $firstNameInvalidMsg = "First name is required and " - . "should not exceed 120 characters"; + $firstNameInvalidMsg = dgettext('my_preferences', "First name is required and should not exceed 120 characters"); $this->addBasicText( 'First_name', - 'First name', + dgettext('my_preferences', 'First name'), [], [ 'oninvalid' => "this.setCustomValidity('$firstNameInvalidMsg')", @@ -250,11 +247,10 @@ class My_Preferences extends \NDB_Form // - must have at least one non-whitespace characters (i.e. required) // - once leading and trailing spaces are stripped, the field should // not exceed 120 chars - $lastNameInvalidMsg = "Last name is required and " - . "should not exceed 120 characters"; + $lastNameInvalidMsg = dgettext('my_preferences', "Last name is required and should not exceed 120 characters"); $this->addBasicText( 'Last_name', - 'Last name', + dgettext('my_preferences', 'Last name'), [], [ 'oninvalid' => "this.setCustomValidity('$lastNameInvalidMsg')", @@ -267,36 +263,36 @@ class My_Preferences extends \NDB_Form // email address $this->addBasicText( 'Email', - 'Email address', + dgettext('my_preferences', 'Email address'), [], [ - 'oninvalid' => "this.setCustomValidity('Email address is required')", + 'oninvalid' => "this.setCustomValidity('" . dgettext('my_preferences', 'Email address is required') . "')", 'onchange' => "this.setCustomValidity('')", ] ); // email address rules - $this->addRule('Email', 'Email address is required', 'required'); + $this->addRule('Email', dgettext('my_preferences', 'Email address is required'), 'required'); $this->addRule( 'Email', - 'Your email address must be less than 255 characters long', + dgettext('my_preferences', 'Your email address must be less than 255 characters long'), 'maxlength', "255" ); // password - $this->form->addElement('password', 'Password_hash', 'New Password'); - $this->form->addElement('password', '__Confirm', 'Confirm Password'); + $this->form->addElement('password', 'Password_hash', dgettext('my_preferences', 'New Password')); + $this->form->addElement('password', '__Confirm', dgettext('my_preferences', 'Confirm Password')); // language preference $languages = \Utility::getLanguageList(); - $this->addSelect('language_preference', 'Language preference', $languages); + $this->addSelect('language_preference', dgettext('my_preferences', 'Language preference'), $languages); // Notification headers $nGroup = []; - $nGroup[] = $this->createLabel("Module"); - $nGroup[] = $this->createLabel("Operation"); - $nGroup[] = $this->createLabel("Description"); + $nGroup[] = $this->createLabel(dgettext('my_preferences', "Module")); + $nGroup[] = $this->createLabel(dgettext('my_preferences', "Operation")); + $nGroup[] = $this->createLabel(dgettext('my_preferences', "Description")); foreach ($notifier_services as $serv) { $nGroup[] = $this->createLabel($serv); @@ -337,7 +333,7 @@ class My_Preferences extends \NDB_Form ); } else { $nGroup[] = $this->createLabel( - "N/A" + dgettext('my_preferences', "N/A") ); } @@ -397,18 +393,18 @@ class My_Preferences extends \NDB_Form $plaintext = $values['Password_hash']; if ($values['Email'] === $plaintext) { - $errors['Password_Group'] = self::PASSWORD_ERROR_IS_EMAIL; + $errors['Password_Group'] = dgettext('my_preferences', self::PASSWORD_ERROR_IS_EMAIL); } // Make sure the user is not using their username as their password. if ($this->identifier === $plaintext) { - $errors['Password_Group'] = self::PASSWORD_ERROR_IS_USER; + $errors['Password_Group'] = dgettext('my_preferences', self::PASSWORD_ERROR_IS_USER); } // Ensure that the password and confirm password fields match. // TODO This validation should be done on the front-end instead. if ($values['Password_hash'] !== $values['__Confirm']) { - $errors['Password_Group'] = self::PASSWORD_ERROR_NO_MATCH; + $errors['Password_Group'] = dgettext('my_preferences', self::PASSWORD_ERROR_NO_MATCH); return $errors; } @@ -425,17 +421,17 @@ class My_Preferences extends \NDB_Form $decoded ) ) { - $errors['Password_Group'] = self::PASSWORD_ERROR_NO_CHANGE; + $errors['Password_Group'] = dgettext('my_preferences', self::PASSWORD_ERROR_NO_CHANGE); } } catch (\InvalidArgumentException $e) { - $errors['Password_Group'] = $e->getMessage(); + $errors['Password_Group'] = dgettext('my_preferences', $e->getMessage()); } } // Validate email $emailError = $this->_getEmailError($DB, $values['Email']); if (!is_null($emailError)) { - $errors['Email'] = $emailError; + $errors['Email'] = dgettext('my_preferences', $emailError); } return $errors; @@ -456,7 +452,7 @@ class My_Preferences extends \NDB_Form $email = filter_var($email, FILTER_SANITIZE_EMAIL); if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { // If email not syntactically valid - return "Invalid email address"; + return dgettext('my_preferences', "Invalid email address"); } // check email address' uniqueness @@ -470,7 +466,7 @@ class My_Preferences extends \NDB_Form // Email already exists in database if ($result > 0) { - return 'The email address already exists'; + return dgettext('my_preferences', 'The email address already exists'); } return null; From 5d670ed5750921489f5b3a0257764f5007e1d054 Mon Sep 17 00:00:00 2001 From: Saket Hatwar Date: Fri, 19 Sep 2025 08:31:41 -0400 Subject: [PATCH 04/10] lint --- .../php/my_preferences.class.inc | 47 +++++++++++++------ 1 file changed, 32 insertions(+), 15 deletions(-) diff --git a/modules/my_preferences/php/my_preferences.class.inc b/modules/my_preferences/php/my_preferences.class.inc index cd853dc9436..6ac41112a23 100644 --- a/modules/my_preferences/php/my_preferences.class.inc +++ b/modules/my_preferences/php/my_preferences.class.inc @@ -11,9 +11,11 @@ class My_Preferences extends \NDB_Form { // Use gettext for error messages private const PASSWORD_ERROR_IS_EMAIL = 'Your password cannot be your email.'; - private const PASSWORD_ERROR_IS_USER = 'Your password cannot be your user name.'; + private const PASSWORD_ERROR_IS_USER = + 'Your password cannot be your user name.'; private const PASSWORD_ERROR_NO_MATCH = 'The passwords do not match.'; - private const PASSWORD_ERROR_NO_CHANGE = 'New and old passwords are identical: please choose another one'; + private const PASSWORD_ERROR_NO_CHANGE = + 'New and old passwords are identical: please choose another one'; /** * Computes the initial values this page will be filled with. @@ -231,7 +233,8 @@ class My_Preferences extends \NDB_Form // - must have at least one non-whitespace characters (i.e. required) // - once leading and trailing spaces are stripped, the field should // not exceed 120 chars - $firstNameInvalidMsg = dgettext('my_preferences', "First name is required and should not exceed 120 characters"); + $firstNameInvalidMsg = dgettext('my_preferences', + "First name is required and should not exceed 120 characters"); $this->addBasicText( 'First_name', dgettext('my_preferences', 'First name'), @@ -247,7 +250,8 @@ class My_Preferences extends \NDB_Form // - must have at least one non-whitespace characters (i.e. required) // - once leading and trailing spaces are stripped, the field should // not exceed 120 chars - $lastNameInvalidMsg = dgettext('my_preferences', "Last name is required and should not exceed 120 characters"); + $lastNameInvalidMsg = dgettext('my_preferences', + "Last name is required and should not exceed 120 characters"); $this->addBasicText( 'Last_name', dgettext('my_preferences', 'Last name'), @@ -266,27 +270,35 @@ class My_Preferences extends \NDB_Form dgettext('my_preferences', 'Email address'), [], [ - 'oninvalid' => "this.setCustomValidity('" . dgettext('my_preferences', 'Email address is required') . "')", + 'oninvalid' => "this.setCustomValidity( + '" . dgettext('my_preferences', + 'Email address is required') . "')", 'onchange' => "this.setCustomValidity('')", ] ); // email address rules - $this->addRule('Email', dgettext('my_preferences', 'Email address is required'), 'required'); + $this->addRule('Email', dgettext('my_preferences', + 'Email address is required'), + 'required'); $this->addRule( 'Email', - dgettext('my_preferences', 'Your email address must be less than 255 characters long'), + dgettext('my_preferences', + 'Your email address must be less than 255 characters long'), 'maxlength', "255" ); // password - $this->form->addElement('password', 'Password_hash', dgettext('my_preferences', 'New Password')); - $this->form->addElement('password', '__Confirm', dgettext('my_preferences', 'Confirm Password')); + $this->form->addElement('password', 'Password_hash', + dgettext('my_preferences', 'New Password')); + $this->form->addElement('password', '__Confirm', + dgettext('my_preferences', 'Confirm Password')); // language preference $languages = \Utility::getLanguageList(); - $this->addSelect('language_preference', dgettext('my_preferences', 'Language preference'), $languages); + $this->addSelect('language_preference', dgettext('my_preferences', + 'Language preference'), $languages); // Notification headers $nGroup = []; @@ -393,18 +405,21 @@ class My_Preferences extends \NDB_Form $plaintext = $values['Password_hash']; if ($values['Email'] === $plaintext) { - $errors['Password_Group'] = dgettext('my_preferences', self::PASSWORD_ERROR_IS_EMAIL); + $errors['Password_Group'] = dgettext('my_preferences', + self::PASSWORD_ERROR_IS_EMAIL); } // Make sure the user is not using their username as their password. if ($this->identifier === $plaintext) { - $errors['Password_Group'] = dgettext('my_preferences', self::PASSWORD_ERROR_IS_USER); + $errors['Password_Group'] = dgettext('my_preferences', + self::PASSWORD_ERROR_IS_USER); } // Ensure that the password and confirm password fields match. // TODO This validation should be done on the front-end instead. if ($values['Password_hash'] !== $values['__Confirm']) { - $errors['Password_Group'] = dgettext('my_preferences', self::PASSWORD_ERROR_NO_MATCH); + $errors['Password_Group'] = dgettext('my_preferences', + self::PASSWORD_ERROR_NO_MATCH); return $errors; } @@ -421,10 +436,12 @@ class My_Preferences extends \NDB_Form $decoded ) ) { - $errors['Password_Group'] = dgettext('my_preferences', self::PASSWORD_ERROR_NO_CHANGE); + $errors['Password_Group'] = dgettext('my_preferences', + self::PASSWORD_ERROR_NO_CHANGE); } } catch (\InvalidArgumentException $e) { - $errors['Password_Group'] = dgettext('my_preferences', $e->getMessage()); + $errors['Password_Group'] = dgettext('my_preferences', + $e->getMessage()); } } From c0e0aa522200ed3c5e7006a403c46a1211d45dee Mon Sep 17 00:00:00 2001 From: Saket Hatwar Date: Fri, 19 Sep 2025 08:59:34 -0400 Subject: [PATCH 05/10] lint --- .../php/my_preferences.class.inc | 148 +++++++++++------- 1 file changed, 92 insertions(+), 56 deletions(-) diff --git a/modules/my_preferences/php/my_preferences.class.inc b/modules/my_preferences/php/my_preferences.class.inc index 6ac41112a23..f96bc40fa4c 100644 --- a/modules/my_preferences/php/my_preferences.class.inc +++ b/modules/my_preferences/php/my_preferences.class.inc @@ -1,4 +1,6 @@ -$vals) { + foreach ($defaults['examiner'] as $cid => $vals) { //sets pending approval info - if ($cid=='pending') { + if ($cid == 'pending') { $defaults['examiner_pending'] = $vals; continue; } //gets radiologist Y/N from any of the active sites - if ($vals[0]=='Y') { - if ($vals[1]==='1') { + if ($vals[0] == 'Y') { + if ($vals[1] === '1') { $defaults['examiner_radiologist'] = 'Y'; } else { $defaults['examiner_radiologist'] = 'N'; } } - if ($vals[0]=='Y') { - $defaults['ex_'.$cid] ='on'; + if ($vals[0] == 'Y') { + $defaults['ex_' . $cid] = 'on'; } } @@ -83,13 +85,13 @@ class My_Preferences extends \NDB_Form $curr_sub = \NDB_Notifier::getUserNotificationModuleServices( $user->getId() ); - foreach ($curr_sub as $module=>$operations) { + foreach ($curr_sub as $module => $operations) { foreach ($operations as $operation => $services) { unset($services['desc']); foreach ($services as $service => $subscribed) { - $var_name = "notif_".$module."_".$operation."_".$service; + $var_name = "notif_" . $module . "_" . $operation . "_" . $service; - if ($subscribed==='Y') { + if ($subscribed === 'Y') { $defaults[$var_name] = 'on'; } } @@ -233,8 +235,10 @@ class My_Preferences extends \NDB_Form // - must have at least one non-whitespace characters (i.e. required) // - once leading and trailing spaces are stripped, the field should // not exceed 120 chars - $firstNameInvalidMsg = dgettext('my_preferences', - "First name is required and should not exceed 120 characters"); + $firstNameInvalidMsg = dgettext( + 'my_preferences', + "First name is required and should not exceed 120 characters" + ); $this->addBasicText( 'First_name', dgettext('my_preferences', 'First name'), @@ -250,8 +254,10 @@ class My_Preferences extends \NDB_Form // - must have at least one non-whitespace characters (i.e. required) // - once leading and trailing spaces are stripped, the field should // not exceed 120 chars - $lastNameInvalidMsg = dgettext('my_preferences', - "Last name is required and should not exceed 120 characters"); + $lastNameInvalidMsg = dgettext( + 'my_preferences', + "Last name is required and should not exceed 120 characters" + ); $this->addBasicText( 'Last_name', dgettext('my_preferences', 'Last name'), @@ -271,34 +277,55 @@ class My_Preferences extends \NDB_Form [], [ 'oninvalid' => "this.setCustomValidity( - '" . dgettext('my_preferences', - 'Email address is required') . "')", + '" . dgettext( + 'my_preferences', + 'Email address is required' + ) . "')", 'onchange' => "this.setCustomValidity('')", ] ); // email address rules - $this->addRule('Email', dgettext('my_preferences', - 'Email address is required'), - 'required'); $this->addRule( 'Email', - dgettext('my_preferences', - 'Your email address must be less than 255 characters long'), + dgettext( + 'my_preferences', + 'Email address is required' + ), + 'required' + ); + $this->addRule( + 'Email', + dgettext( + 'my_preferences', + 'Your email address must be less than 255 characters long' + ), 'maxlength', "255" ); // password - $this->form->addElement('password', 'Password_hash', - dgettext('my_preferences', 'New Password')); - $this->form->addElement('password', '__Confirm', - dgettext('my_preferences', 'Confirm Password')); + $this->form->addElement( + 'password', + 'Password_hash', + dgettext('my_preferences', 'New Password') + ); + $this->form->addElement( + 'password', + '__Confirm', + dgettext('my_preferences', 'Confirm Password') + ); // language preference $languages = \Utility::getLanguageList(); - $this->addSelect('language_preference', dgettext('my_preferences', - 'Language preference'), $languages); + $this->addSelect( + 'language_preference', + dgettext( + 'my_preferences', + 'Language preference' + ), + $languages + ); // Notification headers $nGroup = []; @@ -318,9 +345,9 @@ class My_Preferences extends \NDB_Form unset($nGroup); // Notification rows - $notification_rows =[]; - foreach ($notifier_list as $module=>$operation_services) { - foreach ($operation_services as $operation=>$services) { + $notification_rows = []; + foreach ($notifier_list as $module => $operation_services) { + foreach ($operation_services as $operation => $services) { $nGroup = []; $nGroup[] = $this->createLabel($module); $nGroup[] = $this->createLabel($operation); @@ -328,19 +355,19 @@ class My_Preferences extends \NDB_Form unset($services['desc']); // Check for permissions - $display =true; + $display = true; foreach ($services['perm'] as $permission) { if (!$user->hasPermission($permission)) { - $display =false; + $display = false; break; } } unset($services['perm']); - foreach ($services as $service=>$avail) { - if ($avail==='Y' && $display) { + foreach ($services as $service => $avail) { + if ($avail === 'Y' && $display) { $nGroup[] = $this->createCheckbox( - "notif_".$module."_".$operation."_".$service, + "notif_" . $module . "_" . $operation . "_" . $service, "" ); } else { @@ -348,16 +375,15 @@ class My_Preferences extends \NDB_Form dgettext('my_preferences', "N/A") ); } - } $this->addGroup( $nGroup, - "row_".$module."_".$operation, + "row_" . $module . "_" . $operation, '', $this->_GUIDelimiter ); - $notification_rows[] ="row_".$module."_".$operation; + $notification_rows[] = "row_" . $module . "_" . $operation; unset($nGroup); } } @@ -405,21 +431,27 @@ class My_Preferences extends \NDB_Form $plaintext = $values['Password_hash']; if ($values['Email'] === $plaintext) { - $errors['Password_Group'] = dgettext('my_preferences', - self::PASSWORD_ERROR_IS_EMAIL); + $errors['Password_Group'] = dgettext( + 'my_preferences', + self::PASSWORD_ERROR_IS_EMAIL + ); } // Make sure the user is not using their username as their password. if ($this->identifier === $plaintext) { - $errors['Password_Group'] = dgettext('my_preferences', - self::PASSWORD_ERROR_IS_USER); + $errors['Password_Group'] = dgettext( + 'my_preferences', + self::PASSWORD_ERROR_IS_USER + ); } // Ensure that the password and confirm password fields match. // TODO This validation should be done on the front-end instead. if ($values['Password_hash'] !== $values['__Confirm']) { - $errors['Password_Group'] = dgettext('my_preferences', - self::PASSWORD_ERROR_NO_MATCH); + $errors['Password_Group'] = dgettext( + 'my_preferences', + self::PASSWORD_ERROR_NO_MATCH + ); return $errors; } @@ -432,16 +464,21 @@ class My_Preferences extends \NDB_Form $decoded = htmlspecialchars_decode($plaintext); new \Password($decoded); // New password must be different than current one - if (! \User::factory($this->identifier)->isPasswordDifferent( - $decoded - ) + if ( + ! \User::factory($this->identifier)->isPasswordDifferent( + $decoded + ) ) { - $errors['Password_Group'] = dgettext('my_preferences', - self::PASSWORD_ERROR_NO_CHANGE); + $errors['Password_Group'] = dgettext( + 'my_preferences', + self::PASSWORD_ERROR_NO_CHANGE + ); } } catch (\InvalidArgumentException $e) { - $errors['Password_Group'] = dgettext('my_preferences', - $e->getMessage()); + $errors['Password_Group'] = dgettext( + 'my_preferences', + $e->getMessage() + ); } } @@ -529,4 +566,3 @@ class My_Preferences extends \NDB_Form ); } } - From f01c57008aea28d0dc7ca776844abb5ccc97cb3f Mon Sep 17 00:00:00 2001 From: Saket Hatwar Date: Tue, 30 Sep 2025 13:41:28 -0400 Subject: [PATCH 06/10] lint --- .../my_preferences/php/my_preferences.class.inc | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/modules/my_preferences/php/my_preferences.class.inc b/modules/my_preferences/php/my_preferences.class.inc index f96bc40fa4c..de79fb53142 100644 --- a/modules/my_preferences/php/my_preferences.class.inc +++ b/modules/my_preferences/php/my_preferences.class.inc @@ -1,6 +1,4 @@ -identifier)->isPasswordDifferent( - $decoded - ) - ) { + if (! \User::factory($this->identifier)->isPasswordDifferent($decoded)) { $errors['Password_Group'] = dgettext( 'my_preferences', self::PASSWORD_ERROR_NO_CHANGE From 0feec630c13a2d1489fb877c993af6f66de3e43a Mon Sep 17 00:00:00 2001 From: Saket Hatwar Date: Wed, 1 Oct 2025 09:13:04 -0400 Subject: [PATCH 07/10] lint --- .../locale/hi/LC_MESSAGES/my_preferences.po | 4 +- .../my_preferences/locale/my_preferences.pot | 4 +- .../php/my_preferences.class.inc | 37 ++++++++++--------- 3 files changed, 23 insertions(+), 22 deletions(-) diff --git a/modules/my_preferences/locale/hi/LC_MESSAGES/my_preferences.po b/modules/my_preferences/locale/hi/LC_MESSAGES/my_preferences.po index 98fe439183f..c1a9a5fcda1 100644 --- a/modules/my_preferences/locale/hi/LC_MESSAGES/my_preferences.po +++ b/modules/my_preferences/locale/hi/LC_MESSAGES/my_preferences.po @@ -93,10 +93,10 @@ msgstr "अमान्य ईमेल पता" msgid "The email address already exists" msgstr "ईमेल पता पहले से मौजूद है" -msgid "Your password cannot be your email." +msgid "Your password can't be your email." msgstr "आपका पासवर्ड आपका ईमेल नहीं हो सकता।" -msgid "Your password cannot be your user name." +msgid "Your password can't be your username." msgstr "आपका पासवर्ड आपका उपयोगकर्ता नाम नहीं हो सकता।" msgid "The passwords do not match." diff --git a/modules/my_preferences/locale/my_preferences.pot b/modules/my_preferences/locale/my_preferences.pot index 77254dfea2f..a285ba7b9fa 100644 --- a/modules/my_preferences/locale/my_preferences.pot +++ b/modules/my_preferences/locale/my_preferences.pot @@ -93,10 +93,10 @@ msgstr "" msgid "The email address already exists" msgstr "" -msgid "Your password cannot be your email." +msgid "Your password can't be your email." msgstr "" -msgid "Your password cannot be your user name." +msgid "Your password can't be your username." msgstr "" msgid "The passwords do not match." diff --git a/modules/my_preferences/php/my_preferences.class.inc b/modules/my_preferences/php/my_preferences.class.inc index de79fb53142..6049a90bf1a 100644 --- a/modules/my_preferences/php/my_preferences.class.inc +++ b/modules/my_preferences/php/my_preferences.class.inc @@ -10,11 +10,10 @@ namespace LORIS\my_preferences; class My_Preferences extends \NDB_Form { // Use gettext for error messages - private const PASSWORD_ERROR_IS_EMAIL = 'Your password cannot be your email.'; - private const PASSWORD_ERROR_IS_USER = 'Your password cannot be your user name.'; + private const PASSWORD_ERROR_IS_EMAIL = 'Your password can't be your email.'; + private const PASSWORD_ERROR_IS_USER = 'Your password can't be your username.'; private const PASSWORD_ERROR_NO_MATCH = 'The passwords do not match.'; - private const PASSWORD_ERROR_NO_CHANGE - = 'New and old passwords are identical: please choose another one'; + private const PASSWORD_ERROR_NO_CHANGE = 'New and old passwords are identical'; /** * Computes the initial values this page will be filled with. @@ -58,22 +57,22 @@ class My_Preferences extends \NDB_Form } } - foreach ($defaults['examiner'] as $cid => $vals) { + foreach ($defaults['examiner'] as $cid=>$vals) { //sets pending approval info - if ($cid == 'pending') { + if ($cid=='pending') { $defaults['examiner_pending'] = $vals; continue; } //gets radiologist Y/N from any of the active sites - if ($vals[0] == 'Y') { - if ($vals[1] === '1') { + if ($vals[0]=='Y') { + if ($vals[1]==='1') { $defaults['examiner_radiologist'] = 'Y'; } else { $defaults['examiner_radiologist'] = 'N'; } } if ($vals[0] == 'Y') { - $defaults['ex_' . $cid] = 'on'; + $defaults['ex_'.$cid] = 'on'; } } @@ -82,13 +81,14 @@ class My_Preferences extends \NDB_Form $curr_sub = \NDB_Notifier::getUserNotificationModuleServices( $user->getId() ); - foreach ($curr_sub as $module => $operations) { + foreach ($curr_sub as $module=>$operations) { foreach ($operations as $operation => $services) { unset($services['desc']); foreach ($services as $service => $subscribed) { - $var_name = "notif_" . $module . "_" . $operation . "_" . $service; + $var_name + = "notif_".$module."_".$operation."_".$service; - if ($subscribed === 'Y') { + if ($subscribed==='Y') { $defaults[$var_name] = 'on'; } } @@ -342,8 +342,8 @@ class My_Preferences extends \NDB_Form unset($nGroup); // Notification rows - $notification_rows = []; - foreach ($notifier_list as $module => $operation_services) { + $notification_rows =[]; + foreach ($notifier_list as $module=>$operation_services) { foreach ($operation_services as $operation => $services) { $nGroup = []; $nGroup[] = $this->createLabel($module); @@ -364,7 +364,7 @@ class My_Preferences extends \NDB_Form foreach ($services as $service => $avail) { if ($avail === 'Y' && $display) { $nGroup[] = $this->createCheckbox( - "notif_" . $module . "_" . $operation . "_" . $service, + "notif_".$module."_".$operation."_".$service, "" ); } else { @@ -376,11 +376,11 @@ class My_Preferences extends \NDB_Form $this->addGroup( $nGroup, - "row_" . $module . "_" . $operation, + "row_".$module."_".$operation, '', $this->_GUIDelimiter ); - $notification_rows[] = "row_" . $module . "_" . $operation; + $notification_rows[] = "row_".$module."_".$operation; unset($nGroup); } } @@ -461,7 +461,8 @@ class My_Preferences extends \NDB_Form $decoded = htmlspecialchars_decode($plaintext); new \Password($decoded); // New password must be different than current one - if (! \User::factory($this->identifier)->isPasswordDifferent($decoded)) { + if (!\User::factory($this->identifier)->isPasswordDifferent($decoded) + ) { $errors['Password_Group'] = dgettext( 'my_preferences', self::PASSWORD_ERROR_NO_CHANGE From 6321cd0878e8eb425b84a8688c6c7ec06baf6f97 Mon Sep 17 00:00:00 2001 From: Saket Hatwar Date: Tue, 21 Oct 2025 08:44:48 -0400 Subject: [PATCH 08/10] Fixes --- .../my_preferences/locale/hi/LC_MESSAGES/my_preferences.po | 2 +- modules/my_preferences/locale/my_preferences.pot | 4 ++-- modules/my_preferences/php/my_preferences.class.inc | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/my_preferences/locale/hi/LC_MESSAGES/my_preferences.po b/modules/my_preferences/locale/hi/LC_MESSAGES/my_preferences.po index c1a9a5fcda1..71bb118298d 100644 --- a/modules/my_preferences/locale/hi/LC_MESSAGES/my_preferences.po +++ b/modules/my_preferences/locale/hi/LC_MESSAGES/my_preferences.po @@ -96,7 +96,7 @@ msgstr "ईमेल पता पहले से मौजूद है" msgid "Your password can't be your email." msgstr "आपका पासवर्ड आपका ईमेल नहीं हो सकता।" -msgid "Your password can't be your username." +msgid "Your password can't be your username" msgstr "आपका पासवर्ड आपका उपयोगकर्ता नाम नहीं हो सकता।" msgid "The passwords do not match." diff --git a/modules/my_preferences/locale/my_preferences.pot b/modules/my_preferences/locale/my_preferences.pot index a285ba7b9fa..48a9e460436 100644 --- a/modules/my_preferences/locale/my_preferences.pot +++ b/modules/my_preferences/locale/my_preferences.pot @@ -93,10 +93,10 @@ msgstr "" msgid "The email address already exists" msgstr "" -msgid "Your password can't be your email." +msgid "Your password cannot be your email." msgstr "" -msgid "Your password can't be your username." +msgid "Your password cannot be your username" msgstr "" msgid "The passwords do not match." diff --git a/modules/my_preferences/php/my_preferences.class.inc b/modules/my_preferences/php/my_preferences.class.inc index 6049a90bf1a..d7d4a97b955 100644 --- a/modules/my_preferences/php/my_preferences.class.inc +++ b/modules/my_preferences/php/my_preferences.class.inc @@ -10,8 +10,8 @@ namespace LORIS\my_preferences; class My_Preferences extends \NDB_Form { // Use gettext for error messages - private const PASSWORD_ERROR_IS_EMAIL = 'Your password can't be your email.'; - private const PASSWORD_ERROR_IS_USER = 'Your password can't be your username.'; + private const PASSWORD_ERROR_IS_EMAIL = 'Your password cannot be your email.'; + private const PASSWORD_ERROR_IS_USER = 'Your password cannot be your username'; private const PASSWORD_ERROR_NO_MATCH = 'The passwords do not match.'; private const PASSWORD_ERROR_NO_CHANGE = 'New and old passwords are identical'; From df10d8b5565bc0ee07b753643ae007e3acc2a172 Mon Sep 17 00:00:00 2001 From: Saket Hatwar Date: Sun, 26 Oct 2025 09:36:54 -0400 Subject: [PATCH 09/10] fixes2 --- locale/hi/LC_MESSAGES/loris.po | 77 ++++++++++++++++++- locale/loris.pot | 64 +++++++++++++++ .../locale/hi/LC_MESSAGES/my_preferences.po | 61 ++------------- .../my_preferences/locale/my_preferences.pot | 57 +------------- .../php/my_preferences.class.inc | 30 ++++---- .../templates/form_my_preferences.tpl | 12 +-- php/libraries/Password.class.inc | 19 ++++- 7 files changed, 184 insertions(+), 136 deletions(-) diff --git a/locale/hi/LC_MESSAGES/loris.po b/locale/hi/LC_MESSAGES/loris.po index 68187f904dd..64c7f79a078 100644 --- a/locale/hi/LC_MESSAGES/loris.po +++ b/locale/hi/LC_MESSAGES/loris.po @@ -123,6 +123,9 @@ msgstr "हाँ" msgid "No" msgstr "नहीं" +msgid "N/A" +msgstr "लागू नहीं" + # Common candidate terms msgid "PSCID" msgstr "पीएससीआईडी" @@ -200,5 +203,77 @@ msgstr "{{totalCount}} में से {{pageCount}} पंक्तिया msgid "Maximum rows per page:" msgstr "प्रति पृष्ठ अधिकतम पंक्तियाँ:" -msgid "Download Table as CSV" +msgid "Download Data as CSV" msgstr "तालिका को CSV के रूप में डाउनलोड करें" + +#: php/libraries/Password.class.inc +msgid "The password is too short" +msgstr "पासवर्ड बहुत छोटा है" + +msgid "The password is not complex enough." +msgstr "पासवर्ड पर्याप्त जटिल नहीं है।" + +msgid "This password is known to be exposed in online data breaches." +msgstr "यह पासवर्ड ऑनलाइन डेटा उल्लंघनों में उजागर होने के लिए जाना जाता है।" + +msgid "Data Supervisors to Email" +msgstr "ईमेल करने के लिए डेटा पर्यवेक्षक" + +msgid "Invalid email address" +msgstr "अमान्य ईमेल पता" + +# Common strings on widgets +msgid "NEW" +msgstr "नया" + +msgid "Updated" +msgstr "अद्यतन किया गया" + +msgid "Uploaded" +msgstr "अपलोड किया गया" + +# User Account related +msgid "Password Rules" +msgstr "पासवर्ड नियम" + +msgid "Username" +msgstr "उपयोगकर्ता नाम" + +msgid "First name" +msgstr "पहला नाम" + +msgid "First name is required and should not exceed 120 characters" +msgstr "पहला नाम आवश्यक है और 120 अक्षरों से अधिक नहीं होना चाहिए।" + +msgid "Last name" +msgstr "अंतिम नाम" + +msgid "Last name is required and should not exceed 120 characters" +msgstr "अंतिम नाम आवश्यक है और 120 अक्षरों से अधिक नहीं होना चाहिए।" + +msgid "Email address" +msgstr "ईमेल पता" + +msgid "New Password" +msgstr "नया पासवर्ड" + +msgid "Confirm Password" +msgstr "पासवर्ड की पुष्टि करें" + +msgid "Email address is required" +msgstr "ईमेल पता आवश्यक है" + +msgid "The password must be at least 8 characters long." +msgstr "पासवर्ड कम से कम 8 अक्षरों का होना चाहिए।" + +msgid "The password cannot be your username or email address." +msgstr "पासवर्ड आपका उपयोगकर्ता नाम या ईमेल पता नहीं हो सकता।" + +msgid "Please choose a unique password." +msgstr "कृपया एक अद्वितीय पासवर्ड चुनें।" + +msgid "No special characters are required but your password must be sufficiently complex to be accepted." +msgstr "कोई विशेष अक्षर आवश्यक नहीं हैं, लेकिन पासवर्ड पर्याप्त जटिल होना चाहिए ताकि उसे स्वीकार किया जा सके।" + +msgid "We suggest using a password manager to generate one for you." +msgstr "हम सुझाव देते हैं कि आपके लिए पासवर्ड बनाने हेतु पासवर्ड मैनेजर का उपयोग करें।" \ No newline at end of file diff --git a/locale/loris.pot b/locale/loris.pot index 2d706aa8307..b97b4d68d9d 100644 --- a/locale/loris.pot +++ b/locale/loris.pot @@ -122,6 +122,9 @@ msgstr "" msgid "No" msgstr "" +msgid "N/A" +msgstr "" + # Common candidate terms msgid "PSCID" msgstr "" @@ -202,6 +205,22 @@ msgstr "" msgid "Download Table as CSV" msgstr "" +#: php/libraries/Password.class.inc +msgid "The password is too short" +msgstr "" + +msgid "The password is not complex enough." +msgstr "" + +msgid "This password is known to be exposed in online data breaches." +msgstr "" + +msgid "Data Supervisors to Email" +msgstr "" + +msgid "Invalid email address" +msgstr "" + # Common strings on widgets msgid "NEW" msgstr "" @@ -212,3 +231,48 @@ msgstr "" msgid "Uploaded" msgstr "" +# User Account related +msgid "Password Rules" +msgstr "" + +msgid "Username" +msgstr "" + +msgid "First name" +msgstr "" + +msgid "First name is required and should not exceed 120 characters" +msgstr "" + +msgid "Last name" +msgstr "" + +msgid "Last name is required and should not exceed 120 characters" +msgstr "" + +msgid "Email address" +msgstr "" + +msgid "New Password" +msgstr "" + +msgid "Confirm Password" +msgstr "" + +msgid "Email address is required" +msgstr "" + +msgid "The password must be at least 8 characters long." +msgstr "" + +msgid "The password cannot be your username or email address." +msgstr "" + +msgid "Please choose a unique password." +msgstr "" + +msgid "No special characters are required but your password must be sufficiently complex to be accepted." +msgstr "" + +msgid "We suggest using a password manager to generate one for you." +msgstr "" \ No newline at end of file diff --git a/modules/my_preferences/locale/hi/LC_MESSAGES/my_preferences.po b/modules/my_preferences/locale/hi/LC_MESSAGES/my_preferences.po index 71bb118298d..8b54649b398 100644 --- a/modules/my_preferences/locale/hi/LC_MESSAGES/my_preferences.po +++ b/modules/my_preferences/locale/hi/LC_MESSAGES/my_preferences.po @@ -21,60 +21,15 @@ msgstr "" msgid "My Preferences" msgstr "मेरी प्राथमिकताएँ" -msgid "Password Rules" -msgstr "पासवर्ड नियम" - -msgid "The password must be at least 8 characters long." -msgstr "पासवर्ड कम से कम 8 अक्षरों का होना चाहिए।" - -msgid "The password cannot be your username or email address." -msgstr "पासवर्ड आपका उपयोगकर्ता नाम या ईमेल पता नहीं हो सकता।" - -msgid "No special characters are required but your password must be sufficiently complex to be accepted." -msgstr "कोई विशेष अक्षर आवश्यक नहीं हैं, लेकिन पासवर्ड पर्याप्त जटिल होना चाहिए ताकि उसे स्वीकार किया जा सके।" - -msgid "Please choose a unique password." -msgstr "कृपया एक अद्वितीय पासवर्ड चुनें।" - -msgid "We suggest using a password manager to generate one for you." -msgstr "हम सुझाव देते हैं कि आपके लिए पासवर्ड बनाने हेतु पासवर्ड मैनेजर का उपयोग करें।" - msgid "Edit My Information" msgstr "मेरी जानकारी संपादित करें" msgid "Notifications" msgstr "सूचनाएँ" -msgid "User name" -msgstr "उपयोगकर्ता नाम" - -msgid "First name" -msgstr "पहला नाम" - -msgid "First name is required and should not exceed 120 characters" -msgstr "पहला नाम आवश्यक है और 120 अक्षरों से अधिक नहीं होना चाहिए।" - -msgid "Last name" -msgstr "अंतिम नाम" - -msgid "Last name is required and should not exceed 120 characters" -msgstr "अंतिम नाम आवश्यक है और 120 अक्षरों से अधिक नहीं होना चाहिए।" - -msgid "Email address" -msgstr "ईमेल पता" - -msgid "Email address is required" -msgstr "ईमेल पता आवश्यक है" - msgid "Your email address must be less than 255 characters long" msgstr "आपका ईमेल पता 255 अक्षरों से कम होना चाहिए।" -msgid "New Password" -msgstr "नया पासवर्ड" - -msgid "Confirm Password" -msgstr "पासवर्ड की पुष्टि करें" - msgid "Language preference" msgstr "भाषा वरीयता" @@ -84,23 +39,17 @@ msgstr "क्रिया" msgid "Description" msgstr "विवरण" -msgid "N/A" -msgstr "लागू नहीं" - -msgid "Invalid email address" -msgstr "अमान्य ईमेल पता" - msgid "The email address already exists" msgstr "ईमेल पता पहले से मौजूद है" -msgid "Your password can't be your email." +msgid "Your password cannot be your email" msgstr "आपका पासवर्ड आपका ईमेल नहीं हो सकता।" -msgid "Your password can't be your username" +msgid "Your password cannot be your username" msgstr "आपका पासवर्ड आपका उपयोगकर्ता नाम नहीं हो सकता।" -msgid "The passwords do not match." +msgid "The passwords do not match" msgstr "पासवर्ड मेल नहीं खाते।" -msgid "New and old passwords are identical: please choose another one" -msgstr "नया और पुराना पासवर्ड समान हैं: कृपया कोई और चुनें।" \ No newline at end of file +msgid "New and old passwords are identical" +msgstr "नया और पुराना पासवर्ड समान हैं।" \ No newline at end of file diff --git a/modules/my_preferences/locale/my_preferences.pot b/modules/my_preferences/locale/my_preferences.pot index 48a9e460436..b83fd0bb954 100644 --- a/modules/my_preferences/locale/my_preferences.pot +++ b/modules/my_preferences/locale/my_preferences.pot @@ -21,60 +21,15 @@ msgstr "" msgid "My Preferences" msgstr "" -msgid "Password Rules" -msgstr "" - -msgid "The password must be at least 8 characters long." -msgstr "" - -msgid "The password cannot be your username or email address." -msgstr "" - -msgid "No special characters are required but your password must be sufficiently complex to be accepted." -msgstr "" - -msgid "Please choose a unique password." -msgstr "" - -msgid "We suggest using a password manager to generate one for you." -msgstr "" - msgid "Edit My Information" msgstr "" msgid "Notifications" msgstr "" -msgid "User name" -msgstr "" - -msgid "First name" -msgstr "" - -msgid "First name is required and should not exceed 120 characters" -msgstr "" - -msgid "Last name" -msgstr "" - -msgid "Last name is required and should not exceed 120 characters" -msgstr "" - -msgid "Email address" -msgstr "" - -msgid "Email address is required" -msgstr "" - msgid "Your email address must be less than 255 characters long" msgstr "" -msgid "New Password" -msgstr "" - -msgid "Confirm Password" -msgstr "" - msgid "Language preference" msgstr "" @@ -84,23 +39,17 @@ msgstr "" msgid "Description" msgstr "" -msgid "N/A" -msgstr "" - -msgid "Invalid email address" -msgstr "" - msgid "The email address already exists" msgstr "" -msgid "Your password cannot be your email." +msgid "Your password cannot be your email" msgstr "" msgid "Your password cannot be your username" msgstr "" -msgid "The passwords do not match." +msgid "The passwords do not match" msgstr "" -msgid "New and old passwords are identical: please choose another one" +msgid "New and old passwords are identical" msgstr "" diff --git a/modules/my_preferences/php/my_preferences.class.inc b/modules/my_preferences/php/my_preferences.class.inc index d7d4a97b955..f1ac6509250 100644 --- a/modules/my_preferences/php/my_preferences.class.inc +++ b/modules/my_preferences/php/my_preferences.class.inc @@ -10,9 +10,9 @@ namespace LORIS\my_preferences; class My_Preferences extends \NDB_Form { // Use gettext for error messages - private const PASSWORD_ERROR_IS_EMAIL = 'Your password cannot be your email.'; + private const PASSWORD_ERROR_IS_EMAIL = 'Your password cannot be your email'; private const PASSWORD_ERROR_IS_USER = 'Your password cannot be your username'; - private const PASSWORD_ERROR_NO_MATCH = 'The passwords do not match.'; + private const PASSWORD_ERROR_NO_MATCH = 'The passwords do not match'; private const PASSWORD_ERROR_NO_CHANGE = 'New and old passwords are identical'; /** @@ -225,7 +225,7 @@ class My_Preferences extends \NDB_Form $notifier_services = \NDB_Notifier::getNotificationServices(); // user name - $this->addScoreColumn('UserID', dgettext('my_preferences', 'User name')); + $this->addScoreColumn('UserID', dgettext('loris', 'Username')); // full name // The supplied pattern is: @@ -233,12 +233,12 @@ class My_Preferences extends \NDB_Form // - once leading and trailing spaces are stripped, the field should // not exceed 120 chars $firstNameInvalidMsg = dgettext( - 'my_preferences', + 'loris', "First name is required and should not exceed 120 characters" ); $this->addBasicText( 'First_name', - dgettext('my_preferences', 'First name'), + dgettext('loris', 'First name'), [], [ 'oninvalid' => "this.setCustomValidity('$firstNameInvalidMsg')", @@ -252,12 +252,12 @@ class My_Preferences extends \NDB_Form // - once leading and trailing spaces are stripped, the field should // not exceed 120 chars $lastNameInvalidMsg = dgettext( - 'my_preferences', + 'loris', "Last name is required and should not exceed 120 characters" ); $this->addBasicText( 'Last_name', - dgettext('my_preferences', 'Last name'), + dgettext('loris', 'Last name'), [], [ 'oninvalid' => "this.setCustomValidity('$lastNameInvalidMsg')", @@ -270,12 +270,12 @@ class My_Preferences extends \NDB_Form // email address $this->addBasicText( 'Email', - dgettext('my_preferences', 'Email address'), + dgettext('loris', 'Email address'), [], [ 'oninvalid' => "this.setCustomValidity( '" . dgettext( - 'my_preferences', + 'loris', 'Email address is required' ) . "')", 'onchange' => "this.setCustomValidity('')", @@ -286,7 +286,7 @@ class My_Preferences extends \NDB_Form $this->addRule( 'Email', dgettext( - 'my_preferences', + 'loris', 'Email address is required' ), 'required' @@ -305,12 +305,12 @@ class My_Preferences extends \NDB_Form $this->form->addElement( 'password', 'Password_hash', - dgettext('my_preferences', 'New Password') + dgettext('loris', 'New Password') ); $this->form->addElement( 'password', '__Confirm', - dgettext('my_preferences', 'Confirm Password') + dgettext('loris', 'Confirm Password') ); // language preference @@ -326,7 +326,7 @@ class My_Preferences extends \NDB_Form // Notification headers $nGroup = []; - $nGroup[] = $this->createLabel(dgettext('my_preferences', "Module")); + $nGroup[] = $this->createLabel(dgettext('loris', "Module")); $nGroup[] = $this->createLabel(dgettext('my_preferences', "Operation")); $nGroup[] = $this->createLabel(dgettext('my_preferences', "Description")); @@ -369,7 +369,7 @@ class My_Preferences extends \NDB_Form ); } else { $nGroup[] = $this->createLabel( - dgettext('my_preferences', "N/A") + dgettext('loris', "N/A") ); } } @@ -500,7 +500,7 @@ class My_Preferences extends \NDB_Form $email = filter_var($email, FILTER_SANITIZE_EMAIL); if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { // If email not syntactically valid - return dgettext('my_preferences', "Invalid email address"); + return dgettext('loris', "Invalid email address"); } // check email address' uniqueness diff --git a/modules/my_preferences/templates/form_my_preferences.tpl b/modules/my_preferences/templates/form_my_preferences.tpl index 0dbabc9a49f..437bf525ba9 100644 --- a/modules/my_preferences/templates/form_my_preferences.tpl +++ b/modules/my_preferences/templates/form_my_preferences.tpl @@ -1,12 +1,12 @@
    -

    {dgettext("my_preferences", "Password Rules")}

    +

    {dgettext("loris", "Password Rules")}

      -
    • {dgettext("my_preferences", "The password must be at least 8 characters long.")}
    • -
    • {dgettext("my_preferences", "The password cannot be your username or email address.")}
    • -
    • {dgettext("my_preferences", "No special characters are required but your password must be sufficiently complex to be accepted.")}
    • +
    • {dgettext("loris", "The password must be at least 8 characters long.")}
    • +
    • {dgettext("loris", "The password cannot be your username or email address.")}
    • +
    • {dgettext("loris", "No special characters are required but your password must be sufficiently complex to be accepted.")}
    -

    {dgettext("my_preferences", "Please choose a unique password.")}

    -

    {dgettext("my_preferences", "We suggest using a password manager to generate one for you.")}

    +

    {dgettext("loris", "Please choose a unique password.")}

    +

    {dgettext("loris", "We suggest using a password manager to generate one for you.")}

    {dgettext("my_preferences", "Edit My Information")}

    {foreach from=$form.errors item=error}
      diff --git a/php/libraries/Password.class.inc b/php/libraries/Password.class.inc index 31f4997234a..e3f676ab497 100644 --- a/php/libraries/Password.class.inc +++ b/php/libraries/Password.class.inc @@ -105,11 +105,19 @@ class Password // Check length and complexity separately in order to return a precise // error message upon failure. if (!$this->_hasSufficientLength($value)) { - throw new \InvalidArgumentException('The password is too short'); + throw new \InvalidArgumentException( + dgettext( + 'loris', + 'The password is too short' + ) + ); } if (!$this->_hasSufficientComplexity($value)) { throw new \InvalidArgumentException( - 'The password is not complex enough.' + dgettext( + 'loris', + 'The password is not complex enough.' + ) ); } if (\NDB_Factory::singleton()->config()->settingEnabled( @@ -118,8 +126,11 @@ class Password ) { if ($this->_pwned($value)) { throw new \InvalidArgumentException( - 'This password is known to be exposed in online data ' - . 'breaches.' + dgettext( + 'loris', + 'This password is known to be exposed in online data' + . ' breaches.' + ) ); } } From 6c63c90a2fea62517ce3347ae322b5b8e66c2d01 Mon Sep 17 00:00:00 2001 From: T Saket Hatwar <112693309+SKADE2303@users.noreply.github.com> Date: Thu, 30 Oct 2025 02:39:23 +0530 Subject: [PATCH 10/10] Add Module String --- locale/loris.pot | 3 +++ 1 file changed, 3 insertions(+) diff --git a/locale/loris.pot b/locale/loris.pot index 6f44f5b08f0..d6c467ab0ff 100644 --- a/locale/loris.pot +++ b/locale/loris.pot @@ -170,6 +170,9 @@ msgstr "" msgid "Site" msgstr "" +msgid "Module" +msgstr "" + msgid "Project" msgstr ""