How to use the django.utils.translation.ugettext function in Django

To help you get started, we’ve selected a few Django examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github lino-framework / lino / lino / apps / dsbe / dummy_messages.py View on Github external
ugettext('Memo')
ugettext(u'Miscellaneous')
ugettext('Previous page')
ugettext('Cannot show detail for empty foreign key.')
ugettext('of {0}')
ugettext('View')
ugettext('Displaying {0} - {1} of {2}')
ugettext(u'Properties')
ugettext('Last')
ugettext(u'Notes')
ugettext('Last page')
ugettext(u'Courses')
ugettext(u'Contact')
ugettext(u'Art.60-7')
ugettext('Page')
ugettext('First')
ugettext(u'Mails')
ugettext('Expand memo fields')
ugettext(u'Person')
ugettext(u'General')
ugettext('No more records to display. Detail window has been closed.')
ugettext('First page')
ugettext('Select another view of this report')
ugettext(u'VSE')
ugettext(u'Calendar')
ugettext(u'Education')
ugettext('Save changes to text ?')
ugettext('Previous')
github eppye-bots / bots / bots / grammar.py View on Github external
def __init__(self,typeofgrammarfile,editype,grammarname):
        ''' import grammar; read syntax'''
        self.module,self.grammarname = botslib.botsimport(typeofgrammarfile,editype,grammarname)
        #get syntax from grammar file
        self.original_syntaxfromgrammar = getattr(self.module, 'syntax',{})
        if not isinstance(self.original_syntaxfromgrammar,dict):
            raise botslib.GrammarError(_('Grammar "%(grammar)s": syntax is not a dict{}.'),
                                        {'grammar':self.grammarname})
github mozilla / addons-server / src / olympia / discovery / models.py View on Github external
if html:
            authors = ', '.join(
                author.name for author in self.addon.listed_authors)
            url = absolutify(self.addon.get_url_path())
            # addons-frontend will add target and rel attributes to the <a>
            # link. Note: The translated "by" in the middle of both strings is
            # unfortunate, but the full strings are too opaque/dangerous to be
            # handled by translators, since they are just HTML and parameters.
            if self.custom_heading:
                addon_link = format_html(
                    # The query string should not be encoded twice, so we add
                    # it to the template first, via '%'.
                    '</a><a href="{0}?%(query)s">{1} {2} {3}</a>' % {
                        'query': self.build_querystring()},
                    url, addon_name, ugettext('by'), authors)

                value = conditional_escape(custom_heading).replace(
                    '{start_sub_heading}', '<span>').replace(
                    '{end_sub_heading}', '</span>').replace(
                    '{addon_name}', addon_link)
            else:
                value = format_html(
                    # The query string should not be encoded twice, so we add
                    # it to the template first, via '%'.
                    '{0} <span>{1} <a href="{2}?%(query)s">{3}</a></span>' % {
                        'query': self.build_querystring()},
                    addon_name, ugettext('by'), url, authors)
        else:
            if self.custom_heading:
                value = custom_heading.replace(
                    '{start_sub_heading}', '').replace(
github ychab / mymoney / mymoney / apps / banktransactionanalytics / forms.py View on Github external
def clean(self):
        cleaned_data = super(RatioForm, self).clean()

        date_start = cleaned_data.get('date_start')
        date_end = cleaned_data.get('date_end')
        if date_start and date_end and date_start > date_end:
            raise forms.ValidationError(
                _("Date start could not be greater than date end."),
                code='date_start_greater',
            )

        sum_min = cleaned_data.get('sum_min', None)
        sum_max = cleaned_data.get('sum_max', None)
        if sum_min is not None and sum_max is not None and sum_min > sum_max:
            raise forms.ValidationError(
                _("Minimum sum could not be greater than maximum sum."),
                code='sum_min_greater',
            )

        return cleaned_data
github wiedi / kumquat / web / views.py View on Github external
def vhostSnapshotCreate(request, pk):
	if not settings.KUMQUAT_USE_0RPC:
		raise Http404
	v = get_object_or_404(VHost, pk = pk)
	form = SnapshotForm(request.POST or None)
	if form.is_valid():
		z = zerorpc.Client(connect_to=settings.KUMQUAT_BACKEND_SOCKET)
		if z.snapshot_create(v.pk, form.cleaned_data.get("name")):
			messages.success(request, _("Snapshot created"))
		else:
			messages.error(request, _("Snapshot not created"))
		return redirect('web_vhost_snapshot_list', pk)
	return render(request, 'web/snapshot_form.html', {'form': form})
github ozgurlukicin / ozgurlukicin / tema / models.py View on Github external
verbose_name = _("File")
        verbose_name_plural = _("Files")

    def __unicode__(self):
        return self.file

class ScreenShot(models.Model):
    "Screenshot of a theme item"
    image = models.ImageField(upload_to="upload/tema/goruntu/", verbose_name=_("Screenshot"))

    def __unicode__(self):
        return self.image.name

    class Meta:
        verbose_name = _("Screenshot")
        verbose_name_plural = _("Screenshots")

class WallpaperFile(models.Model):
    "A wallpaper file"
    title = models.CharField(_("Title"), max_length=32, blank=True, help_text=_("Leave blank if you want automatic naming by size."))
    scalable = models.BooleanField(default=False)
    image = models.ImageField(upload_to="upload/tema/duvar-kagidi/", verbose_name=_("Wallpaper"))

    def get_absolute_url(self):
        return "/tema/duvar-kagitlari/%s/%s/" % (self.wallpaper_set.all()[0].slug, self.id)

    def get_download_url(self):
        return self.image.url

    def __unicode__(self):
        return self.title or "..." + self.image.name[-24:]
github pretix / pretix / src / pretix / base / services / cart.py View on Github external
'ended': _('The presale period for this event has ended.'),
    'some_subevent_not_started': _('The presale period for this event has not yet started. The affected positions '
                                   'have been removed from your cart.'),
    'some_subevent_ended': _('The presale period for one of the events in your cart has ended. The affected '
                             'positions have been removed from your cart.'),
    'price_too_high': _('The entered price is to high.'),
    'voucher_invalid': _('This voucher code is not known in our database.'),
    'voucher_redeemed': _('This voucher code has already been used the maximum number of times allowed.'),
    'voucher_redeemed_cart': _('This voucher code is currently locked since it is already contained in a cart. This '
                               'might mean that someone else is redeeming this voucher right now, or that you tried '
                               'to redeem it before but did not complete the checkout process. You can try to use it '
                               'again in %d minutes.'),
    'voucher_redeemed_partial': _('This voucher code can only be redeemed %d more times.'),
    'voucher_double': _('You already used this voucher code. Remove the associated line from your '
                        'cart if you want to use it for a different product.'),
    'voucher_expired': _('This voucher is expired.'),
    'voucher_invalid_item': _('This voucher is not valid for this product.'),
    'voucher_invalid_seat': _('This voucher is not valid for this seat.'),
    'voucher_no_match': _('We did not find any position in your cart that we could use this voucher for. If you want '
                          'to add something new to your cart using that voucher, you can do so with the voucher '
                          'redemption option on the bottom of the page.'),
    'voucher_item_not_available': _(
        'Your voucher is valid for a product that is currently not for sale.'),
    'voucher_invalid_subevent': pgettext_lazy('subevent', 'This voucher is not valid for this event date.'),
    'voucher_required': _('You need a valid voucher code to order this product.'),
    'inactive_subevent': pgettext_lazy('subevent', 'The selected event date is not active.'),
    'addon_invalid_base': _('You can not select an add-on for the selected product.'),
    'addon_duplicate_item': _('You can not select two variations of the same add-on product.'),
    'addon_max_count': _('You can select at most %(max)s add-ons from the category %(cat)s for the product %(base)s.'),
    'addon_min_count': _('You need to select at least %(min)s add-ons from the category %(cat)s for the '
                         'product %(base)s.'),
    'addon_only': _('One of the products you selected can only be bought as an add-on to another project.'),
github scaphilo / koalixcrm / koalixcrm / crm / models.py View on Github external
def __str__(self):
            return _("There is no Price for this product") + ": " + self.product.__str__() + _(
                "that matches the date") + ": " + self.date.__str__() + " ," + _(
                "customer") + ": " + self.customer.__str__() + " ," + _("currency")+ ": "+ self.currency.__str__()+ _(" and unit") + ":" + self.unit.__str__()
github zulip / zulip / zerver / lib / hotspots.py View on Github external
# See https://zulip.readthedocs.io/en/latest/subsystems/hotspots.html
# for documentation on this subsystem.
from django.conf import settings
from django.utils.translation import ugettext as _

from zerver.models import UserProfile, UserHotspot

from typing import List, Dict

ALL_HOTSPOTS = {
    'intro_reply': {
        'title': _('Reply to a message'),
        'description': _('Click anywhere on a message to reply.'),
    },
    'intro_streams': {
        'title': _('Catch up on a stream'),
        'description': _('Messages sent to a stream are seen by everyone subscribed '
                         'to that stream. Try clicking on one of the stream links below.'),
    },
    'intro_topics': {
        'title': _('Topics'),
        'description': _('Every message has a topic. Topics keep conversations '
                         'easy to follow, and make it easy to reply to conversations that start '
                         'while you are offline.'),
    },
    'intro_gear': {
        'title': _('Settings'),
        'description': _('Go to Settings to configure your '
                         'notifications and display settings.'),
github mozilla / addons-server / src / olympia / devhub / views.py View on Github external
def send_key_change_email(to_email, key):
    template = loader.get_template('devhub/email/new-key-email.ltxt')
    url = absolutify(reverse('devhub.api_key'))
    send_mail(
        ugettext('New API key created'),
        template.render({'key': key, 'url': url}),
        from_email=settings.DEFAULT_FROM_EMAIL,
        recipient_list=[to_email],
    )