Skip to content

feat: Change default language to English #318

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ After logging in, use [localhost admin](https://127.0.0.1:8080/admin) to modify
In case you want to enable the mail system:

1. Insert your mail details in the configuration file.
2. Delete the `DISABLE_MAIL` line.
2. Change the `DISABLE_MAIL` line value to False.


## Code modification check list
Expand Down
2 changes: 1 addition & 1 deletion lms/lmsdb/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -733,7 +733,7 @@ def get_by_exercise(cls, exercise: Exercise):

class ExerciseTestName(BaseModel):
FATAL_TEST_NAME = 'fatal_test_failure'
FATAL_TEST_PRETTY_TEST_NAME = _('כישלון חמור')
FATAL_TEST_PRETTY_TEST_NAME = _('Fatal error')

exercise_test = ForeignKeyField(model=ExerciseTest)
test_name = TextField()
Expand Down
2 changes: 1 addition & 1 deletion lms/lmstests/public/identical_tests/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def _clone_solution_comments(
user=to_solution.solver,
related_id=to_solution,
message=_(
'הפתרון שלך לתרגיל %(subject)s נבדק.',
'Your solution for the %(subject)s exercise has been checked.',
subject=to_solution.exercise.subject,
),
action_url=f'{routes.SOLUTIONS}/{to_solution.id}',
Expand Down
3 changes: 2 additions & 1 deletion lms/lmstests/public/linters/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ def _fire_notification_if_needed(self):
errors_len = len(self._errors)
exercise_name = self.solution.exercise.subject
msg = _(
'הבודק האוטומטי נתן %(errors_num)d הערות על תרגילך %(name)s.',
'The automatic checker gave you %(errors_num)d for your '
'%(name)s solution.',
errors_num=errors_len, name=exercise_name,
)
return notifications.send(
Expand Down
7 changes: 4 additions & 3 deletions lms/lmstests/public/unittests/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@


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


class UnitTestChecker:
Expand Down Expand Up @@ -118,7 +118,8 @@ def _populate_junit_results(self, raw_results: bytes) -> None:
return None

fail_message = _(
'הבודק האוטומטי נכשל ב־ %(number)d דוגמאות בתרגיל "%(subject)s".',
'The automatic checker failed in %(number)d examples in your '
'"%(subject)s" solution.',
number=number_of_failures,
subject=self._solution.exercise.subject,
)
Expand All @@ -138,7 +139,7 @@ def _handle_failed_to_execute_tests(self, raw_results: bytes) -> None:
solution=self._solution,
test_name=models.ExerciseTestName.FATAL_TEST_NAME,
user_message=fail_user_message,
staff_message=_('אחי, בדקת את הקוד שלך?'),
staff_message=_('Bro, did you check your code?'),
)
notifications.send(
kind=notifications.NotificationKind.UNITTEST_ERROR,
Expand Down
2 changes: 1 addition & 1 deletion lms/lmstests/sandbox/linters/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class LinterError(typing.NamedTuple):
solution_file_id: str


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


class BaseLinter:
Expand Down
2 changes: 1 addition & 1 deletion lms/lmsweb/config.py.example
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ MAIL_USE_TLS = False
MAIL_USERNAME = 'username@gmail.com'
MAIL_PASSWORD = 'password'
MAIL_DEFAULT_SENDER = 'username@gmail.com'
DISABLE_MAIL = True # On production, delete this line!
DISABLE_MAIL = True # On production, change this value to False!

# ADMIN PANEL
FLASK_ADMIN_FLUID_LAYOUT = True
Expand Down
8 changes: 5 additions & 3 deletions lms/lmsweb/forms/change_password.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class ChangePasswordForm(FlaskForm):
confirm = PasswordField(
'Password Confirmation', validators=[
InputRequired(),
EqualTo('password', message=_('הסיסמאות שהוקלדו אינן זהות')),
EqualTo('password', message=_('The passwords are not identical')),
],
)

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

def validate_current_password(self, field):
if session['_invalid_password_tries'] >= MAX_INVALID_PASSWORD_TRIES:
raise ValidationError(_('הזנת סיסמה שגויה מספר רב מדי של פעמים'))
raise ValidationError(
_('Invalid old password has been inserted too many times'),
)
if not self.user.is_password_valid(field.data):
session['_invalid_password_tries'] += 1
raise ValidationError(_('הסיסמה הנוכחית שהוזנה שגויה'))
raise ValidationError(_('Invalid current password'))
4 changes: 2 additions & 2 deletions lms/lmsweb/forms/register.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
class RegisterForm(FlaskForm):
email = StringField(
'Email', validators=[
InputRequired(), Email(message=_('אימייל לא תקין')),
InputRequired(), Email(message=_('Invalid email')),
UniqueEmailRequired,
],
)
Expand All @@ -29,6 +29,6 @@ class RegisterForm(FlaskForm):
confirm = PasswordField(
'Password Confirmation', validators=[
InputRequired(),
EqualTo('password', message=_('הסיסמאות שהוקלדו אינן זהות')),
EqualTo('password', message=_('The passwords are not identical')),
],
)
4 changes: 2 additions & 2 deletions lms/lmsweb/forms/reset_password.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
class ResetPassForm(FlaskForm):
email = StringField(
'Email', validators=[
InputRequired(), Email(message=_('אימייל לא תקין')),
InputRequired(), Email(message=_('Invalid email')),
EmailNotExists,
],
)
Expand All @@ -22,6 +22,6 @@ class RecoverPassForm(FlaskForm):
confirm = PasswordField(
'Password Confirmation', validators=[
InputRequired(),
EqualTo('password', message=_('הסיסמאות שהוקלדו אינן זהות')),
EqualTo('password', message=_('The passwords are not identical')),
],
)
6 changes: 3 additions & 3 deletions lms/lmsweb/tools/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,20 @@ def UniqueUsernameRequired(
) -> None:
username_exists = User.get_or_none(User.username == field.data)
if username_exists:
raise ValidationError(_('שם המשתמש כבר נמצא בשימוש'))
raise ValidationError(_('The username is already in use'))


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


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