def _renderTag(self, ctx, year, month, day, namer, readonly): yearTag = T.input(type="text", name=namer('year'), value=year, size=4) monthTag = T.input(type="text", name=namer('month'), value=month, size=2) dayTag = T.input(type="text", name=namer('day'), value=day, size=2) if readonly: tags = (yearTag, monthTag, dayTag) for tag in tags: tag(class_='readonly', readonly='readonly') if self.dayFirst: return dayTag, ' / ', monthTag, ' / ', yearTag, ' ', _('(day/month/year)') else: return monthTag, ' / ', dayTag, ' / ', yearTag, ' ', _('(month/day/year)')
def _renderTag(self, ctx, year, month, day, namer, readonly): years = [(v,v) for v in xrange(self.yearFrom,self.yearTo)] months = self.months days = self.days options = [] if self.noneOption is not None: options.append( T.option(value=self.noneOption[0])[self.noneOption[1]] ) for value in years: if str(value[0]) == str(year): options.append( T.option(value=value[0],selected='selected')[value[1]] ) else: options.append( T.option(value=value[0])[value[1]] ) yearTag = T.select(name=namer('year'))[ options ] options = [] if self.noneOption is not None: options.append( T.option(value=self.noneOption[0])[self.noneOption[1]] ) for value in months: if str(value[0]) == str(month): options.append( T.option(value=value[0],selected='selected')[value[1]] ) else: options.append( T.option(value=value[0])[value[1]] ) monthTag = T.select(name=namer('month'))[ options ] options = [] if self.noneOption is not None: options.append( T.option(value=self.noneOption[0])[self.noneOption[1]] ) for value in days: if str(value[0]) == str(day): options.append( T.option(value=value[0],selected='selected')[value[1]] ) else: options.append( T.option(value=value[0])[value[1]] ) dayTag = T.select(name=namer('day'))[ options ] if readonly: tags = (yearTag, monthTag, dayTag) for tag in tags: tag(class_='readonly', readonly='readonly') if self.dayFirst: return dayTag, ' / ', monthTag, ' / ', yearTag, ' ', _('(day/month/year)') else: return monthTag, ' / ', dayTag, ' / ', yearTag, ' ', _('(month/day/year)')
def render_formatstrings(self, ctx, data): return ctx.tag.clear( )["Demonstration of i18n'ed string formatting: ", _("%(first)d plus %(second)c equals %(result)c, or %(roman)s in roman numbers" ) % { 'first': 1, 'second': '1', 'result': 50, 'roman': 'II', }, ]
def test_simple_flat(self): s = i18n._('foo') r = flat.ten.flatten(s, None) self.assertEqual(r, 'foo')
def test_simple(self): s = i18n._('foo')
def test_simple_flat(self): s = i18n._('foo') r = flat.ten.flatten(s, None) self.assertEquals(r, 'foo')
def render_formatstrings(self, ctx, data): return ctx.tag.clear()[ "Demonstration of i18n'ed string formatting: ", _("%(first)d plus %(second)c equals %(result)c, or %(roman)s in roman numbers") % {"first": 1, "second": "1", "result": 50, "roman": "II"}, ]
def render_message(self, ctx, data): """Render a localised message. The _(..) construct looks the translation up at render time. """ return ctx.tag.clear()[_("Hello")]
def render_message(self, ctx, data): """Render a localised message. The _(..) construct looks the translation up at render time. """ return ctx.tag.clear()[_('Hello')]