Permalink
Browse files

Initial .po files, and some missing strings.

  • Loading branch information...
1 parent 5b11853 commit dd94ea17bd56c5fda90c2810b7bd0a72c877307b @dracos dracos committed Jan 20, 2014
View
@@ -5,6 +5,7 @@
/conf/httpd.conf.deployed
.sass-cache
/web/sass/*.css
+django.mo
.apdisk
.DS_Store
chromedriver.log
View
115 README.md
@@ -1,120 +1,9 @@
SayIt
=====
-A project to upload and store audio and text of speeches.
+A Django application/project to store transcripts
+and present them in a modern, searchable format.
[![Build Status](https://travis-ci.org/mysociety/sayit.png)](https://travis-ci.org/mysociety/sayit)
-Documentation
--------------
-Documentation (a work in progress) can be found at: http://mysociety.github.io/sayit/
-Installation
-------------
-
-Something like the following, customised to your particular environment or set up:
-
- # Clone the repo
- mkdir sayit
- cd sayit
- git clone https://github.com/mysociety/sayit.git
-
- cd sayit
-
- # Install the required software packages
- Assuming you're on a debian/ubuntu server:
- grep -v '#' conf/packages | sudo xargs apt-get install -y
-
- # Create a postgres database and user
- sudo -u postgres psql
- postgres=# CREATE USER sayit WITH password 'sayit';
- CREATE ROLE
- postgres=# CREATE DATABASE sayit WITH OWNER sayit;
- CREATE DATABASE
-
- # Set up a python virtual environment, activate it
- # this assumes that you will set up the virtualenv in ..
- # (e.g. outside the repo.
- # You can use ~/.virtualenvs/ etc. if you prefer)
- virtualenv --no-site-packages ../virtualenv-sayit
- source ../virtualenv-sayit/bin/activate
-
- # Install required python packages
- pip install --requirement requirements.txt
-
- cp conf/general.yml-example conf/general.yml
- # Alter conf/general.yml as per your set up
- # use the 'sayit' account as above for SAYIT_DB_{USER,NAME,PASS}
- #
- # For *development* use only:
- # use recommendations for BASE_{HOST,PORT}
- # you don't need Google Analytics
- # for AT&T API details, you can use these 2 dummy values
- # ATT_OAUTH_URL: 'http://att.oauth.url.example.org/'
- # ATT_API_URL: 'http://att.api.url.example.org/'
- # DJANGO_SECRET_KEY isn't needed
-
- # Set up database
- ./manage.py syncdb
-
- # This will ask you if you wish to create a Django superuser, which you'll
- # use to access the sayit admin interface. You can always do it later with
- # ./manage.py createsuperuser, but there's no harm in doing it now either,
- # just remember the details you choose!
-
- ./manage.py migrate
-
- # gather all the static files in one place
- ./manage.py collectstatic --noinput
-
-Testing
--------
-
- ./manage.py test
-
-By default the Selenium tests are **not** run. These tests currently uses
-Firefox, so make sure you have Firefox installed.
-
-If you're on a headless server, eg: in a vagrant box, you'll need to install the
-iceweasel and xvfb packages (see the commented out section of /conf/packages)
-
-After installing them, start Xvfb with:
-
- Xvfb :99 -ac &
-
-And export your display variable:
-
- export DISPLAY=:99
-
-You can then run the tests, including the Selenium ones, using:
-
- SELENIUM_TESTS=1 ./manage.py test
-
-You might want to make that happen at every startup with the appropriates lines in
-`/etc/rc.local` and `~/.bashrc`
-
-Using the API
--------------
-
-1) Tastypie API is read-only
-
-TODO
-
-2) Speech upload API
-
- * Get the login token from `/instance/token` for the instance you want to
- connect to
-
- * `curl -c cookie.jar -d login-token='[[TOKEN]]' http://[[site]]/accounts/mobile-login/`
-
-For the curl login request, do not target the wildcarded domain (e.g. for the
-instance), as the token is already linked to the instance
-
- * `curl -v -b cookie.jar -F "audio=@path/to/audio.mp3;type=audio/mpeg" -F timestamps='[{"timestamp":0},{"timestamp":30000}]' http://[[instance]].[[site]]/api/v0.1/recording/`
-
-Note that timestamps are in milliseconds, so 30000 above is 30 seconds. The
-JSON structure for the list of timestamps can also include the speaker ID, for
-example `{"timestamp":0,"speaker",1}`.
-
-It may be easier to test with short audio snippets until you are able to
-successfully upload.
View
@@ -6,6 +6,7 @@
from django_select2.widgets import Select2Widget, Select2MultipleWidget
+from django.utils.translation import ugettext_lazy as _
from django import forms
from django.forms.forms import BoundField
from django.forms.models import inlineformset_factory, BaseInlineFormSet
@@ -53,13 +54,13 @@ class Meta:
}
class SectionPickForm(forms.Form):
- section = forms.ModelChoiceField(label='Assign to section', queryset=Section.objects.all(), required=True)
+ section = forms.ModelChoiceField(label=_('Assign to section'), queryset=Section.objects.all(), required=True)
class SpeechForm(forms.ModelForm, CleanAudioMixin):
audio_filename = forms.CharField(widget=forms.HiddenInput, required=False)
speaker = forms.ModelChoiceField(queryset=Speaker.objects.all(),
empty_label = '',
- widget = Select2Widget(select2_options={ 'placeholder':'Choose a speaker', 'width': 'resolve' }),
+ widget = Select2Widget(select2_options={ 'placeholder':_('Choose a speaker'), 'width': 'resolve' }),
required=False)
section = forms.ModelChoiceField(queryset=Section.objects.all(), required=False)
start_date = forms.DateField(input_formats=['%d/%m/%Y'],
@@ -76,7 +77,7 @@ class SpeechForm(forms.ModelForm, CleanAudioMixin):
required=False)
#tags = TagField()
tags = forms.ModelMultipleChoiceField(queryset=Tag.objects.all(),
- widget = Select2MultipleWidget(select2_options={ 'placeholder':'Choose tags', 'width': 'resolve' }),
+ widget = Select2MultipleWidget(select2_options={ 'placeholder':_('Choose tags'), 'width': 'resolve' }),
required=False)
def clean(self):
@@ -86,18 +87,18 @@ def clean(self):
self.cleaned_data['audio'] = filename
if not cleaned_data.get('text') and not cleaned_data.get('audio'):
- raise forms.ValidationError('You must provide either text or some audio')
+ raise forms.ValidationError(_('You must provide either text or some audio'))
return cleaned_data
def clean_start_time(self):
if self.cleaned_data['start_time'] and not self.cleaned_data.get('start_date'):
- raise forms.ValidationError('If you provide a start time you must give a start date too')
+ raise forms.ValidationError(_('If you provide a start time you must give a start date too'))
return self.cleaned_data['start_time']
def clean_end_time(self):
if self.cleaned_data['end_time'] and not self.cleaned_data['end_date']:
- raise forms.ValidationError('If you provide an end time you must give an end date too')
+ raise forms.ValidationError(_('If you provide an end time you must give an end date too'))
return self.cleaned_data['end_time']
class Meta:
@@ -197,10 +198,10 @@ def clean_parent(self):
parent = self.cleaned_data['parent']
if self.instance and parent:
if parent.id == self.instance.id:
- raise forms.ValidationError('Something cannot be its own parent')
+ raise forms.ValidationError(_('Something cannot be its own parent'))
descendant_ids = [ d.id for d in self.instance.get_descendants ]
if parent.id in descendant_ids:
- raise forms.ValidationError('Something cannot have a parent that is also a descendant')
+ raise forms.ValidationError(_('Something cannot have a parent that is also a descendant'))
return parent
class SpeakerForm(forms.ModelForm):
@@ -253,7 +254,7 @@ def clean(self):
# TODO: check that first timestamp isn't before start of speech?
if first_timestamp < recording.start_datetime:
- raise forms.ValidationError("Start time is before recording start time!")
+ raise forms.ValidationError(_("Start time is before recording start time!"))
# TODO: check that delta from first to last timestamp isn't longer
# than length of audio
@@ -262,14 +263,14 @@ def clean(self):
delta = (last_timestamp - first_timestamp).seconds
if delta >= recording.audio_duration:
- raise forms.ValidationError('Difference between timestamps is too long for the uploaded audio')
+ raise forms.ValidationError(_('Difference between timestamps is too long for the uploaded audio'))
previous_timestamp = None
for form in _forms:
timestamp = form.cleaned_data['timestamp']
if previous_timestamp:
if timestamp <= previous_timestamp:
- raise forms.ValidationError('Timestamps must be distinct')
+ raise forms.ValidationError(_('Timestamps must be distinct'))
previous_timestamp = timestamp
RecordingTimestampFormSet = inlineformset_factory(
Oops, something went wrong.

0 comments on commit dd94ea1

Please sign in to comment.