def queue_tabnav(context): """Returns tuple of tab navigation for the queue pages. Each tuple contains three elements: (tab_code, page_url, tab_text) """ from .views import queue_counts counts = queue_counts() tabnav = [('nominated', 'queue_nominated', (ngettext('Full Review ({0})', 'Full Reviews ({0})', counts['nominated']) .format(counts['nominated']))), ('pending', 'queue_pending', (ngettext('Pending Update ({0})', 'Pending Updates ({0})', counts['pending']) .format(counts['pending']))), ('prelim', 'queue_prelim', (ngettext('Preliminary Review ({0})', 'Preliminary Reviews ({0})', counts['prelim']) .format(counts['prelim']))), ('moderated', 'queue_moderated', (ngettext('Moderated Review ({0})', 'Moderated Reviews ({0})', counts['moderated']) .format(counts['moderated'])))] if waffle.flag_is_active(context['request'], 'accept-webapps'): tabnav.append(('apps', 'queue_apps', (ngettext('Apps ({0})', 'Apps ({0})', counts['apps']) .format(counts['apps'])))) return tabnav
def queue_tabnav(context): """Returns tuple of tab navigation for the queue pages. Each tuple contains three elements: (tab_code, page_url, tab_text) """ from .views import queue_counts counts = queue_counts() tabnav = [('fast_track', 'queue_fast_track', (ngettext('Fast Track ({0})', 'Fast Track ({0})', counts['fast_track']) .format(counts['fast_track']))), ('nominated', 'queue_nominated', (ngettext('Full Review ({0})', 'Full Reviews ({0})', counts['nominated']) .format(counts['nominated']))), ('pending', 'queue_pending', (ngettext('Pending Update ({0})', 'Pending Updates ({0})', counts['pending']) .format(counts['pending']))), ('prelim', 'queue_prelim', (ngettext('Preliminary Review ({0})', 'Preliminary Reviews ({0})', counts['prelim']) .format(counts['prelim']))), ('moderated', 'queue_moderated', (ngettext('Moderated Review ({0})', 'Moderated Reviews ({0})', counts['moderated']) .format(counts['moderated'])))] return tabnav
def clean_tags(self): target = [slugify(t, spaces=True) for t in self.cleaned_data['tags'].split(',')] target = filter(None, target) min_len = amo.MIN_TAG_LENGTH max_tags = amo.MAX_TAGS total = len(target) blacklisted = [] for tag in Tag.objects.filter(tag_text__in=target): if len(tag.tag_text) > 0 and tag.blacklisted: blacklisted.append(tag.tag_text) if blacklisted: # L10n: {0} is a single tag or a comma-separated list of tags. msg = ngettext('Invalid tag: {0}', 'Invalid tags: {0}', len(blacklisted)).format(', '.join(blacklisted)) raise forms.ValidationError(msg) if total > max_tags: num = total - max_tags msg = ngettext('You have {0} too many tags.', 'You have {0} too many tags.', num).format(num) raise forms.ValidationError(msg) if any(t for t in target if len(t) < amo.MIN_TAG_LENGTH): msg = ngettext("All tags must be at least {0} character.", "All tags must be at least {0} characters.", min_len).format(min_len) raise forms.ValidationError(msg) return target
def queue_tabnav(context): """Returns tuple of tab navigation for the queue pages. Each tuple contains three elements: (tab_code, page_url, tab_text) """ from .views import queue_counts counts = queue_counts() tabnav = [('fast_track', 'queue_fast_track', (ngettext('Fast Track ({0})', 'Fast Track ({0})', counts['fast_track']).format(counts['fast_track']))), ('nominated', 'queue_nominated', (ngettext('Full Review ({0})', 'Full Reviews ({0})', counts['nominated']).format(counts['nominated']))), ('pending', 'queue_pending', (ngettext('Pending Update ({0})', 'Pending Updates ({0})', counts['pending']).format(counts['pending']))), ('prelim', 'queue_prelim', (ngettext('Preliminary Review ({0})', 'Preliminary Reviews ({0})', counts['prelim']).format(counts['prelim']))), ('moderated', 'queue_moderated', (ngettext('Moderated Review ({0})', 'Moderated Reviews ({0})', counts['moderated']).format(counts['moderated'])))] return tabnav
def summarize_validation(validation): """Readable summary of add-on validation results.""" # L10n: first parameter is the number of errors errors = ngettext("{0} error", "{0} errors", validation.errors).format(validation.errors) # L10n: first parameter is the number of warnings warnings = ngettext("{0} warning", "{0} warnings", validation.warnings).format(validation.warnings) return "%s, %s" % (errors, warnings)
def summarize_validation(validation): """Readable summary of add-on validation results.""" # L10n: first parameter is the number of errors errors = ngettext('{0} error', '{0} errors', validation.errors).format(validation.errors) # L10n: first parameter is the number of warnings warnings = ngettext('{0} warning', '{0} warnings', validation.warnings).format(validation.warnings) return "%s, %s" % (errors, warnings)
def render_days_since_created(self, row): if row.days_since_created == 0: # L10n: first argument is number of hours r = ngettext(u'{0} hour', u'{0} hours', row.hours_since_created).format( row.hours_since_created) else: # L10n: first argument is number of days r = ngettext(u'{0} day', u'{0} days', row.days_since_created).format( row.days_since_created) return jinja2.escape(r)
def clean_tags(request, tags, max_tags=None): """ Blocked tags are not allowed. Restricted tags can only be edited by Reviewers and Curators. """ target = [slugify(t, spaces=True, lower=True) for t in tags.split(',')] target = set(filter(None, target)) min_len = mkt.MIN_TAG_LENGTH max_len = Tag._meta.get_field('tag_text').max_length max_tags = max_tags or mkt.MAX_TAGS total = len(target) blocked = (Tag.objects.values_list('tag_text', flat=True).filter(tag_text__in=target, blocked=True)) if blocked: # L10n: {0} is a single tag or a comma-separated list of tags. msg = ngettext(u'Invalid tag: {0}', 'Invalid tags: {0}', len(blocked)).format(', '.join(blocked)) raise forms.ValidationError(msg) restricted = (Tag.objects.values_list('tag_text', flat=True).filter( tag_text__in=target, restricted=True)) if restricted and not can_edit_restricted_tags(request): # L10n: {0} is a single tag or a comma-separated list of tags. msg = ngettext(u'"{0}" is a reserved tag and cannot be used.', u'"{0}" are reserved tags and cannot be used.', len(restricted)).format('", "'.join(restricted)) raise forms.ValidationError(msg) else: # Admin's restricted tags don't count towards the limit. total = len(target - set(restricted)) if total > max_tags: num = total - max_tags msg = ngettext(u'You have {0} too many tags.', u'You have {0} too many tags.', num).format(num) raise forms.ValidationError(msg) if any(t for t in target if len(t) > max_len): raise forms.ValidationError( _(u'All tags must be %s characters ' u'or less after invalid characters are removed.' % max_len)) if any(t for t in target if len(t) < min_len): msg = ngettext(u'All tags must be at least {0} character.', u'All tags must be at least {0} characters.', min_len).format(min_len) raise forms.ValidationError(msg) return target
def render_waiting_time_min(self, row): if row.waiting_time_min == 0: r = _lazy("moments ago") elif row.waiting_time_hours == 0: # L10n: first argument is number of minutes r = ngettext(u"{0} minute", u"{0} minutes", row.waiting_time_min).format(row.waiting_time_min) elif row.waiting_time_days == 0: # L10n: first argument is number of hours r = ngettext(u"{0} hour", u"{0} hours", row.waiting_time_hours).format(row.waiting_time_hours) else: # L10n: first argument is number of days r = ngettext(u"{0} day", u"{0} days", row.waiting_time_days).format(row.waiting_time_days) return jinja2.escape(r)
def clean_tags(request, tags, max_tags=None): """ Blocked tags are not allowed. Restricted tags can only be edited by Reviewers and Curators. """ target = [slugify(t, spaces=True, lower=True) for t in tags.split(',')] target = set(filter(None, target)) min_len = mkt.MIN_TAG_LENGTH max_len = Tag._meta.get_field('tag_text').max_length max_tags = max_tags or mkt.MAX_TAGS total = len(target) blocked = (Tag.objects.values_list('tag_text', flat=True) .filter(tag_text__in=target, blocked=True)) if blocked: # L10n: {0} is a single tag or a comma-separated list of tags. msg = ngettext(u'Invalid tag: {0}', 'Invalid tags: {0}', len(blocked)).format(', '.join(blocked)) raise forms.ValidationError(msg) restricted = (Tag.objects.values_list('tag_text', flat=True) .filter(tag_text__in=target, restricted=True)) if restricted and not can_edit_restricted_tags(request): # L10n: {0} is a single tag or a comma-separated list of tags. msg = ngettext(u'"{0}" is a reserved tag and cannot be used.', u'"{0}" are reserved tags and cannot be used.', len(restricted)).format('", "'.join(restricted)) raise forms.ValidationError(msg) else: # Admin's restricted tags don't count towards the limit. total = len(target - set(restricted)) if total > max_tags: num = total - max_tags msg = ngettext(u'You have {0} too many tags.', u'You have {0} too many tags.', num).format(num) raise forms.ValidationError(msg) if any(t for t in target if len(t) > max_len): raise forms.ValidationError( _(u'All tags must be %s characters ' u'or less after invalid characters are removed.' % max_len)) if any(t for t in target if len(t) < min_len): msg = ngettext(u'All tags must be at least {0} character.', u'All tags must be at least {0} characters.', min_len).format(min_len) raise forms.ValidationError(msg) return target
def clean_tags(self): target = [ slugify(t, spaces=True, lower=True) for t in self.cleaned_data['tags'].split(',') ] target = set(filter(None, target)) min_len = amo.MIN_TAG_LENGTH max_len = Tag._meta.get_field('tag_text').max_length max_tags = amo.MAX_TAGS total = len(target) blacklisted = (Tag.objects.values_list('tag_text', flat=True).filter( tag_text__in=target, blacklisted=True)) if blacklisted: # L10n: {0} is a single tag or a comma-separated list of tags. msg = ngettext('Invalid tag: {0}', 'Invalid tags: {0}', len(blacklisted)).format(', '.join(blacklisted)) raise forms.ValidationError(msg) restricted = (Tag.objects.values_list('tag_text', flat=True).filter( tag_text__in=target, restricted=True)) if not acl.action_allowed(self.request, 'Admin', 'EditAnyAddon'): if restricted: # L10n: {0} is a single tag or a comma-separated list of tags. msg = ngettext('"{0}" is a reserved tag and cannot be used.', '"{0}" are reserved tags and cannot be used.', len(restricted)).format('", "'.join(restricted)) raise forms.ValidationError(msg) else: # Admin's restricted tags don't count towards the limit. total = len(target - set(restricted)) if total > max_tags: num = total - max_tags msg = ngettext('You have {0} too many tags.', 'You have {0} too many tags.', num).format(num) raise forms.ValidationError(msg) if any(t for t in target if len(t) > max_len): raise forms.ValidationError( _('All tags must be %s characters ' 'or less after invalid characters are removed.' % max_len)) if any(t for t in target if len(t) < min_len): msg = ngettext("All tags must be at least {0} character.", "All tags must be at least {0} characters.", min_len).format(min_len) raise forms.ValidationError(msg) return target
def clean_tags(request, tags): target = [slugify(t, spaces=True, lower=True) for t in tags.split(',')] target = set(filter(None, target)) min_len = amo.MIN_TAG_LENGTH max_len = Tag._meta.get_field('tag_text').max_length max_tags = amo.MAX_TAGS total = len(target) blacklisted = (Tag.objects.values_list('tag_text', flat=True) .filter(tag_text__in=target, blacklisted=True)) if blacklisted: # L10n: {0} is a single tag or a comma-separated list of tags. msg = ngettext('Invalid tag: {0}', 'Invalid tags: {0}', len(blacklisted)).format(', '.join(blacklisted)) raise forms.ValidationError(msg) restricted = (Tag.objects.values_list('tag_text', flat=True) .filter(tag_text__in=target, restricted=True)) if not acl.action_allowed(request, 'Addons', 'Edit'): if restricted: # L10n: {0} is a single tag or a comma-separated list of tags. msg = ngettext('"{0}" is a reserved tag and cannot be used.', '"{0}" are reserved tags and cannot be used.', len(restricted)).format('", "'.join(restricted)) raise forms.ValidationError(msg) else: # Admin's restricted tags don't count towards the limit. total = len(target - set(restricted)) if total > max_tags: num = total - max_tags msg = ngettext('You have {0} too many tags.', 'You have {0} too many tags.', num).format(num) raise forms.ValidationError(msg) if any(t for t in target if len(t) > max_len): raise forms.ValidationError( _('All tags must be %s characters or less after invalid characters' ' are removed.' % max_len)) if any(t for t in target if len(t) < min_len): msg = ngettext("All tags must be at least {0} character.", "All tags must be at least {0} characters.", min_len).format(min_len) raise forms.ValidationError(msg) return target
def clean_categories(self): categories = self.cleaned_data['categories'] total = categories.count() max_cat = amo.MAX_CATEGORIES if getattr(self, 'disabled', False) and total: if categories[0].type == amo.ADDON_WEBAPP: raise forms.ValidationError(loc('Categories cannot be changed ' 'while your app is featured for this application.')) else: raise forms.ValidationError(_('Categories cannot be changed ' 'while your add-on is featured for this application.')) if total > max_cat: # L10n: {0} is the number of categories. raise forms.ValidationError(ngettext( 'You can have only {0} category.', 'You can have only {0} categories.', max_cat).format(max_cat)) has_misc = filter(lambda x: x.misc, categories) if has_misc and total > 1: raise forms.ValidationError( _('The miscellaneous category cannot be combined with ' 'additional categories.')) return categories
def clean_categories(self): categories = self.cleaned_data['categories'] total = categories.count() max_cat = amo.MAX_CATEGORIES if getattr(self, 'disabled', False) and total: if categories[0].type == amo.ADDON_WEBAPP: raise forms.ValidationError( _('Categories cannot be changed ' 'while your app is featured for this application.')) else: raise forms.ValidationError( _('Categories cannot be changed ' 'while your add-on is featured for this application.')) if total > max_cat: # L10n: {0} is the number of categories. raise forms.ValidationError( ngettext('You can have only {0} category.', 'You can have only {0} categories.', max_cat).format(max_cat)) has_misc = filter(lambda x: x.misc, categories) if has_misc and total > 1: raise forms.ValidationError( _('The miscellaneous category cannot be combined with ' 'additional categories.')) return categories
def render_waiting_time_min(self, row): if row.waiting_time_min == 0: r = _lazy('moments ago') elif row.waiting_time_hours == 0: # L10n: first argument is number of minutes r = ngettext(u'{0} minute', u'{0} minutes', row.waiting_time_min).format(row.waiting_time_min) elif row.waiting_time_days == 0: # L10n: first argument is number of hours r = ngettext(u'{0} hour', u'{0} hours', row.waiting_time_hours).format(row.waiting_time_hours) else: # L10n: first argument is number of days r = ngettext(u'{0} day', u'{0} days', row.waiting_time_days).format(row.waiting_time_days) return jinja2.escape(r)
def clean_categories(self): if self.disabled: raise forms.ValidationError( _('Categories cannot be changed while your app is featured.')) categories = self.cleaned_data['categories'] set_categories = set(categories.values_list('id', flat=True)) # Supervisored categories don't count towards the max, so subtract # them out if there are any. supervisor_of = self.special_cats() if supervisor_of.exists(): set_categories -= set(supervisor_of.values_list('id', flat=True)) total = len(set_categories) max_cat = amo.MAX_CATEGORIES if total > max_cat: # L10n: {0} is the number of categories. raise forms.ValidationError(ngettext( 'You can have only {0} category.', 'You can have only {0} categories.', max_cat).format(max_cat)) return categories
def themes_commit(request): reviewer = request.user.get_profile() ThemeReviewFormset = formset_factory(forms.ThemeReviewForm) formset = ThemeReviewFormset(request.POST) scores = [] for form in formset: try: lock = ThemeLock.objects.filter( theme_id=form.data[form.prefix + '-theme'], reviewer=reviewer) except MultiValueDictKeyError: # Address off-by-one error caused by management form. continue if lock and form.is_valid(): scores.append(form.save()) # Success message. points = sum(scores) success = ngettext( # L10n: {0} is the number of reviews. {1} is the points just earned. # L10n: {2} is the total number of points the reviewer has overall. '{0} theme review successfully processed (+{1} points, {2} total).', '{0} theme reviews successfully processed (+{1} points, {2} total).', len(scores)).format(len(scores), points, ReviewerScore.get_total(request.amo_user)) amo.messages.success(request, success) if 'theme_redirect_url' in request.session: return redirect(request.session['theme_redirect_url']) else: return redirect(reverse('editors.themes.queue_themes'))
def themes_commit(request): reviewer = request.user.get_profile() ThemeReviewFormset = formset_factory(forms.ThemeReviewForm) formset = ThemeReviewFormset(request.POST) scores = [] for form in formset: try: lock = ThemeLock.objects.filter(theme_id=form.data[form.prefix + '-theme'], reviewer=reviewer) except MultiValueDictKeyError: # Address off-by-one error caused by management form. continue if lock and form.is_valid(): scores.append(form.save()) # Success message. points = sum(scores) success = ngettext( # L10n: {0} is the number of reviews. {1} is the points just earned. # L10n: {2} is the total number of points the reviewer has overall. '{0} theme review successfully processed (+{1} points, {2} total).', '{0} theme reviews successfully processed (+{1} points, {2} total).', len(scores)).format(len(scores), points, ReviewerScore.get_total(request.amo_user)) amo.messages.success(request, success) if 'theme_redirect_url' in request.session: return redirect(request.session['theme_redirect_url']) else: return redirect(reverse('reviewers.themes.queue_themes'))
def queue_tabnav(context): """Returns tuple of tab navigation for the queue pages. Each tuple contains three elements: (tab_code, page_url, tab_text) """ from .views import queue_counts counts = queue_counts() tabnav = [ ( "fast_track", "queue_fast_track", (ngettext("Fast Track ({0})", "Fast Track ({0})", counts["fast_track"]).format(counts["fast_track"])), ), ( "nominated", "queue_nominated", (ngettext("Full Review ({0})", "Full Reviews ({0})", counts["nominated"]).format(counts["nominated"])), ), ( "pending", "queue_pending", (ngettext("Pending Update ({0})", "Pending Updates ({0})", counts["pending"]).format(counts["pending"])), ), ( "prelim", "queue_prelim", ( ngettext("Preliminary Review ({0})", "Preliminary Reviews ({0})", counts["prelim"]).format( counts["prelim"] ) ), ), ( "moderated", "queue_moderated", ( ngettext("Moderated Review ({0})", "Moderated Reviews ({0})", counts["moderated"]).format( counts["moderated"] ) ), ), ] return tabnav
def queue_tabnav(context): """Returns tuple of tab navigation for the queue pages. Each tuple contains three elements: (tab_code, page_url, tab_text) """ counts = queue_counts() return [('apps', 'queue_pending', ngettext('Apps ({0})', 'Apps ({0})', counts['pending']) .format(counts['pending']))]
def queue_tabnav(context): """Returns tuple of tab navigation for the queue pages. Each tuple contains three elements: (tab_code, page_url, tab_text) """ counts = queue_counts() return [('apps', 'queue_pending', ngettext('Apps ({0})', 'Apps ({0})', counts['pending']).format(counts['pending']))]
def queue_tabnav(context): """Returns tuple of tab navigation for the queue pages. Each tuple contains three elements: (tab_code, page_url, tab_text) """ counts = context['queue_counts'] unlisted_counts = context['unlisted_queue_counts'] listed = not context.get('unlisted') if listed: tabnav = [('fast_track', 'queue_fast_track', (ngettext('Fast Track ({0})', 'Fast Track ({0})', counts['fast_track']) .format(counts['fast_track']))), ('nominated', 'queue_nominated', (ngettext('Full Review ({0})', 'Full Reviews ({0})', counts['nominated']) .format(counts['nominated']))), ('pending', 'queue_pending', (ngettext('Pending Update ({0})', 'Pending Updates ({0})', counts['pending']) .format(counts['pending']))), ('prelim', 'queue_prelim', (ngettext('Preliminary Review ({0})', 'Preliminary Reviews ({0})', counts['prelim']) .format(counts['prelim']))), ('moderated', 'queue_moderated', (ngettext('Moderated Review ({0})', 'Moderated Reviews ({0})', counts['moderated']) .format(counts['moderated'])))] else: tabnav = [('nominated', 'unlisted_queue_nominated', (ngettext('Unlisted Full Review ({0})', 'Unlisted Full Reviews ({0})', unlisted_counts['nominated']) .format(unlisted_counts['nominated']))), ('pending', 'unlisted_queue_pending', (ngettext('Unlisted Pending Update ({0})', 'Unlisted Pending Updates ({0})', unlisted_counts['pending']) .format(unlisted_counts['pending']))), ('prelim', 'unlisted_queue_prelim', (ngettext('Unlisted Preliminary Review ({0})', 'Unlisted Preliminary Reviews ({0})', unlisted_counts['prelim']) .format(unlisted_counts['prelim'])))] return tabnav
def timesince(t): """Show relative time deltas. > 7 days, fall back to babel_date.""" diff = (datetime.datetime.now() - t) if diff.days > 7: return babel_date(t) elif diff.days > 0: return ngettext('{0} day ago', '{0} days ago', diff.days).format(diff.days) else: minutes = diff.seconds / 60 hours = minutes / 60 if hours > 0: return ngettext('{0} hour ago', '{0} hours ago', hours).format(hours) elif minutes > 0: return ngettext('{0} minute ago', '{0} minutes ago', minutes).format(minutes) else: # L10n: This means an event that happened only a few seconds ago. return _('just now')
def clean_categories(self): categories = self.cleaned_data['categories'] max_cat = mkt.MAX_CATEGORIES if len(set(categories)) > max_cat: # L10n: {0} is the number of categories. raise forms.ValidationError(ngettext( 'You can have only {0} category.', 'You can have only {0} categories.', max_cat).format(max_cat)) return categories
def clean_categories(self): categories = self.cleaned_data['categories'] max_cat = mkt.MAX_CATEGORIES if len(set(categories)) > max_cat: # L10n: {0} is the number of categories. raise forms.ValidationError( ngettext('You can have only {0} category.', 'You can have only {0} categories.', max_cat).format(max_cat)) return categories
def validate_categories(self, categories): set_categories = set(categories) total = len(set_categories) max_cat = mkt.MAX_CATEGORIES if total > max_cat: # L10n: {0} is the number of categories. raise serializers.ValidationError( ngettext('You can have only {0} category.', 'You can have only {0} categories.', max_cat).format(max_cat)) return categories
def validate_categories(self, categories): set_categories = set(categories) total = len(set_categories) max_cat = mkt.MAX_CATEGORIES if total > max_cat: # L10n: {0} is the number of categories. raise serializers.ValidationError(ngettext( 'You can have only {0} category.', 'You can have only {0} categories.', max_cat).format(max_cat)) return categories
def validate_categories(self, attrs, source): if not attrs.get('categories'): raise serializers.ValidationError('This field is required.') set_categories = set(attrs[source]) total = len(set_categories) max_cat = amo.MAX_CATEGORIES if total > max_cat: # L10n: {0} is the number of categories. raise serializers.ValidationError( ngettext('You can have only {0} category.', 'You can have only {0} categories.', max_cat).format(max_cat)) return attrs
def validate_categories(self, attrs, source): if not attrs.get('categories'): raise serializers.ValidationError('This field is required.') set_categories = set(attrs[source]) total = len(set_categories) max_cat = amo.MAX_CATEGORIES if total > max_cat: # L10n: {0} is the number of categories. raise serializers.ValidationError(ngettext( 'You can have only {0} category.', 'You can have only {0} categories.', max_cat).format(max_cat)) return attrs
def clean_categories(self): categories = self.cleaned_data["categories"] set_categories = set(categories) total = len(set_categories) max_cat = mkt.MAX_CATEGORIES if total > max_cat: # L10n: {0} is the number of categories. raise forms.ValidationError( ngettext("You can have only {0} category.", "You can have only {0} categories.", max_cat).format( max_cat ) ) return categories
def queue_tabnav(context): """Returns tuple of tab navigation for the queue pages. Each tuple contains three elements: (tab_code, page_url, tab_text) """ counts = context['queue_counts'] unlisted_counts = context['unlisted_queue_counts'] listed = not context.get('unlisted') if listed: tabnav = [ ('fast_track', 'queue_fast_track', (ngettext('Fast Track ({0})', 'Fast Track ({0})', counts['fast_track']).format(counts['fast_track']))), ('nominated', 'queue_nominated', (ngettext('Full Review ({0})', 'Full Reviews ({0})', counts['nominated']).format(counts['nominated']))), ('pending', 'queue_pending', (ngettext('Pending Update ({0})', 'Pending Updates ({0})', counts['pending']).format(counts['pending']))), ('prelim', 'queue_prelim', (ngettext('Preliminary Review ({0})', 'Preliminary Reviews ({0})', counts['prelim']).format(counts['prelim']))), ('moderated', 'queue_moderated', (ngettext('Moderated Review ({0})', 'Moderated Reviews ({0})', counts['moderated']).format(counts['moderated']))) ] else: tabnav = [ ('nominated', 'unlisted_queue_nominated', (ngettext('Unlisted Full Review ({0})', 'Unlisted Full Reviews ({0})', unlisted_counts['nominated']).format( unlisted_counts['nominated']))), ('pending', 'unlisted_queue_pending', (ngettext('Unlisted Pending Update ({0})', 'Unlisted Pending Updates ({0})', unlisted_counts['pending']).format( unlisted_counts['pending']))), ('prelim', 'unlisted_queue_prelim', (ngettext( 'Unlisted Preliminary Review ({0})', 'Unlisted Preliminary Reviews ({0})', unlisted_counts['prelim']).format(unlisted_counts['prelim']))) ] return tabnav
def clean_categories(self): categories = self.cleaned_data['categories'] set_categories = set(categories.values_list('id', flat=True)) total = len(set_categories) max_cat = amo.MAX_CATEGORIES if total > max_cat: # L10n: {0} is the number of categories. raise forms.ValidationError(ngettext( 'You can have only {0} category.', 'You can have only {0} categories.', max_cat).format(max_cat)) return categories
def clean_categories(self): categories = self.cleaned_data['categories'] set_categories = set(categories.values_list('id', flat=True)) total = len(set_categories) max_cat = amo.MAX_CATEGORIES if total > max_cat: # L10n: {0} is the number of categories. raise forms.ValidationError( ngettext('You can have only {0} category.', 'You can have only {0} categories.', max_cat).format(max_cat)) return categories
def clean_categories(self): categories = self.cleaned_data['categories'] total = categories.count() max_cat = amo.MAX_CATEGORIES if total > max_cat: raise forms.ValidationError(ngettext( 'You can have only {0} category.', 'You can have only {0} categories.', max_cat).format(max_cat)) has_misc = filter(lambda x: x.misc, categories) if has_misc and total > 1: raise forms.ValidationError( _("The miscellaneous category cannot be combined with " "additional categories.")) return categories
def clean_categories(self): categories = self.cleaned_data['categories'] total = categories.count() max_cat = amo.MAX_CATEGORIES if self.disabled: raise forms.ValidationError( _('Categories cannot be changed while your app is featured.')) if total > max_cat: # L10n: {0} is the number of categories. raise forms.ValidationError( ngettext('You can have only {0} category.', 'You can have only {0} categories.', max_cat).format(max_cat)) return categories
def clean_categories(self): categories = self.cleaned_data['categories'] total = categories.count() max_cat = amo.MAX_CATEGORIES if self.disabled: raise forms.ValidationError( _('Categories cannot be changed while your app is featured.')) if total > max_cat: # L10n: {0} is the number of categories. raise forms.ValidationError(ngettext( 'You can have only {0} category.', 'You can have only {0} categories.', max_cat).format(max_cat)) return categories
def count_term(count): return ngettext('{0} digg', '{0} diggs', count).format(count)
def count_term(count): return ngettext('{0} share', '{0} shares', count).format(count)
def count_term(count): """Render this service's share count with the right term.""" return ngettext('{0} post', '{0} posts', count).format(count)
def count_term(count): return ngettext('{0} email', '{0} emails', count).format(count)
def count_term(count): # L10n: Only change if you have reason! wiki.mozilla.org/AMO:Localizers return ngettext('{0} post on localservice2', '{0} posts on localservice2', count).format(count)
def count_term(count): # L10n: Only change if you have reason! wiki.mozilla.org/AMO:Localizers return ngettext('{0} post on localservice3', '{0} posts on localservice3', count).format(count)
def weekly_downloads(product): cnt = product.weekly_downloads return ngettext('{0} weekly download', '{0} weekly downloads', cnt).format(numberfmt(cnt))
def count_term(count): return ngettext('{0} tweet', '{0} tweets', count).format(count)
def count_term(count): return ngettext('{0} Like', '{0} Likes', count).format(count)