Skip to content
Browse files

Wrap static strings with ugettext_lazy

  • Loading branch information...
1 parent f162ddc commit f0863eafd92364c3d9c7884dfcbaae9d1e5e87d9 Zenobius Jiricek committed Mar 14, 2012
Showing with 28 additions and 25 deletions.
  1. +1 −1 cmsplugin_embeddedmenu/cms_plugins.py
  2. +5 −3 cmsplugin_embeddedmenu/forms.py
  3. +22 −21 cmsplugin_embeddedmenu/models.py
View
2 cmsplugin_embeddedmenu/cms_plugins.py
@@ -38,7 +38,7 @@ def render(self, context, instance, placeholder):
# If there's an exception (500), default context_processors may not be called.
request = context['request']
except KeyError:
- return "There is no `request` object in the context."
+ return _("There is no `request` object in the context.")
root_page = instance.root
root_page_url = root_page.get_absolute_url()
View
8 cmsplugin_embeddedmenu/forms.py
@@ -16,8 +16,10 @@ def __init__(self, *args, **kwargs):
choices = [self.fields['root'].choices.__iter__().next()]
for page in self.fields['root'].queryset:
choices.append(
- (page.id,
- SafeString(''.join([u"   "*page.level,
- page.__unicode__()]))))
+ (
+ page.id,
+ SafeString(''.join([u"   "*page.level, page.__unicode__()]))
+ )
+ )
self.fields['root'].choices = choices
View
43 cmsplugin_embeddedmenu/models.py
@@ -1,7 +1,10 @@
import os
from django.db import models
+from django.utils.translation import ugettext_lazy as _
+
from cms.models.pluginmodel import CMSPlugin
+
from appconf import AppConf
from .lib.choices import (
@@ -18,49 +21,47 @@ class ApplicationSettings(AppConf):
class MenuPluginSettings(CMSPlugin):
""" Stores options for cmsplugin that Embeds a menu
"""
-# title = models.CharField(max_length=128, blank=True, null=True)
-
- menu_title = models.CharField("Menu Title",
+ menu_title = models.CharField(_("Menu Title"),
blank=True, null=True, max_length=256,
- help_text="""Title of the menu""")
- sub_title = models.CharField("Menu Title",
+ help_text=_("""Title of the menu"""))
+ sub_title = models.CharField(_("Sub Title"),
blank=True, null=True, max_length=256,
- help_text="""subTitle of the menu""")
- description = models.TextField("Menu Title",
+ help_text=_("""Sub Title of the menu"""))
+ description = models.TextField(_("Description"),
blank=True, null=True,
- help_text="""Description for the menu""")
+ help_text=_("""Description for the menu"""))
- container_template = models.CharField("Plugin Template",
+ container_template = models.CharField(_("Plugin Template"),
choices = DynamicTemplateChoices(
path = ApplicationSettings.CONTAINER_TEMPLATE_PATH,
include = '.html'),
max_length = 256,
- help_text = """Use this template to render the menu container""")
+ help_text = _("""Use this template to render the menu container"""))
- tree_template = models.CharField("Tree Template",
+ tree_template = models.CharField(_("Tree Template",)
choices = DynamicTemplateChoices(
path = ApplicationSettings.MENU_TEMPLATE_PATH,
include = '.html'),
max_length = 256,
- help_text = """Use this template to render a menu branch""")
+ help_text = _("""Use this template to render a menu branch"""))
- item_template = models.CharField("Leaf Template",
+ item_template = models.CharField(_("Leaf Template"),
choices = DynamicTemplateChoices(
path = ApplicationSettings.ITEM_TEMPLATE_PATH,
include = '.html'),
max_length = 256,
- help_text = """Use this template to render a leaf(a menu item) of a menu branch.""")
+ help_text = _("""Use this template to render a leaf(a menu item) of a menu branch."""))
root = models.ForeignKey("cms.Page",
default = 1,
- help_text = """Menu tree starts from this page.""")
+ help_text = _("""Menu tree starts from this page."""))
- include_root = models.BooleanField("Include Root",
+ include_root = models.BooleanField(_("Include Root"),
default = True,
- help_text = """Shall the menu also include the root menu item specified?""")
+ help_text = _("""Shall the menu also include the root menu item specified?"""))
- start_level = models.IntegerField(default = 0,
- help_text = """Should the root page also be included in the output?""")
+ start_level = models.IntegerField(_("Start Level"), default = 0,
+ help_text = _("""Should the root page also be included in the output?"""))
- depth = models.IntegerField(default = 0,
- help_text = """How many levels deep to look for menu items to show?""")
+ depth = models.IntegerField(_("Depth"), default = 0,
+ help_text = _("""How many levels deep to look for menu items to show?"""))

0 comments on commit f0863ea

Please sign in to comment.
Something went wrong with that request. Please try again.