def walkAppyType(self): '''Walks into the Appy type definition and gathers data about the i18n labels.''' # Manage things common to all Appy types # - optional ? if self.appyType.optional: self.generator.tool.addOptionalField(self) # - edit default value ? if self.appyType.editDefault: self.generator.tool.addDefaultField(self) # - put an index on this field? if self.appyType.indexed and \ (self.fieldName not in ('title', 'description')): self.classDescr.addIndexMethod(self) # i18n labels i18nPrefix = "%s_%s" % (self.classDescr.name, self.fieldName) # Create labels for generating them in i18n files. messages = self.generator.labels if self.appyType.hasLabel: messages.append(self.produceMessage(i18nPrefix)) if self.appyType.hasDescr: descrId = i18nPrefix + '_descr' messages.append(self.produceMessage(descrId,isLabel=False)) if self.appyType.hasHelp: helpId = i18nPrefix + '_help' messages.append(self.produceMessage(helpId, isLabel=False)) # Create i18n messages linked to pages and phases, only if there is more # than one page/phase for the class. ppMsgs = [] if len(self.classDescr.getPhases()) > 1: # Create the message for the name of the phase phaseName = self.appyType.page.phase msgId = '%s_phase_%s' % (self.classDescr.name, phaseName) ppMsgs.append(PoMessage(msgId, '', produceNiceMessage(phaseName))) if len(self.classDescr.getPages()) > 1: # Create the message for the name of the page pageName = self.appyType.page.name msgId = '%s_page_%s' % (self.classDescr.name, pageName) ppMsgs.append(PoMessage(msgId, '', produceNiceMessage(pageName))) for poMsg in ppMsgs: if poMsg not in messages: messages.append(poMsg) self.classDescr.labelsToPropagate.append(poMsg) # Create i18n messages linked to groups group = self.appyType.group if group: group.generateLabels(messages, self.classDescr, set()) # Manage things which are specific to String types if self.appyType.type == 'String': self.walkString() # Manage things which are specific to Actions elif self.appyType.type == 'Action': self.walkAction() # Manage things which are specific to Ref types elif self.appyType.type == 'Ref': self.walkRef() # Manage things which are specific to Pod types elif self.appyType.type == 'Pod': self.walkPod()
def getMailingName(self, obj, mailing): '''Gets the name of a particular p_mailing.''' res = None if self.mailingName: # Use the method specified in self.mailingName res = self.mailingName(obj, mailing) if not res: # Deduce a nice name from p_mailing res = gutils.produceNiceMessage(mailing) return res
def getTemplateName(self, obj, fileName): '''Gets the name of a template given its p_fileName.''' res = None if self.templateName: # Use the method specified in self.templateName. res = self.templateName(obj, fileName) # Else, deduce a nice name from p_fileName. if not res: name = os.path.splitext(os.path.basename(fileName))[0] res = gutils.produceNiceMessage(name) return res
def getTemplateName(self, obj, fileName): """Gets the name of a template given its p_fileName.""" res = None if self.templateName: # Use the method specified in self.templateName. res = self.templateName(obj, fileName) # Else, deduce a nice name from p_fileName. if not res: name = os.path.splitext(os.path.basename(fileName))[0] res = gutils.produceNiceMessage(name) return res
def getOdtFieldLabel(self, fieldName): '''Given a p_fieldName, this method creates the label as it will appear in the ODT file.''' return '<text:p><text:bookmark text:name="%s"/>%s</text:p>' % \ (fieldName, produceNiceMessage(fieldName))
def _getPageTitle(self, url): """Returns the documentation page title from its URL.""" res = url.split(".")[0] if res not in ("pod", "gen"): res = produceNiceMessage(res[3:]) return res
def _getPageTitle(self, url): '''Returns the documentation page title from its URL.''' res = url.split('.')[0] if res not in ('pod', 'gen'): res = produceNiceMessage(res[3:]) return res