Skip to content
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

use lazy_gettext for user preferences #1521

Merged
merged 2 commits into from
Mar 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
44 changes: 25 additions & 19 deletions server/planning/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

import superdesk
from eve.utils import config
from flask_babel import lazy_gettext, _
from flask_babel import lazy_gettext
from .locations import LocationsResource, LocationsService
from .agendas import AgendasResource, AgendasService
from .planning_export_templates import PlanningExportTemplatesResource, PlanningExportTemplatesService
Expand Down Expand Up @@ -153,48 +153,54 @@ def init_app(app):
'type': 'bool',
'enabled': True,
'default': False,
'label': _('Allow Notifications To Slack'),
'category': _('Notifications'),
})
},
label=lazy_gettext('Allow Notifications To Slack'),
category=lazy_gettext('Notifications'),
)

superdesk.register_default_user_preference('planning:calendar', {
'type': 'dict',
'label': _('Default Calendar'),
'category': _('Planning'),
'calendar': {}
})
},
label=lazy_gettext('Default Calendar'),
category=lazy_gettext('Planning'),
)

superdesk.register_default_user_preference('planning:agenda', {
'type': 'dict',
'label': _('Default Agenda'),
'category': _('Planning'),
'agenda': {},
'default': None
})
},
label=lazy_gettext('Default Agenda'),
category=lazy_gettext('Planning'),
)

superdesk.register_default_user_preference('planning:events_planning_filter', {
'type': 'dict',
'label': _('Default Events Planning Filter'),
'category': _('Planning'),
'filter': {},
'default': None
})
},
label=lazy_gettext('Default Events Planning Filter'),
category=lazy_gettext('Planning'),
)

superdesk.register_default_user_preference('planning:default_coverage_desks', {
'type': 'dict',
'label': _('Default desk for coverage types'),
'category': _('Planning'),
'desks': {},
'default': None
})
},
label=lazy_gettext('Default desk for coverage types'),
category=lazy_gettext('Planning'),
)

superdesk.register_default_user_preference('planning:add_coverage_advanced_mode', {
'type': 'bool',
'enabled': False,
'default': False,
'label': _('Open advanced mode when adding coverages'),
'category': _('Planning'),
})
},
label=lazy_gettext('Open advanced mode when adding coverages'),
category=lazy_gettext('Planning'),
)

app.client_config['max_recurrent_events'] = get_max_recurrent_events(app)
app.client_config['street_map_url'] = get_street_map_url(app)
Expand Down
9 changes: 5 additions & 4 deletions server/planning/assignments/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# at https://www.sourcefabric.org/superdesk/license

import superdesk
from flask_babel import _
from flask_babel import lazy_gettext
from superdesk.services import BaseService
from .assignments import AssignmentsResource, AssignmentsService
from .assignments_content import AssignmentsContentResource, AssignmentsContentService
Expand Down Expand Up @@ -114,8 +114,9 @@ def init_app(app):
# User Preferences
superdesk.register_default_user_preference('assignments:default_sort', {
'type': 'dict',
'label': _('Default sort preferences for Assignment lists'),
'category': _('Assignments'),
'sort': {},
'default': None
})
},
label=lazy_gettext('Default sort preferences for Assignment lists'),
category=lazy_gettext('Assignments'),
)