diff -rN old-ghestalt/app/accounts.py new-ghestalt/app/accounts.py 8a9 > from ghestalt.i18n.utils import i18n_site_base 12a14 > from django.utils import translation 15,20c17,26 < email = forms.EmailField() < password = forms.CharField(widget=forms.PasswordInput) < password2 = forms.CharField(widget=forms.PasswordInput) < first_name = forms.CharField(max_length=30) < last_name = forms.CharField(max_length=30) < user_name = forms.CharField(max_length=30) --- > email = forms.EmailField(label=_('E-mail address')) > password = forms.CharField(label=_('Password'),widget=forms.PasswordInput) > password2 = forms.CharField(label=_('Password (again)'),widget=forms.PasswordInput) > first_name = forms.CharField(label=_('First name'),max_length=30) > last_name = forms.CharField(label=_('Last name'),max_length=30) > user_name = forms.CharField(label=_('Account username'),max_length=30) > location = forms.CharField(label=_('Location'),max_length=30, required=False) > otro_lang = forms.ChoiceField(label=_('Language'),choices=settings.LANGUAGES, required=False) > otro_first_name = forms.CharField(label=_('First name in language'),max_length=30, required=False) > otro_last_name = forms.CharField(label=_('Last name in language'),max_length=30, required=False) 24a31,56 > def clean_location(self): > raw = self.clean_data.get('location') > if raw=='': > return raw > raw2 = map(unicode.upper,map(unicode.strip,raw.split(','))) > if len(raw2) != 2: > raise forms.ValidationError(_(u'Cannot parse location. Format is lat,long.')) > if raw2[0][-1] in 'NS': > if raw2[0][0]=='-': > raise forms.ValidationError(_(u'Cannot parse location. Format is lat,long.')) > if raw2[0][-1]=='S': > raw2[0] = '-'+raw2[0][:-1] > if raw2[0][-1]=='N': > raw2[0] = raw2[0][:-1] > if raw2[1][-1] in 'EW': > if raw2[1][0]=='-': > raise forms.ValidationError(_(u'Cannot parse location. Format is lat,long.')) > if raw2[1][-1]=='W': > raw2[1] = '-'+raw2[1][:-1] > if raw2[1][-1]=='E': > raw2[1] = raw2[1][:-1] > try: > long,lat = (float(raw2[0]),float(raw2[1])) > except ValueError: > raise forms.ValidationError(_(u'Cannot parse location. Format is lat,long.')) > return '%f,%f' % (long,lat) 42a75,78 > location = form.clean_data.get('location') > otro_lang = form.clean_data.get('otro_lang') > otro_first_name = form.clean_data.get('otro_first_name') > otro_last_name = form.clean_data.get('otro_last_name') 47c83 < userprofile = UserProfile(first_name=first_name, last_name=last_name, email=email, role="User", user=u) --- > userprofile = UserProfile(first_name=first_name, last_name=last_name, email=email, role="User", user=u, location=location,otro_lang=otro_lang, otro_last_name=otro_last_name, otro_first_name=otro_first_name) 55,56c91,93 < subject = "Welcome to %s" % (settings.SITE_NAME) < c['login_url'] = "%s%s/accounts/login" % (settings.SITE_DOMAIN, settings.SITE_BASE) --- > subject = _("Welcome to %s" % (settings.SITE_NAME)) > site_base = i18n_site_base(request) > c['login_url'] = "%s%s/accounts/login" % (settings.SITE_DOMAIN, site_base) 61,66c98,110 < try: < send_mail(subject, t.render(c), site_email, < [email], fail_silently=False) < except: < return bad_or_missing(request,'Problems sending mail.') < return http.HttpResponseRedirect('%s/accounts/thankyou' % (settings.SITE_BASE)) --- > if userprofile.otro_lang != settings.LANGUAGE_CODE[:2]: > request.session['otro_lang'] = userprofile.otro_lang > try: > if request.session['other_lang']: pass > except KeyError: > request.session['other_lang'] = userprofile.otro_lang > if settings.ENABLE_MAIL: > try: > send_mail(subject, t.render(c), site_email, > [email], fail_silently=False) > except: > return bad_or_missing(request,'Problems sending mail.') > return http.HttpResponseRedirect('%s/accounts/thankyou' % (site_base)) 70a115,192 > ## > class EditAccountForm(forms.Form): > first_name = forms.CharField(label=_('First name'),max_length=30) > last_name = forms.CharField(label=_('Last name'),max_length=30) > location = forms.CharField(label=_('Location'),max_length=30,required=False) > otro_lang = forms.ChoiceField(label=_('Language'),choices=settings.LANGUAGES,required=False) > otro_first_name = forms.CharField(label=_('First name in language'),max_length=30,required=False) > otro_last_name = forms.CharField(label=_('Last name in language'),max_length=30,required=False) > def clean_location(self): > raw = self.clean_data.get('location') > if raw=='': > return raw > raw2 = map(unicode.upper,map(unicode.strip,raw.split(','))) > if len(raw2) != 2: > raise forms.ValidationError(_(u'Cannot parse location. Format is lat,long.')) > if raw2[0][-1] in 'NS': > if raw2[0][0]=='-': > raise forms.ValidationError(_(u'Cannot parse location. Format is lat,long.')) > if raw2[0][-1]=='S': > raw2[0] = '-'+raw2[0][:-1] > if raw2[0][-1]=='N': > raw2[0] = raw2[0][:-1] > if raw2[1][-1] in 'EW': > if raw2[1][0]=='-': > raise forms.ValidationError(_(u'Cannot parse location. Format is lat,long.')) > if raw2[1][-1]=='W': > raw2[1] = '-'+raw2[1][:-1] > if raw2[1][-1]=='E': > raw2[1] = raw2[1][:-1] > try: > long,lat = (float(raw2[0]),float(raw2[1])) > except ValueError: > raise forms.ValidationError(_(u'Cannot parse location. Format is lat,long.')) > return '%f,%f' % (long,lat) > def clean(self): > return self.clean_data > > def edit(request): > if request.POST: > form = EditAccountForm(request.POST) > if form.is_valid(): > first_name = form.clean_data.get('first_name') > last_name = form.clean_data.get('last_name') > otro_lang = form.clean_data.get('otro_lang') > otro_first_name = form.clean_data.get('otro_first_name') > otro_last_name = form.clean_data.get('otro_last_name') > location = form.clean_data.get('location') > u = User.objects.get(id=request.user.id) > userprofile = UserProfile.objects.get(user=u.id) > u.first_name = first_name > u.last_name = last_name > u.save() > userprofile.first_name=first_name > userprofile.last_name=last_name > userprofile.role="User" > userprofile.user=u > userprofile.location=location > userprofile.otro_lang=otro_lang > userprofile.otro_last_name=otro_last_name > userprofile.otro_first_name=otro_first_name > userprofile.save() > if userprofile.otro_lang != settings.LANGUAGE_CODE[:2]: > request.session['otro_lang'] = userprofile.otro_lang > try: > if request.session['other_lang']: pass > except KeyError: > request.session['other_lang'] = userprofile.otro_lang > site_base = i18n_site_base(request) > return http.HttpResponseRedirect('%s/accounts/thankyou' % (site_base)) > else: > userprofile = UserProfile.objects.get(user=request.user.id) > user = User.objects.get(id=request.user.id) > d = userprofile.__dict__ > d.update(user.__dict__) > form = EditAccountForm(d) > return render_to_response('account_edit_form.html', {'form': form}, > RequestContext(request)) > edit = login_required(edit) 84c206,207 < return http.HttpResponseRedirect('%s/' % (settings.SITE_BASE)) --- > site_base = i18n_site_base(request) > return http.HttpResponseRedirect('%s/' % (site_base)) diff -rN old-ghestalt/app/contact.py new-ghestalt/app/contact.py 11,12c11,12 < ("General Question", "General question"), < ("Improvement Suggestion", "Improvement suggestion"), --- > ("General Question", _("General question")), > ("Improvement Suggestion", _("Improvement suggestion")), 16,20c16,20 < name = forms.CharField(max_length=20) < email = forms.EmailField() < subject = forms.CharField(max_length=30) < inquiry = forms.ChoiceField(choices=email_choices) < contents = forms.CharField(widget=forms.Textarea(attrs={'rows': 14, 'cols': 60})) --- > name = forms.CharField(label=_('Name'),max_length=20) > email = forms.EmailField(label=_('E-mail address')) > subject = forms.CharField(label=_('Subject'),max_length=30) > inquiry = forms.ChoiceField(label=_('Inquiry'),choices=email_choices) > contents = forms.CharField(label=_('Contents'),widget=forms.Textarea(attrs={'rows': 14, 'cols': 60})) 36,40c36,41 < try: < send_mail(subject, t.render(c), site_email, < [site_email], fail_silently=False) < except: < return bad_or_missing(request,'Problems sending mail.') --- > if settings.ENABLE_MAIL: > try: > send_mail(subject, t.render(c), site_email, > [site_email], fail_silently=False) > except: > return bad_or_missing(request,'Problems sending mail.') diff -rN old-ghestalt/app/context_processors.py new-ghestalt/app/context_processors.py 7a8,9 > from django.utils import translation > from ghestalt.i18n.utils import * 11,12c13,29 < site_name = settings.SITE_NAME < return {'site_base': settings.SITE_BASE, --- > site_name = _(settings.SITE_NAME) > site_base = i18n_site_base(request) > try: > other_lang = str(request.session['other_lang']) > except KeyError: > other_lang = None > gui_lang = request.LANGUAGE_CODE[:2] > try: > otro_lang = str(request.session['otro_lang']) > except KeyError: > otro_lang = None > if i18n_lang_suffix(request.path)[1:] in settings.LANGUAGES_BIDI: > content_bidi = True > else: > content_bidi = False > return {'site_base': site_base, > 'site_root': settings.SITE_BASE, 14c31,37 < 'media_url': settings.MEDIA_URL} --- > 'media_url': settings.MEDIA_URL, > 'url_path': request.path, > 'other_lang': other_lang, > 'gui_lang': gui_lang, > 'base_lang': settings.LANGUAGE_CODE[:2], > 'otro_lang': otro_lang, > } diff -rN old-ghestalt/app/models.py new-ghestalt/app/models.py 0a1 > from django.conf import settings 2a4 > from django.utils.translation import gettext_lazy as _ 24c26,33 < --- > otro_lang = models.CharField(_('Language'),maxlength=10,choices=settings.LANGUAGES,default=settings.LANGUAGE_CODE[:2], blank=True) > # when viewing content in otro_lang your name will appear as otro_name > otro_first_name = models.CharField(maxlength=30, blank=True) > otro_last_name = models.CharField(maxlength=30, blank=True) > def _get_otro_full_name(self): > "Returns the person's otro language name." > return '%s %s' % (self.otro_first_name, self.otro_last_name) > otro_full_name = property(_get_otro_full_name) diff -rN old-ghestalt/app/templates/account.html new-ghestalt/app/templates/account.html 0a1 > {% load ghmarkup %} 10c11,14 <

Welcome, {{ user_data.full_name }}.

--- >

Welcome, {{ user_data.full_name }}.

>

Your recorded long/lat is {{ user_data.location }}.

>

Otro language: {{ user_data.otro_lang|prettylang }}.

>

Otro name: {{ user_data.otro_last_name }}, {{ user_data.otro_first_name }}.

12a17 >
  • Edit user details
  • diff -rN old-ghestalt/app/templates/base.html new-ghestalt/app/templates/base.html 0a1 > {% load ghmarkup %} 12a14 > 42c44 < Login
    --- > Login
    47c49,65 < --- >

    Viewing site in {{ gui_lang|prettylang }}
    > {% ifnotequal base_lang gui_lang %} > Change to {{ base_lang|prettylang }}
    > {% endifnotequal %} > {% if other_lang %}{% ifnotequal other_lang gui_lang %} > Change to {{ other_lang|prettylang }}
    > {% endifnotequal %}{% endif %} > {% if otro_lang %} > {% ifnotequal otro_lang gui_lang %} > {% ifnotequal otro_lang other_lang %} > Change to {{ otro_lang|prettylang }}
    > {% endifnotequal %} > {% endifnotequal %} > {% endif %} > Other Languages
    >

    >

    diff -rN old-ghestalt/app/templates/edit.html new-ghestalt/app/templates/edit.html 12c12,13 < {% if preview %}{{ preview|ghmarkup }}{% endif %} --- > {% if source %}

    Translation source

    {{ source|ghmarkup:what }}{% endif %} > {% if preview %}{{ preview|ghmarkup:what }}{% endif %} 15,16c16,17 < < --- > > diff -rN old-ghestalt/app/templates/history.html new-ghestalt/app/templates/history.html 12,13c12,13 <
  • {{ entry.id }} {{ entry.mtime }} {{ entry.what|ghlink }} < ... {% filter ghlink %}user/{{ entry.muser }}{% endfilter %}
  • --- >
  • {{ entry.id }} {{ entry.mtime }} {{ entry.what|ghlink }} > ... {{ entry.muser|userlink:"/user/history" }}
  • diff -rN old-ghestalt/app/templates/intro.html new-ghestalt/app/templates/intro.html 1a2 > {% load ghmarkup %} 10c11 < Welcome to Ghestalt{% if user.username %}, {{ user.username }}{% endif %}. --- > Welcome to Ghestalt{% if user.username %}, {{ user.username|userlink:"/intro" }}{% endif %}. 13c14 <

    You can Login, or go straight to the Wiki. --- >

    You can Login, or go straight to the Wiki. 16c17 <

    Go straight to the Wiki. --- >

    Go straight to the Wiki. diff -rN old-ghestalt/app/templates/missing.html new-ghestalt/app/templates/missing.html 15c15 < Add page --- > Add page diff -rN old-ghestalt/app/templates/recent.html new-ghestalt/app/templates/recent.html 12,13c12,14 <

  • {{ entry.id }} {{ entry.mtime }} {{entry.what|ghlink}} < ... {% filter ghlink %}user/{{ entry.muser }}{% endfilter %}
  • --- > {% ifchanged entry.mtime.date %}{{ entry.mtime.date }}