searx: Styling fixes

- Internet is used instead of 'internet' in Plinth elsewhere.

- Use common error messages instead of specific errors to reduce l10n effort.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
Sunil Mohan Adapa 2018-02-26 18:48:25 +05:30
parent 0e9d10bff5
commit f054703d3a
No known key found for this signature in database
GPG Key ID: 43EA1CFF0AA7C5F2
4 changed files with 12 additions and 14 deletions

View File

@ -1,5 +1,4 @@
#!/usr/bin/python3
# -*- mode: python -*-
#
# This file is part of Plinth.
#
@ -38,10 +37,10 @@ def parse_arguments():
parser = argparse.ArgumentParser()
subparsers = parser.add_subparsers(dest='subcommand', help='Sub command')
subparsers.add_parser('enable', help='Enable searx')
subparsers.add_parser('disable', help='Disable searx')
subparsers.add_parser('enable', help='Enable Searx')
subparsers.add_parser('disable', help='Disable Searx')
subparsers.add_parser(
'setup', help="Perform post-installation operations for Searx")
'setup', help='Perform post-installation operations for Searx')
safe_search = subparsers.add_parser(
'set-safe-search',
@ -106,11 +105,13 @@ def subcommand_get_safe_search(_):
def read_settings():
"""Load settings as dictionary from YAML config file."""
with open(SETTINGS_FILE, 'rb') as settings_file:
return yaml.load(settings_file)
def write_settings(settings):
"""Write settings from dictionary to YAML config file."""
with open(SETTINGS_FILE, 'w') as settings_file:
yaml.dump(settings, settings_file)

View File

@ -15,7 +15,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
"""
FreedomBox module to configure Searx
FreedomBox app to configure Searx.
"""
import os
@ -44,7 +44,7 @@ name = _('Searx')
short_description = _('Web Search')
description = [
_('Searx is a privacy-respecting internet metasearch engine. '
_('Searx is a privacy-respecting Internet metasearch engine. '
'It aggregrates and displays results from multiple search engines.'),
_('Searx can be used to avoid tracking and profiling by search engines. '
'It stores no cookies by default.')

View File

@ -15,7 +15,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
"""
Plinth form for configuring Searx.
Django form for configuring Searx.
"""
from django import forms

View File

@ -15,7 +15,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
"""
Plinth views for Searx.
Django views for Searx.
"""
from django.contrib import messages
@ -51,13 +51,10 @@ class SearxServiceView(views.ServiceView):
if str(old_data['safe_search']) != form_data['safe_search']:
try:
actions.superuser_run(
'searx',
['set-safe-search',
str(form_data['safe_search'])])
messages.success(self.request,
_('Safe search setting updated'))
'searx', ['set-safe-search', form_data['safe_search']])
messages.success(self.request, _('Configuration updated.'))
except ActionError as e:
messages.error(self.request,
_('Failed to update safe search setting'))
_('An error occurred during configuration.'))
return super().form_valid(form)