Skip to content

Commit cf0ec2f

Browse files
authored
feat: Change default language to English (#318)
- Changed all the default python and html language messages to English - Created new babel translations file of Hebrew language - Fixed disabling mail system
1 parent c6155ac commit cf0ec2f

File tree

31 files changed

+673
-682
lines changed

31 files changed

+673
-682
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ After logging in, use [localhost admin](https://127.0.0.1:8080/admin) to modify
8282
In case you want to enable the mail system:
8383

8484
1. Insert your mail details in the configuration file.
85-
2. Delete the `DISABLE_MAIL` line.
85+
2. Change the `DISABLE_MAIL` line value to False.
8686

8787

8888
## Code modification check list

lms/lmsdb/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -733,7 +733,7 @@ def get_by_exercise(cls, exercise: Exercise):
733733

734734
class ExerciseTestName(BaseModel):
735735
FATAL_TEST_NAME = 'fatal_test_failure'
736-
FATAL_TEST_PRETTY_TEST_NAME = _('כישלון חמור')
736+
FATAL_TEST_PRETTY_TEST_NAME = _('Fatal error')
737737

738738
exercise_test = ForeignKeyField(model=ExerciseTest)
739739
test_name = TextField()

lms/lmstests/public/identical_tests/services.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ def _clone_solution_comments(
101101
user=to_solution.solver,
102102
related_id=to_solution,
103103
message=_(
104-
'הפתרון שלך לתרגיל %(subject)s נבדק.',
104+
'Your solution for the %(subject)s exercise has been checked.',
105105
subject=to_solution.exercise.subject,
106106
),
107107
action_url=f'{routes.SOLUTIONS}/{to_solution.id}',

lms/lmstests/public/linters/services.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,8 @@ def _fire_notification_if_needed(self):
9393
errors_len = len(self._errors)
9494
exercise_name = self.solution.exercise.subject
9595
msg = _(
96-
'הבודק האוטומטי נתן %(errors_num)d הערות על תרגילך %(name)s.',
96+
'The automatic checker gave you %(errors_num)d for your '
97+
'%(name)s solution.',
9798
errors_num=errors_len, name=exercise_name,
9899
)
99100
return notifications.send(

lms/lmstests/public/unittests/services.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414

1515
NumberOfErrors = int
16-
CANT_EXECUTE_CODE_MESSAGE = _('הבודק האוטומטי לא הצליח להריץ את הקוד שלך.')
16+
CANT_EXECUTE_CODE_MESSAGE = _("The automatic checker couldn't run your code.")
1717

1818

1919
class UnitTestChecker:
@@ -118,7 +118,8 @@ def _populate_junit_results(self, raw_results: bytes) -> None:
118118
return None
119119

120120
fail_message = _(
121-
'הבודק האוטומטי נכשל ב־ %(number)d דוגמאות בתרגיל "%(subject)s".',
121+
'The automatic checker failed in %(number)d examples in your '
122+
'"%(subject)s" solution.',
122123
number=number_of_failures,
123124
subject=self._solution.exercise.subject,
124125
)
@@ -138,7 +139,7 @@ def _handle_failed_to_execute_tests(self, raw_results: bytes) -> None:
138139
solution=self._solution,
139140
test_name=models.ExerciseTestName.FATAL_TEST_NAME,
140141
user_message=fail_user_message,
141-
staff_message=_('אחי, בדקת את הקוד שלך?'),
142+
staff_message=_('Bro, did you check your code?'),
142143
)
143144
notifications.send(
144145
kind=notifications.NotificationKind.UNITTEST_ERROR,

lms/lmstests/sandbox/linters/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class LinterError(typing.NamedTuple):
1313
solution_file_id: str
1414

1515

16-
CANT_EXECUTE_CODE_MESSAGE = _('הבודק האוטומטי לא הצליח להריץ את הקוד שלך.')
16+
CANT_EXECUTE_CODE_MESSAGE = _("The automatic checker couldn't run your code.")
1717

1818

1919
class BaseLinter:

lms/lmsweb/config.py.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ MAIL_USE_TLS = False
2222
MAIL_USERNAME = 'username@gmail.com'
2323
MAIL_PASSWORD = 'password'
2424
MAIL_DEFAULT_SENDER = 'username@gmail.com'
25-
DISABLE_MAIL = True # On production, delete this line!
25+
DISABLE_MAIL = True # On production, change this value to False!
2626

2727
# ADMIN PANEL
2828
FLASK_ADMIN_FLUID_LAYOUT = True

lms/lmsweb/forms/change_password.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class ChangePasswordForm(FlaskForm):
1717
confirm = PasswordField(
1818
'Password Confirmation', validators=[
1919
InputRequired(),
20-
EqualTo('password', message=_('הסיסמאות שהוקלדו אינן זהות')),
20+
EqualTo('password', message=_('The passwords are not identical')),
2121
],
2222
)
2323

@@ -27,7 +27,9 @@ def __init__(self, user, *args, **kwargs):
2727

2828
def validate_current_password(self, field):
2929
if session['_invalid_password_tries'] >= MAX_INVALID_PASSWORD_TRIES:
30-
raise ValidationError(_('הזנת סיסמה שגויה מספר רב מדי של פעמים'))
30+
raise ValidationError(
31+
_('Invalid old password has been inserted too many times'),
32+
)
3133
if not self.user.is_password_valid(field.data):
3234
session['_invalid_password_tries'] += 1
33-
raise ValidationError(_('הסיסמה הנוכחית שהוזנה שגויה'))
35+
raise ValidationError(_('Invalid current password'))

lms/lmsweb/forms/register.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
class RegisterForm(FlaskForm):
1212
email = StringField(
1313
'Email', validators=[
14-
InputRequired(), Email(message=_('אימייל לא תקין')),
14+
InputRequired(), Email(message=_('Invalid email')),
1515
UniqueEmailRequired,
1616
],
1717
)
@@ -29,6 +29,6 @@ class RegisterForm(FlaskForm):
2929
confirm = PasswordField(
3030
'Password Confirmation', validators=[
3131
InputRequired(),
32-
EqualTo('password', message=_('הסיסמאות שהוקלדו אינן זהות')),
32+
EqualTo('password', message=_('The passwords are not identical')),
3333
],
3434
)

lms/lmsweb/forms/reset_password.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
class ResetPassForm(FlaskForm):
1010
email = StringField(
1111
'Email', validators=[
12-
InputRequired(), Email(message=_('אימייל לא תקין')),
12+
InputRequired(), Email(message=_('Invalid email')),
1313
EmailNotExists,
1414
],
1515
)
@@ -22,6 +22,6 @@ class RecoverPassForm(FlaskForm):
2222
confirm = PasswordField(
2323
'Password Confirmation', validators=[
2424
InputRequired(),
25-
EqualTo('password', message=_('הסיסמאות שהוקלדו אינן זהות')),
25+
EqualTo('password', message=_('The passwords are not identical')),
2626
],
2727
)

lms/lmsweb/tools/validators.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,20 @@ def UniqueUsernameRequired(
1010
) -> None:
1111
username_exists = User.get_or_none(User.username == field.data)
1212
if username_exists:
13-
raise ValidationError(_('שם המשתמש כבר נמצא בשימוש'))
13+
raise ValidationError(_('The username is already in use'))
1414

1515

1616
def UniqueEmailRequired(
1717
_form: 'RegisterForm', field: StringField, # type: ignore # NOQA: F821
1818
) -> None:
1919
email_exists = User.get_or_none(User.mail_address == field.data)
2020
if email_exists:
21-
raise ValidationError(_('האימייל כבר נמצא בשימוש'))
21+
raise ValidationError(_('The email is already in use'))
2222

2323

2424
def EmailNotExists(
2525
_form: 'ResetPassForm', field: StringField, # type: ignore # NOQA: F821
2626
) -> None:
2727
email_exists = User.get_or_none(User.mail_address == field.data)
2828
if not email_exists:
29-
raise ValidationError(_('האימייל לא רשום במערכת'))
29+
raise ValidationError(_('Invalid email'))

0 commit comments

Comments
 (0)