diff --git a/apps/files/models.py b/apps/files/models.py index 027af94..04bebd9 100644 --- a/apps/files/models.py +++ b/apps/files/models.py @@ -1,6 +1,6 @@ from django.contrib.auth.models import User from django.db import models -from django.utils.translation import ugettext as _ +from django.utils.translation import ugettext_lazy as _ from apps.map.models import CaseStudy, CaseStudyDraft diff --git a/apps/map/forms.py b/apps/map/forms.py index 6a0cfe9..e4b9a82 100644 --- a/apps/map/forms.py +++ b/apps/map/forms.py @@ -1,7 +1,8 @@ from django import forms from django.urls import reverse, reverse_lazy -from django.utils.translation import ugettext as _ from django.utils.safestring import mark_safe +from django.utils.text import format_lazy +from django.utils.translation import ugettext_lazy as _ from crispy_forms.helper import FormHelper from crispy_forms.layout import Submit, Layout, HTML, Fieldset, Div @@ -152,6 +153,24 @@ class BootstrapClearableFileInput(forms.ClearableFileInput): template_name = 'map/forms/widgets/file.html' +def PreviousButton(): + return HTML( + format_lazy( + "{prev}", + prev=_("Previous") + ) + ) + + +def NextButton(): + return HTML( + format_lazy( + "{next}", + next=_("Next") + ) + ) + + class LongCaseStudyForm(BaseCaseStudyForm): """Long version of the CaseStudy form.""" @@ -242,39 +261,58 @@ class LongCaseStudyForm(BaseCaseStudyForm): self.fields['project_owners'].required = True self.fields['shareholders'].required = True + organising_vs_label = _( + 'Socio-environmental impacts (negative and potentially positive)') + organising_pro_label = _( + 'Socio-environmental impacts (positive and potentially negative)') + organising_other_label = _( + 'Socio-environmental impacts (positive and negative)') - self.fields['socioeconomic_benefits'].label = \ - '' + \ - _('Socio-environmental impacts (negative and potentially positive)') + \ - '' + \ - '' + \ - _('Socio-environmental impacts (positive and potentially negative)') + \ - '' + \ - '' + \ - _('Socio-environmental impacts (positive and negative)') + \ - '' + self.fields['socioeconomic_benefits'].label = format_lazy( + ( + '{vs}' + '{pro}' + '{other}' + ), + vs=organising_vs_label, + pro=organising_pro_label, + other=organising_other_label + ) + + organising_other_text = _( + 'Please expand on your response given in the full description on page one.' + ' For example, for positive impacts you need to go beyond emissions' + ' savings, paying rent for land, or complying with environmental or social' + ' legislation. For negative impacts you need to focus on substantive' + ' impacts on vulnerable groups, violations of land rights or abusive labour' + ' practices.') + + organising_vs_text = _( + 'Please expand on your response given in the description. Note that we aim' + ' to focus on violation of land rights / human rights / collective rights,' + ' substantive negative impacts on vulnerable groups, aggression / threats /' + ' violence severe environmental and/or cultural impacts, abusive labor ' + ' practices, and corruption / governance issues, but feel free to cover any' + ' additional aspect that you consider relevant. Please also describe and' + ' analyze socio-environmental impacts that could be presented or considered' + ' as positive.') + + organising_pro_text = _( + 'Please expand on your response given in the description. Please also' + ' describe and analyze socio-environmental impacts that could be considered' + ' as negative.') + + self.fields['socioeconomic_benefits'].help_text = format_lazy( + ( + '{other}' + '{vs}' + '{pro}' + ), + vs=organising_vs_text, + pro=organising_pro_text, + other=organising_other_text + ) - self.fields['socioeconomic_benefits'].help_text = \ - '' + \ - _('Please expand on your response given in the full description on page one.' - ' For example, for positive impacts you need to go beyond emissions savings,' - ' paying rent for land, or complying with environmental or social legislation.' - ' For negative impacts you need to focus on substantive impacts on vulnerable groups, ' - ' violations of land rights or abusive labour practices.') + \ - '' + \ - '' + \ - _('Please expand on your response given in the description. Note that we aim to' \ - ' focus on violation of land rights / human rights / collective rights, substantive' \ - ' negative impacts on vulnerable groups, aggression / threats / violence,' \ - ' severe environmental and/or cultural impacts, abusive labor practices, and' \ - ' corruption / governance issues, but feel free to cover any additional aspect' \ - ' that you consider relevant. Please also describe and analyze socio-environmental' \ - ' impacts that could be presented or considered as positive.') + \ - '' + \ - '' + \ - _('Please expand on your response given in the description. Please also describe' \ - ' and analyze socio-environmental impacts that could be considered as negative.') + \ - '' self.helper.form_action = reverse('long-form') self.helper.layout = Layout( @@ -322,7 +360,7 @@ class LongCaseStudyForm(BaseCaseStudyForm): 'social_media_links' ), FormActions( - HTML(""+_("Next")+"") + NextButton() ) ), Tab( @@ -384,24 +422,29 @@ class LongCaseStudyForm(BaseCaseStudyForm): css_class="manufacturing_questions" ), FormActions( - HTML(""+_("Previous")+""), - HTML(""+_("Next")+"") + PreviousButton(), + NextButton() ) ), Tab( _("Socio-environmental analysis"), HTML( - "

" + - _("In the following, we expect the analysis to reflect the" - " perspective of the organization(s) or person(s) describing" - " the case.") + "

" + format_lazy( + "

{text}

", + text=_( + "In the following, we expect the analysis to reflect " + " the perspective of the organization(s) or person(s) " + " describing the case.") + ) ), 'positive_or_negative', Div( HTML( - ""), + format_lazy( + "", + text=_("What kind of case is this entry about?") + ) + ), Div( 'positive_case_type', 'negative_case_reasons', @@ -424,8 +467,8 @@ class LongCaseStudyForm(BaseCaseStudyForm): css_class="common_questions" ), FormActions( - HTML(""+_("Previous")+""), - HTML(""+_("Next")+"") + PreviousButton(), + NextButton() ) ), Tab( @@ -439,8 +482,8 @@ class LongCaseStudyForm(BaseCaseStudyForm): 'shown_on_other_platforms', 'shown_on_other_platforms_detail', FormActions( - HTML(""+_("Previous")+""), - HTML(""+_("Next")+"") + PreviousButton(), + NextButton() ) ), Tab( @@ -450,7 +493,7 @@ class LongCaseStudyForm(BaseCaseStudyForm): 'other_documents', 'other_documents_files', FormActions( - HTML(""+_("Previous")+""), + PreviousButton(), Submit('submit', _('Submit'), css_class="btn-success pull-right") ) ))) diff --git a/apps/map/models.py b/apps/map/models.py index a995b0d..46fb80a 100644 --- a/apps/map/models.py +++ b/apps/map/models.py @@ -5,7 +5,7 @@ from django.contrib.auth.models import User from django.contrib.gis.db import models from django.db import connection from django.template.defaultfilters import slugify -from django.utils.translation import ugettext as _ +from django.utils.translation import ugettext_lazy as _ from django_extensions.db.fields import AutoSlugField from django_countries.fields import CountryField @@ -657,7 +657,7 @@ class CaseStudy(models.Model): # Should be filled in if generation_technology was answered as bio-energy biomass_detail = models.CharField( verbose_name=_("Bio-energy feedstock"), - help_text="
" + _( + help_text=_("
" "

Please describe the source of the fuel and how it is processed/used." " Please consider:

\n" "\n" "

We do not expect users to know this information, but if you do " " it may be useful to give a fuller picture.

" - ) + "
", + "
"), max_length=200, blank=True ) diff --git a/apps/map/templates/map/form-selector.html b/apps/map/templates/map/form-selector.html index 882d5e6..cf380f1 100644 --- a/apps/map/templates/map/form-selector.html +++ b/apps/map/templates/map/form-selector.html @@ -80,7 +80,7 @@ -

If you are interested in writing a technology assessment or policy analysis to appear on this site, please email info@ojuso.org.

+

{% trans 'If you are interested in writing a technology assessment or policy analysis to appear on this site, please email info@ojuso.org.' %}