Beispiel #1
0
 def getMenuItems(self, context, request):
     """Return menu item entries in a TAL-friendly form."""
     _url = url.absoluteURL(context, request)
     if checkPermission("bungeni.translation.Add", context):
         language = get_language(context)
         available = get_available_translations(context)
         results = []
         for name, obj in get_all_languages().items():
             title = obj["name"]
             # skip the current language
             if name == language:
                 continue
             action_url = "%s/translate?language=%s" % (_url, name)
             extra = {
                 "id": "translation-action-%s" % name,
                 "separator": None,
                 "class": ""
             }
             translation_id = available.get(name)
             results.append(
                 dict(title=title,
                      description="",
                      action=action_url,
                      selected=translation_id is not None,
                      icon=None,
                      extra=extra,
                      submenu=None))
         return results
     else:
         return None
Beispiel #2
0
    def getMenuItems(self, context, request):
        """Return menu item entries in a TAL-friendly form."""
        url = ui_url.absoluteURL(context, request)
        if checkPermission("bungeni.translation.Add", context):
            language = get_language(context)
            available = get_available_translations(context)
            results = []
            for name, obj in get_all_languages().items():
                title = obj['name']
                
                # skip the current language
                if name == language:
                    continue

                translation_id = available.get(name)
                selected = translation_id is not None

                action_url = url + '/translate?language=%s' % name

                extra = {'id': 'translation-action-%s' % name,
                         'separator': None,
                         'class': ''}
                
                results.append(
                    dict(title=title,
                         description="",
                         action=action_url,
                         selected=selected,
                         icon=None,
                         extra=extra,
                         submenu=None))
                         
            return results
        else:
            return None
Beispiel #3
0
 def getMenuItems(self, context, request):
     """Return menu item entries in a TAL-friendly form."""
     _url = url.absoluteURL(context, request)
     if checkPermission("bungeni.translation.Add", context):
         language = get_language(context)
         available = get_available_translations(context)
         results = []
         for name, obj in get_all_languages().items():
             title = obj["name"]
             # skip the current language
             if name == language:
                 continue
             action_url = "%s/translate?language=%s" % (_url, name)
             extra = {
                 "id": "translation-action-%s" % name,
                 "separator": None,
                 "class": ""
             }
             translation_id = available.get(name)
             results.append(
                 dict(title=title,
                      description="",
                      action=action_url,
                      selected=translation_id is not None,
                      icon=None,
                      extra=extra,
                      submenu=None))
         return results
     else:
         return None
Beispiel #4
0
 def extra(self):
     language = get_language(self.context)
     return {
         "id": self.id,
         "class": "language-%s" % language,
         "state": language,
         "stateTitle": language
     }
Beispiel #5
0
 def extra(self):
     language = get_language(self.context)
     return {
         "id": "plone-contentmenu-translation",
         "class": "language-%s" % language,
         "state": language,
         "stateTitle": language
     }
Beispiel #6
0
 def extra(self):
     language = get_language(self.context)
     return {
         "id": self.id,
         "class": "language-%s" % language,
         "state": language,
         "stateTitle": language
     }
Beispiel #7
0
 def extra(self):
     language = get_language(self.context)
     return {
         "id"         : "plone-contentmenu-translation",
         "class"      : "language-%s" % language,
         "state"      : language,
         "stateTitle" : language
         }
Beispiel #8
0
 def extra(self):
     language = get_language(self.context)
     return {
         'id': 'plone-contentmenu-translation',
         'class': 'language-%s' % language,
         'state': language,
         'stateTitle': language
     }
Beispiel #9
0
 def extra(self):
     language = get_language(self.context)
     return {
         'id'         : 'plone-contentmenu-translation',
         'class'      : 'language-%s' % language,
         'state'      : language,
         'stateTitle' : language
         }
Beispiel #10
0
    def getMenuItems(self, context, request):
        """Return menu item entries in a TAL-friendly form."""
        url = ui_url.absoluteURL(context, request)
        if checkPermission("bungeni.translation.Add", context):
            language = get_language(context)
            available = get_available_translations(context)
            results = []
            for name, obj in get_all_languages().items():
                title = obj['name']

                # skip the current language
                if name == language:
                    continue

                translation_id = available.get(name)
                selected = translation_id is not None

                action_url = url + '/translate?language=%s' % name

                extra = {
                    'id': 'translation-action-%s' % name,
                    'separator': None,
                    'class': ''
                }

                results.append(
                    dict(title=title,
                         description="",
                         action=action_url,
                         selected=selected,
                         icon=None,
                         extra=extra,
                         submenu=None))

            return results
        else:
            return None