Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add lable _() for translation
  • Loading branch information
camp-zju committed May 10, 2018
1 parent 1b358a8 commit 6ebc540
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 20 deletions.
5 changes: 3 additions & 2 deletions geonode/base/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,7 @@ class ResourceBase(PolymorphicModel, PermissionLevelMixin, ItemBase):
manager=_HierarchicalTagManager)
tkeywords = models.ManyToManyField(
ThesaurusKeyword,
verbose_name=_('keywords'),
help_text=tkeywords_help_text,
blank=True)
regions = models.ManyToManyField(
Expand Down Expand Up @@ -734,7 +735,7 @@ class ResourceBase(PolymorphicModel, PermissionLevelMixin, ItemBase):

# metadata XML specific fields
metadata_uploaded = models.BooleanField(default=False)
metadata_uploaded_preserve = models.BooleanField(default=False)
metadata_uploaded_preserve = models.BooleanField(_('Metadata uploaded preserve'), default=False)
metadata_xml = models.TextField(
null=True,
default='<gmd:MD_Metadata xmlns:gmd="http://www.isotc211.org/2005/gmd"/>',
Expand All @@ -755,7 +756,7 @@ class ResourceBase(PolymorphicModel, PermissionLevelMixin, ItemBase):
help_text=_('Is this resource validated from a publisher or editor?'))

# fields necessary for the apis
thumbnail_url = models.TextField(null=True, blank=True)
thumbnail_url = models.TextField(_("Thumbnail url"), null=True, blank=True)
detail_url = models.CharField(max_length=255, null=True, blank=True)
rating = models.IntegerField(default=0, null=True, blank=True)

Expand Down
8 changes: 4 additions & 4 deletions geonode/contrib/createlayer/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#########################################################################

from django import forms

from django.utils.translation import ugettext as _

GEOMETRY_TYPES = (
('Point', 'Points'),
Expand All @@ -32,9 +32,9 @@ class NewLayerForm(forms.Form):
"""
A form to create an empty layer in PostGIS.
"""
name = forms.CharField(label='Layer name', max_length=255)
title = forms.CharField(label='Layer title', max_length=255)
geometry_type = forms.ChoiceField(choices=GEOMETRY_TYPES)
name = forms.CharField(label=_('Layer name'), max_length=255)
title = forms.CharField(label=_('Layer title'), max_length=255)
geometry_type = forms.ChoiceField(label=_('Geometry type'), choices=GEOMETRY_TYPES)

permissions = forms.CharField(
widget=forms.HiddenInput(
Expand Down
1 change: 1 addition & 0 deletions geonode/groups/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ class Meta:

class GroupMemberForm(forms.Form):
user_identifiers = forms.CharField(
label=_("User Identifiers"),
widget=forms.TextInput(
attrs={
'class': 'user-select'
Expand Down
6 changes: 3 additions & 3 deletions geonode/groups/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@

class GroupCategory(models.Model):
slug = models.SlugField(max_length=255, unique=True, null=False, blank=False)
name = models.CharField(max_length=255, unique=True, null=False, blank=False)
description = models.TextField(null=True, default=None, blank=True)
name = models.CharField(_("Name"), max_length=255, unique=True, null=False, blank=False)
description = models.TextField(_("Description"), null=True, default=None, blank=True)

class Meta:
verbose_name_plural = _('Group Categories')
Expand Down Expand Up @@ -91,7 +91,7 @@ class GroupProfile(models.Model):
choices=GROUP_CHOICES,
help_text=access_help_text)
last_modified = models.DateTimeField(auto_now=True)
categories = models.ManyToManyField(GroupCategory, blank=True, related_name='groups')
categories = models.ManyToManyField(GroupCategory, verbose_name=_("Categories"), blank=True, related_name='groups')
created = models.DateTimeField(auto_now_add=True)

def save(self, *args, **kwargs):
Expand Down
21 changes: 11 additions & 10 deletions geonode/layers/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,21 +127,22 @@ class Layer(ResourceBase):

# internal fields
objects = LayerManager()
workspace = models.CharField(max_length=128)
store = models.CharField(max_length=128)
storeType = models.CharField(max_length=128)
name = models.CharField(max_length=128)
typename = models.CharField(max_length=128, null=True, blank=True)

is_mosaic = models.BooleanField(default=False)
has_time = models.BooleanField(default=False)
has_elevation = models.BooleanField(default=False)
workspace = models.CharField(_('Workspace'), max_length=128)
store = models.CharField(_('Store'), max_length=128)
storeType = models.CharField(_('Storetype'), max_length=128)
name = models.CharField(_('Name'), max_length=128)
typename = models.CharField(_('Typename'), max_length=128, null=True, blank=True)

is_mosaic = models.BooleanField(_('Is mosaic?'), default=False)
has_time = models.BooleanField(_('Has time?'), default=False)
has_elevation = models.BooleanField(_('Has elevation?'), default=False)
time_regex = models.CharField(
_('Time regex'),
max_length=128,
null=True,
blank=True,
choices=TIME_REGEX)
elevation_regex = models.CharField(max_length=128, null=True, blank=True)
elevation_regex = models.CharField(_('Elevation regex'), max_length=128, null=True, blank=True)

default_style = models.ForeignKey(
Style,
Expand Down
2 changes: 1 addition & 1 deletion geonode/layers/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ def layer_upload(request, template='upload/layer_upload.html'):
form.cleaned_data["abstract"]) > 0:
abstract = form.cleaned_data["abstract"]
else:
abstract = "No abstract provided."
abstract = _('No abstract provided')

try:
# Moved this inside the try/except block because it can raise
Expand Down
1 change: 1 addition & 0 deletions geonode/people/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ class PocForm(forms.Form):

class ProfileForm(forms.ModelForm):
keywords = taggit.forms.TagField(
label=_("Keywords"),
required=False,
help_text=_("A space or comma-separated list of keywords"))

Expand Down
2 changes: 2 additions & 0 deletions geonode/people/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ class Profile(AbstractUser):
null=True,
help_text=_('ZIP or other postal code'))
country = models.CharField(
_('Country'),
choices=COUNTRIES,
max_length=3,
blank=True,
Expand All @@ -107,6 +108,7 @@ class Profile(AbstractUser):
default=settings.LANGUAGE_CODE
)
timezone = models.CharField(
_('Timezone'),
max_length=100,
default="",
choices=TIMEZONES,
Expand Down

0 comments on commit 6ebc540

Please sign in to comment.