Skip to content
This repository has been archived by the owner on May 12, 2022. It is now read-only.

Hamzamunir/yonk 1136 b #182

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
12 changes: 12 additions & 0 deletions edx_notifications/base_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import dateutil.parser
import copy
from datetime import datetime, timedelta
from django.utils.translation import ugettext_lazy
from freezegun.api import FakeDatetime


Expand Down Expand Up @@ -59,6 +60,8 @@ def __init__(self, *args, **kwargs): # pylint: disable=unused-argument
Initializer which takes in the type this field
should be set it is set
"""
# from django.utils.functional import __proxy__
# self._expected_types.append(__proxy__)

if not self._expected_types:
raise TypeError(
Expand Down Expand Up @@ -99,6 +102,7 @@ def __set__(self, data_object, value):
value_type = type(value)

if value and value_type not in self._expected_types:

raise TypeError(
(
"Field expected type of '{expected}' got '{got}'"
Expand Down Expand Up @@ -129,6 +133,14 @@ class StringField(TypedField):
_expected_types = [unicode, str]


class LazyField(TypedField):
"""
Specialized subclass of TypedField(unicode) as a convienence for Translations support
"""

_expected_types = [unicode, str, type(ugettext_lazy())]


class IntegerField(TypedField):
"""
Specialized subclass of TypedField(int) as a convienence
Expand Down
11 changes: 6 additions & 5 deletions edx_notifications/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"""

from django.conf import settings
from django.utils.translation import ugettext_lazy as _

NOTIFICATION_PRIORITY_NONE = 0
NOTIFICATION_PRIORITY_LOW = 1
Expand Down Expand Up @@ -99,27 +100,27 @@
'groups': {
'announcements': {
'name': 'announcements',
'display_name': 'Announcements',
'display_name': _('Announcements'),
'group_order': 1
},
'group_work': {
'name': 'group_work',
'display_name': 'Group Work',
'display_name': _('Group Work'),
'group_order': 2
},
'leaderboards': {
'name': 'leaderboards',
'display_name': 'Leaderboards',
'display_name': _('Leaderboards'),
'group_order': 3
},
'discussions': {
'name': 'discussions',
'display_name': 'Discussion',
'display_name': _('Discussion'),
'group_order': 4
},
'_default': {
'name': '_default',
'display_name': 'Other',
'display_name': _('Other'),
'group_order': 5
},
},
Expand Down
14 changes: 7 additions & 7 deletions edx_notifications/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
RelatedObjectField,
BaseDataObject,
BooleanField,
)
LazyField)


class NotificationChannel(BaseDataObject):
Expand All @@ -42,15 +42,15 @@ class NotificationType(BaseDataObject):
"""

# the name (including namespace) of the notification, e.g. open-edx.lms.forums.reply-to-post
name = StringField()
name = LazyField()

# default delivery channel for this type
# None = no default
default_channel = RelatedObjectField(NotificationChannel)

# renderer class - as a string - that will handle the rendering of
# this type
renderer = StringField()
renderer = LazyField()

# any context information to pass into the renderer
renderer_context = DictField()
Expand Down Expand Up @@ -405,13 +405,13 @@ class NotificationPreference(BaseDataObject):
"""

# the internal name of the channel
name = StringField()
name = LazyField()

# display_name for notification preference
display_name = StringField()
display_name = LazyField()

# display description for notification preference
display_description = StringField()
display_description = LazyField()

# default_value for notification preference
default_value = StringField()
Expand All @@ -428,7 +428,7 @@ class UserNotificationPreferences(BaseDataObject):
# instance of NotificationPreference, None = unloaded
preference = RelatedObjectField(NotificationPreference)

value = StringField()
value = LazyField()

# timestamps
created = DateTimeField()
Expand Down
Binary file added edx_notifications/locale/ar/LC_MESSAGES/django.mo
Binary file not shown.
60 changes: 60 additions & 0 deletions edx_notifications/locale/ar/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-10-30 22:48+0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 "
"&& n%100<=10 ? 3 : n%100>=11 && n%100<=99 ? 4 : 5;\n"

#: const.py:103
msgid "Announcements"
msgstr "إعلانات"

#: const.py:108
msgid "Group Work"
msgstr "العمل الجماعي"

#: const.py:113
msgid "Leaderboards"
msgstr "لوحات المتسابقين"

#: const.py:118
msgid "Discussion"
msgstr "النقاش"

#: const.py:123
msgid "Other"
msgstr "أخرى"

#: digests.py:200
msgid "Receive daily email"
msgstr "استلام بريد إلكتروني يوميًا"

#: digests.py:201
msgid ""
"This setting will cause a daily digest of all notifications to be sent to "
"your registered email address"
msgstr "هذا الإعداد سيؤدي لإرسال ملخص يومي بجميع الإشعارات إلى عنوان بريدك الإلكتروني المسجل"

#: digests.py:210
msgid "Receive weekly email"
msgstr "استلام بريد إلكتروني أسبوعيًا"

#: digests.py:211
msgid ""
"This setting will cause a weekly digest of all notifications to be sent to "
"your registered email address"
msgstr "هذا الإعداد سيؤدي لإرسال ملخص أسبوعي بجميع الإشعارات إلى عنوان بريدك الإلكتروني المسجل"
Binary file added edx_notifications/locale/de/LC_MESSAGES/django.mo
Binary file not shown.
61 changes: 61 additions & 0 deletions edx_notifications/locale/de/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-10-30 22:48+0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"

#: const.py:103
msgid "Announcements"
msgstr "Ankündigungen"

#: const.py:108
msgid "Group Work"
msgstr "Gruppenarbeit"

#: const.py:113
msgid "Leaderboards"
msgstr "Ranglisten"

#: const.py:118
msgid "Discussion"
msgstr "Diskussionen"

#: const.py:123
msgid "Other"
msgstr ""

#: digests.py:200
msgid "Receive daily email"
msgstr "Tägliche E-Mail erhalten"

#: digests.py:201
msgid ""
"This setting will cause a daily digest of all notifications to be sent to "
"your registered email address"
msgstr "Bei dieser Einstellung wird eine tägliche Zusammenfassung aller Nachrichten an "
"Ihre eingetragene E-Mail Adresse geschickt."

#: digests.py:210
msgid "Receive weekly email"
msgstr "Wöchentliche E-Mail erhalten"

#: digests.py:211
msgid ""
"This setting will cause a weekly digest of all notifications to be sent to "
"your registered email address"
msgstr "Bei dieser Einstellung wird eine wöchentliche Zusammenfassung aller"
"Nachrichten an Ihre eingetragene E-Mail Adresse geschickt."
Binary file added edx_notifications/locale/en/LC_MESSAGES/django.mo
Binary file not shown.
58 changes: 58 additions & 0 deletions edx_notifications/locale/en/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-10-30 22:48+0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"

#: const.py:103
msgid "Announcements"
msgstr ""

#: const.py:108
msgid "Group Work"
msgstr ""

#: const.py:113
msgid "Leaderboards"
msgstr ""

#: const.py:118
msgid "Discussion"
msgstr ""

#: const.py:123
msgid "Other"
msgstr ""

#: digests.py:200
msgid "Receive daily email"
msgstr ""

#: digests.py:201
msgid ""
"This setting will cause a daily digest of all notifications to be sent to "
"your registered email address"
msgstr ""

#: digests.py:210
msgid "Receive weekly email"
msgstr ""

#: digests.py:211
msgid ""
"This setting will cause a weekly digest of all notifications to be sent to "
"your registered email address"
msgstr ""
Binary file not shown.
61 changes: 61 additions & 0 deletions edx_notifications/locale/es/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-10-30 22:48+0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"

#: const.py:103
msgid "Announcements"
msgstr "Anuncios"

#: const.py:108
msgid "Group Work"
msgstr "Trabajo en grupo"

#: const.py:113
msgid "Leaderboards"
msgstr "Tableros de calificaciones"

#: const.py:118
msgid "Discussion"
msgstr "Debates"

#: const.py:123
msgid "Other"
msgstr ""

#: digests.py:200
msgid "Receive daily email"
msgstr "Recibir a diario por correo electrónico"

#: digests.py:201
msgid ""
"This setting will cause a daily digest of all notifications to be sent to "
"your registered email address"
msgstr "Esta configuración le permite seleccionar que todas las notificaciones se envíen "
"a diario a la dirección de correo electrónico registrada."

#: digests.py:210
msgid "Receive weekly email"
msgstr "Recibir una vez semana por correo electrónico"

#: digests.py:211
msgid ""
"This setting will cause a weekly digest of all notifications to be sent to "
"your registered email address"
msgstr "Esta configuración le permite seleccionar que todas las notificaciones"
"se envíen una vez por semana a la dirección de correo electrónico registrada."
Binary file added edx_notifications/locale/fr/LC_MESSAGES/django.mo
Binary file not shown.
Loading