first i18n implementation. It's far from complete yet

This commit is contained in:
EnTeQuAk 2008-07-08 11:19:28 +02:00
parent 449de7d79d
commit f29491f8dd
15 changed files with 185 additions and 146 deletions

View File

@ -16,6 +16,9 @@ from datetime import datetime, timedelta
from werkzeug import SharedDataMiddleware, ClosingIterator from werkzeug import SharedDataMiddleware, ClosingIterator
from werkzeug.exceptions import HTTPException, NotFound from werkzeug.exceptions import HTTPException, NotFound
from babel import Locale
from lodgeit import i18n
from lodgeit.utils import _local_manager, ctx, jinja_environment, \ from lodgeit.utils import _local_manager, ctx, jinja_environment, \
Request Request
from lodgeit.database import metadata, session, Paste from lodgeit.database import metadata, session, Paste
@ -29,17 +32,38 @@ class LodgeIt(object):
def __init__(self, dburi, secret_key): def __init__(self, dburi, secret_key):
#: the secret key used by the captcha #: the secret key used by the captcha
self.secret_key = secret_key self.secret_key = secret_key
#: name of the error handler #: name of the error handler
self.not_found = ('static/not_found', {}) self.not_found = ('static/not_found', {})
self.engine = sqlalchemy.create_engine(dburi, convert_unicode=True) self.engine = sqlalchemy.create_engine(dburi, convert_unicode=True)
#: make sure all tables exist. #: make sure all tables exist.
metadata.create_all(self.engine) metadata.create_all(self.engine)
#: 18n setup
#TODO: load from user cookie
self.locale = None
self.set_locale('de_DE')
#: jinja_environment update
jinja_environment.filters.update(
datetimeformat=i18n.format_datetime
)
#: bind the application to the current context local #: bind the application to the current context local
self.bind_to_context() self.bind_to_context()
def bind_to_context(self): def bind_to_context(self):
ctx.application = self ctx.application = self
def set_locale(self, locale):
if not self.locale or self.locale.language != locale:
self.locale = Locale(locale)
self.translations = i18n.load_translations(self.locale)
#: update gettext translations
jinja_environment.install_gettext_translations(self.translations)
def __call__(self, environ, start_response): def __call__(self, environ, start_response):
"""Minimal WSGI application for request dispatching.""" """Minimal WSGI application for request dispatching."""
#: bind the application to the new context local #: bind the application to the new context local

View File

@ -12,6 +12,7 @@ from werkzeug import redirect, Response
from werkzeug.exceptions import NotFound from werkzeug.exceptions import NotFound
from lodgeit.utils import ctx, render_template from lodgeit.utils import ctx, render_template
from lodgeit.i18n import list_languages, _
from lodgeit.controllers import BaseController from lodgeit.controllers import BaseController
from lodgeit.database import session, Paste from lodgeit.database import session, Paste
from lodgeit.lib import antispam from lodgeit.lib import antispam
@ -41,13 +42,13 @@ class PasteController(BaseController):
spam = ctx.request.form.get('webpage') or antispam.is_spam(code) spam = ctx.request.form.get('webpage') or antispam.is_spam(code)
if spam: if spam:
error = 'your paste contains spam' error = _('your paste contains spam')
captcha = getform('captcha') captcha = getform('captcha')
if captcha: if captcha:
if check_hashed_solution(captcha): if check_hashed_solution(captcha):
error = None error = None
else: else:
error += ' and the CAPTCHA solution was incorrect' error += _(' and the CAPTCHA solution was incorrect')
show_captcha = True show_captcha = True
if code and language and not error: if code and language and not error:
paste = Paste(code, language, parent, ctx.request.user_hash, paste = Paste(code, language, parent, ctx.request.user_hash,
@ -164,6 +165,15 @@ class PasteController(BaseController):
resp.set_cookie('style', style_name) resp.set_cookie('style', style_name)
return resp return resp
def set_language(self):
"""Minimal view that set's a different language. Redirects
back to the page the user is coming from."""
lang = ctx.request.form.get('language')
resp = redirect(ctx.request.environ.get('HTTP_REFERER') or '/')
if lang in list_languages():
ctx.application.set_locale(lang)
return resp
def show_captcha(self): def show_captcha(self):
"""Show a captcha.""" """Show a captcha."""
return Captcha().get_response(set_cookie=True) return Captcha().get_response(set_cookie=True)

View File

@ -11,15 +11,16 @@
from werkzeug.exceptions import NotFound from werkzeug.exceptions import NotFound
from lodgeit.utils import ctx, render_template from lodgeit.utils import ctx, render_template
from lodgeit.i18n import _
from lodgeit.controllers import BaseController from lodgeit.controllers import BaseController
from lodgeit.lib.xmlrpc import xmlrpc from lodgeit.lib.xmlrpc import xmlrpc
HELP_PAGES = [ HELP_PAGES = [
('pasting', 'Pasting'), ('pasting', _('Pasting')),
('advanced', 'Advanced Features'), ('advanced', _('Advanced Features')),
('xmlrpc', 'Using the XMLRPC Interface'), ('xmlrpc', _('Using the XMLRPC Interface')),
('integration', 'Scripts and Editor Integration') ('integration', _('Scripts and Editor Integration'))
] ]
known_help_pages = set(x[0] for x in HELP_PAGES) known_help_pages = set(x[0] for x in HELP_PAGES)

View File

@ -8,6 +8,7 @@
:copyright: 2007 by Armin Ronacher. :copyright: 2007 by Armin Ronacher.
:license: BSD :license: BSD
""" """
from lodgeit.i18n import _
import pygments import pygments
from pygments.util import ClassNotFound from pygments.util import ClassNotFound
from pygments.lexers import get_lexer_by_name from pygments.lexers import get_lexer_by_name
@ -19,51 +20,51 @@ from pygments.formatters import HtmlFormatter
#: we use a hardcoded list here because we want to keep the interface #: we use a hardcoded list here because we want to keep the interface
#: simple #: simple
LANGUAGES = { LANGUAGES = {
'text': 'Text', 'text': _('Text'),
'python': 'Python', 'python': _('Python'),
'pycon': 'Python Console Sessions', 'pycon': _('Python Console Sessions'),
'pytb': 'Python Tracebacks', 'pytb': _('Python Tracebacks'),
'html+php': 'PHP', 'html+php': _('PHP'),
'html+django': 'Django / Jinja Templates', 'html+django': _('Django / Jinja Templates'),
'html+mako': 'Mako Templates', 'html+mako': _('Mako Templates'),
'html+myghty': 'Myghty Templates', 'html+myghty': _('Myghty Templates'),
'apache': 'Apache Config (.htaccess)', 'apache': _('Apache Config (.htaccess)'),
'bash': 'Bash', 'bash': _('Bash'),
'bat': 'Batch (.bat)', 'bat': _('Batch (.bat)'),
'c': 'C', 'c': _('C'),
'cpp': 'C++', 'cpp': _('C++'),
'csharp': 'C#', 'csharp': _('C#'),
'css': 'CSS', 'css': _('CSS'),
'd': 'D', 'd': _('D'),
'minid': 'MiniD', 'minid': _('MiniD'),
'smarty': 'Smarty', 'smarty': _('Smarty'),
'html': 'HTML', 'html': _('HTML'),
'html+php': 'PHP', 'html+php': _('PHP'),
'html+genshi': 'Genshi Templates', 'html+genshi': _('Genshi Templates'),
'js': 'JavaScript', 'js': _('JavaScript'),
'java': 'Java', 'java': _('Java'),
'jsp': 'JSP', 'jsp': _('JSP'),
'lua': 'Lua', 'lua': _('Lua'),
'haskell': 'Haskell', 'haskell': _('Haskell'),
'scheme': 'Scheme', 'scheme': _('Scheme'),
'ruby': 'Ruby', 'ruby': _('Ruby'),
'irb': 'Interactive Ruby', 'irb': _('Interactive Ruby'),
'perl': 'Perl', 'perl': _('Perl'),
'rhtml': 'eRuby / rhtml', 'rhtml': _('eRuby / rhtml'),
'tex': 'TeX / LaTeX', 'tex': _('TeX / LaTeX'),
'xml': 'XML', 'xml': _('XML'),
'rst': 'reStructuredText', 'rst': _('reStructuredText'),
'irc': 'IRC Logs', 'irc': _('IRC Logs'),
'diff': 'Unified Diff', 'diff': _('Unified Diff'),
'vim': 'Vim Scripts', 'vim': _('Vim Scripts'),
'ocaml': 'OCaml', 'ocaml': _('OCaml'),
'sql': 'SQL', 'sql': _('SQL'),
'squidconf': 'SquidConf', 'squidconf': _('SquidConf'),
'sourceslist': 'sources.list', 'sourceslist': _('sources.list'),
'erlang': 'Erlang', 'erlang': _('Erlang'),
'vim': 'Vim', 'vim': _('Vim'),
'dylan': 'Dylan', 'dylan': _('Dylan'),
'gas': 'GAS' 'gas': _('GAS')
} }
STYLES = dict((x, x.title()) for x in get_all_styles()) STYLES = dict((x, x.title()) for x in get_all_styles())

View File

@ -9,6 +9,7 @@
:license: BSD :license: BSD
""" """
import math import math
from lodgeit.i18n import _
def generate_pagination(page, per_page, total, link_builder=None, def generate_pagination(page, per_page, total, link_builder=None,
@ -71,15 +72,15 @@ def generate_pagination(page, per_page, total, link_builder=None,
if next_link: if next_link:
if next is not None: if next is not None:
result.append(u' <a href="%s">Next &raquo;</a>' % result.append(_(u' <a href="%(link)s">Next &raquo;</a>') %
link_builder(next)) link_builder(next))
elif gray_next_link: elif gray_next_link:
result.append(u' <span class="disabled">Next &raquo;</span>') result.append(_(u' <span class="disabled">Next &raquo;</span>'))
if prev_link: if prev_link:
if prev is not None: if prev is not None:
result.insert(0, u'<a href="%s">&laquo; Prev</a> ' % result.insert(0, _(u'<a href="%(link)s">&laquo; Prev</a> ') %
link_builder(prev)) link_builder(prev))
elif gray_prev_link: elif gray_prev_link:
result.insert(0, u'<span class="disabled">&laquo; Prev</span> ') result.insert(0, _(u'<span class="disabled">&laquo; Prev</span> '))
return u''.join(result) return u''.join(result)

View File

@ -29,17 +29,18 @@ _local_manager = LocalManager(ctx)
#: jinja environment for all the templates #: jinja environment for all the templates
jinja_environment = Environment(loader=FileSystemLoader( jinja_environment = Environment(loader=FileSystemLoader(
path.join(path.dirname(__file__), 'views'))) path.join(path.dirname(__file__), 'views')),
extensions=['jinja2.ext.i18n'])
_word_only = partial(re.compile(r'[^a-zA-Z0-9]').sub, '') _word_only = partial(re.compile(r'[^a-zA-Z0-9]').sub, '')
def datetimeformat(obj): def get_application():
"""Helper filter for the template""" return getattr(ctx, 'application', None)
return obj.strftime('%Y-%m-%d @ %H:%M')
jinja_environment.filters['datetimeformat'] = datetimeformat
def get_request():
return getattr(ctx, 'request', None)
def generate_user_hash(): def generate_user_hash():

View File

@ -1,64 +1,64 @@
{% extends "layout.html" %} {% extends "layout.html" %}
{% set page_title = 'About LodgeIt' %} {% set page_title = _('About LodgeIt') %}
{% set active_page = 'about' %} {% set active_page = 'about' %}
{% block body %} {% block body %}
<div class="text"> <div class="text">
<h3 id="why-the-hell-another-pastebin">Why the hell another pastebin?</h3> <h3 id="why-the-hell-another-pastebin">{% trans %} Why the hell another pastebin?{% endtrans %}</h3>
<p> <p>{% trans %}
Good question. Basically the world doesn't need another pastebin. Good question. Basically the world doesn't need another pastebin.
There is <a href="http://pastie.caboo.se/">pastie</a> and There is <a href="http://pastie.caboo.se/">pastie</a> and
<a href="http://dpaste.com/">dpaste.com</a> which <a href="http://dpaste.com/">dpaste.com</a> which
both use kick-ass highlighting libraries for highlighting the both use kick-ass highlighting libraries for highlighting the
code and both have an intuitive user interface. Nevertheless there code and both have an intuitive user interface. Nevertheless there
are some features which are unique to LodgeIt. are some features which are unique to LodgeIt.{% endtrans %}
</p> </p>
<h3 id="features">Features</h3> <h3 id="features">{% trans %}Features{% endtrans %}</h3>
<ul> <ul>
<li>clean user interface</li> <li>{% trans %}clean user interface{% endtrans %}</li>
<li>different color schemes for the sourcecode</li> <li>{% trans %}different color schemes for the sourcecode{% endtrans %}</li>
<li>reply to pastes</li> <li>{% trans %}reply to pastes{% endtrans %}</li>
<li>diffs of different pastes</li> <li>{% trans %}diffs of different pastes{% endtrans %}</li>
<li>support for many python template languages</li> <li>{% trans %}support for many python template languages{% endtrans %}</li>
<li>support for many scripting languages like Python and Ruby, even with <li>{% trans %}support for many scripting languages like Python and Ruby, even with
weird syntax (ruby *cough*)</li> weird syntax (ruby *cough*){% endtrans %}</li>
<li><a href="/help/xmlrpc/">XMLRPC support</a></li> <li><a href="/help/xmlrpc/">{% trans %}XMLRPC support{% endtrans %}</a></li>
<li>command-line <a href="http://dev.pocoo.org/hg/lodgeit-main/raw-file/-1/scripts/lodgeit.py">client script</a></li> <li>{% trans %}command-line <a href="http://dev.pocoo.org/hg/lodgeit-main/raw-file/-1/scripts/lodgeit.py">client script</a>{% endtrans %}</li>
<li><a href="http://www.vim.org/scripts/script.php?script_id=1965">vim integration</a></li> <li><a href="http://www.vim.org/scripts/script.php?script_id=1965">{% trans %}vim integration{% endtrans %}</a></li>
<li><a href="http://lunaryorn.de/projects/paste/">emacs integration</a></li> <li><a href="http://lunaryorn.de/projects/paste/">{% trans %}emacs integration{% endtrans %}</a></li>
<li>persistent pastes</li> <li>{% trans %}persistent pastes{% endtrans %}</li>
<li>reply notification</li> <li>{% trans %}reply notification{% endtrans %}</li>
<li>valid HTML 4.0</li> <li>{% trans %}valid HTML 4.0{% endtrans %}</li>
</ul> </ul>
<h3 id="request-more-languages">Request More Languages</h3> <h3 id="request-more-languages">{% trans %}Request More Languages{% endtrans %}</h3>
<p> <p>{% trans %}
A language is missing in the list? File a ticket in the A language is missing in the list? File a ticket in the
<a href="http://dev.pocoo.org/projects/pygments">Pygments trac</a> and we add that as soon <a href="http://dev.pocoo.org/projects/pygments">Pygments trac</a> and we add that as soon
as possible. as possible.{% endtrans %}
</p> </p>
<h3 id="software-used">Software Used</h3> <h3 id="software-used">{% trans %}Software Used{% endtrans %}</h3>
<ul> <ul>
<li><a href="http://pygments.pocoo.org/">Pygments</a> for syntax highlighting</li> <li>{% trans %}<a href="http://pygments.pocoo.org/">Pygments</a> for syntax highlighting{% endtrans %}</li>
<li><a href="http://www.python.org/">Python</a> as scripting language</li> <li>{% trans %}<a href="http://www.python.org/">Python</a> as scripting language{% endtrans %}</li>
<li><a href="http://jinja.pocoo.org/2">Jinja 2</a> for templating</li> <li>{% trans %}<a href="http://jinja.pocoo.org/2">Jinja 2</a> for templating{% endtrans %}</li>
<li><a href="http://werkzeug.pocoo.org/">Werkzeug</a> for the WSGI implementation</li> <li>{% trans %}<a href="http://werkzeug.pocoo.org/">Werkzeug</a> for the WSGI implementation{% endtrans %}</li>
<li><a href="http://www.sqlalchemy.org">SQLAlchemy</a> as database layer</li> <li>{% trans %}<a href="http://www.sqlalchemy.org">SQLAlchemy</a> as database layer{% endtrans %}</li>
<li><a href="http://www.jquery.com/">jQuery</a> for scripting</li> <li>{% trans %}<a href="http://www.jquery.com/">jQuery</a> for scripting{% endtrans %}</li>
</ul> </ul>
<h3 id="who">Who?</h3> <h3 id="who">{% trans %}Who?{% endtrans %}</h3>
<p> <p>{% trans %}
This paste was founded by <a href="http://lucumr.pocoo.org/">Armin Ronacher</a> from the pocoo This paste was founded by <a href="http://lucumr.pocoo.org/">Armin Ronacher</a> from the pocoo
team and is now maintained by <a href="http://webshox.org">Christopher Grebs</a>. team and is now maintained by <a href="http://webshox.org">Christopher Grebs</a>.
Pygments is a pocoo project led by Georg Brandl. Pygments is a pocoo project led by Georg Brandl.{% endtrans %}
</p> </p>
<h3 id="privacy">Privacy</h3> <h3 id="privacy">{% trans %}Privacy{% endtrans %}</h3>
<p> <p>{% trans %}
LodgeIt does not use user accounts because it's logging in for using a LodgeIt does not use user accounts because it's logging in for using a
pastebin is useles. However this pastebin creates unique user ids for you pastebin is useles. However this pastebin creates unique user ids for you
and for 31 days. Whenever you return to the pastebin it will notify you and for 31 days. Whenever you return to the pastebin it will notify you
about replies to your pastes. If you don't want to have that feature you about replies to your pastes. If you don't want to have that feature you
can let lodgeit forget about you by can let lodgeit forget about you by
<a href="javascript:LodgeIt.removeCookie()">removing the cookie</a>. <a href="javascript:LodgeIt.removeCookie()">removing the cookie</a>.
Please note that on the next request you will get a new id. Please note that on the next request you will get a new id.{% endtrans %}
</p> </p>
</div> </div>
{% endblock %} {% endblock %}

View File

@ -19,9 +19,9 @@
<div id="header"><h1>Lodge It</h1></div> <div id="header"><h1>Lodge It</h1></div>
<ul id="navigation"> <ul id="navigation">
{%- for href, id, caption in [ {%- for href, id, caption in [
('/', 'new', 'New'), ('/', 'new', _('New')),
('/all/', 'all', 'All'), ('/all/', 'all', _('All')),
('/about/', 'about', 'About'), ('/about/', 'about', _('About')),
('/help/', 'help', '?') ('/help/', 'help', '?')
] %} ] %}
<li{% if active_page == id %} class="active"{% <li{% if active_page == id %} class="active"{%
@ -32,29 +32,30 @@
<h2>{{ page_title|e }}</h2> <h2>{{ page_title|e }}</h2>
{%- if new_replies %} {%- if new_replies %}
<div class="notification"> <div class="notification">
<h3>Someone Replied To Your Paste</h3> <h3>{% trans %}Someone Replied To Your Paste{% endtrans %}</h3>
{% for paste in new_replies %} {% for paste in new_replies %}
<p> <p>{% trans date=paste.pub_date|datetimeformat, parent=paste.parent.paste_id,
on {{ paste.pub_date|datetimeformat }} someone replied to paste=paste.paste_id, paste_url=paste.url|e, parent_url=paste.parnent.url|e %}
your paste <a href="{{ paste.parent.url|e }}">#{{ paste.parent.paste_id }}</a>, on {{ date }} someone replied to your paste
in paste <a href="{{ paste.url|e }}">#{{ paste.paste_id }}</a>. Click here to <a href="{{ parent_url }}">#{{ parent }}</a>,
<a href="/compare/{{ paste.paste_id }}/{{ paste.parent.paste_id }}/">compare in paste <a href="{{ paste_url }}">#{{ paste }}</a>. Click here to
those two pastes</a>. <a href="/compare/{{ paste }}/{{ parent }}/">compare
those two pastes</a>.{% endtrans %}
</p> </p>
{% endfor %} {% endfor %}
<p><a href="javascript:LodgeIt.hideNotification()">hide this notification</a></p> <p><a href="javascript:LodgeIt.hideNotification()">{% trans %}hide this notification{% endtrans %}</a></p>
</div> </div>
{% elif request.first_visit %} {% elif request.first_visit %}
<div class="notification"> <div class="notification">
<h3>Welcome On LodgeIt</h3> <h3>{% trans %}Welcome On LodgeIt{% endtrans %}</h3>
<p> <p>{%- trans -%}
Welcome to the LodgeIt pastebin. In order to use the notification feature Welcome to the LodgeIt pastebin. In order to use the notification feature
a 31 day cookie with an unique ID was created for you. The lodgeit database a 31 day cookie with an unique ID was created for you. The lodgeit database
does not store any information about you, it's just used for an advanced does not store any information about you, it's just used for an advanced
pastebin experience :-). Read more on the <a href="/about/#privacy">about pastebin experience :-). Read more on the <a href="/about/#privacy">about
lodgeit</a> page. Have fun :-) lodgeit</a> page. Have fun :-){%- endtrans -%}
</p> </p>
<p><a href="javascript:LodgeIt.hideNotification()">hide this notification</a></p> <p><a href="javascript:LodgeIt.hideNotification()">{% trans %}hide this notification{% endtrans %}</a></p>
</div> </div>
{% endif -%} {% endif -%}
{% block body %}{% endblock -%} {% block body %}{% endblock -%}

View File

@ -1,20 +1,20 @@
{% extends "layout.html" %} {% extends "layout.html" %}
{% set page_title = 'New Paste' %} {% set page_title = _('New Paste') %}
{% set active_page = 'new' %} {% set active_page = 'new' %}
{% block body %} {% block body %}
<form action="/" method="post" class="submitform"> <form action="/" method="post" class="submitform">
{%- if error %} {%- if error %}
<div class="notification"> <div class="notification">
<h3>Error While Pasting</h3> <h3>{% trans %}Error While Pasting{% endtrans %}</h3>
<p>Could not submit your paste because {{ error|e }}.</p> <p>{% trans error=error|e %}Could not submit your paste because {{ error }}.{% endtrans %}</p>
{%- if show_captcha %} {%- if show_captcha %}
<div class="captcha"> <div class="captcha">
<p>Please fill out the CAPTCHA to proceed:</p> <p>{% trans %}Please fill out the CAPTCHA to proceed:{% endtrans %}</p>
<img src="/_captcha.png" alt="a captcha you can't see. Sorry :("> <img src="/_captcha.png" alt="{% trans %}a captcha you can't see. Sorry :({% endtrans %}">
<input type="text" name="captcha" size="20"> <input type="text" name="captcha" size="20">
</div> </div>
{%- else %} {%- else %}
<p><a href="javascript:LodgeIt.hideNotification()">hide this message</a></p> <p><a href="javascript:LodgeIt.hideNotification()">{% trans %}hide this message{% endtrans %}</a></p>
{%- endif %} {%- endif %}
</div> </div>
{%- endif %} {%- endif %}
@ -29,10 +29,10 @@
{%- endfor %} {%- endfor %}
</select> </select>
<input type="text" value="" name="webpage" id="webpage"> <input type="text" value="" name="webpage" id="webpage">
<input type="submit" value="Paste!"> <input type="submit" value="{% trans %}Paste!{% endtrans %}">
<input type="button" value="▲" onclick="LodgeIt.resizeTextarea(-100)"> <input type="button" value="▲" onclick="LodgeIt.resizeTextarea(-100)">
<input type="button" value="▼" onclick="LodgeIt.resizeTextarea(100)"> <input type="button" value="▼" onclick="LodgeIt.resizeTextarea(100)">
<input type="checkbox" name="private" id="private"{% if private <input type="checkbox" name="private" id="private"{% if private
%} checked{% endif %}><label for="private">make this paste private</label> %} checked{% endif %}><label for="private">{% trans %}make this paste private{% endtrans %}</label>
</form> </form>
{% endblock %} {% endblock %}

View File

@ -1,16 +1,16 @@
{% extends "layout.html" %} {% extends "layout.html" %}
{% set page_title = 'Page Not Found' %} {% set page_title = _('Page Not Found') %}
{% block body %} {% block body %}
<p> <p>
Sorry, but the page you requested was not found on this server. {% trans %}Sorry, but the page you requested was not found on this server.{% endtrans %}
</p> </p>
<p> <p>{% trans %}
We've recently updated this pastebin. While it is out goal for nothing to get We've recently updated this pastebin. While it is out goal for nothing to get
lost, you may have found a page that was mis-placed. Check your URL to ensure lost, you may have found a page that was mis-placed. Check your URL to ensure
you have gone where you intended. If everything looks OK and you still see you have gone where you intended. If everything looks OK and you still see
this error page, please consider <a href="/about">contacting us</a>. this error page, please consider <a href="/about">contacting us</a>.{% endtrans %}
</p> </p>
<p> <p>
Click <a href="/">here</a> to add a new paste. {% trans %}Click <a href="/">here</a> to add a new paste.{% endtrans %}
</p> </p>
{% endblock %} {% endblock %}

View File

@ -1,10 +1,10 @@
{% extends "layout.html" %} {% extends "layout.html" %}
{% set page_title = 'Paste Tree' %} {% set page_title = _('Paste Tree') %}
{% set active_page = 'all' %} {% set active_page = 'all' %}
{% block body %} {% block body %}
<p> <p>{% trans %}
Here you can see the requested tree of paste replies. The paste you're Here you can see the requested tree of paste replies. The paste you're
coming from is highlighted. coming from is highlighted.{% endtrans %}
</p> </p>
<ul class="paste_tree"> <ul class="paste_tree">
{%- for paste in [paste] recursive %} {%- for paste in [paste] recursive %}

View File

@ -1,5 +1,5 @@
{% extends "layout.html" %} {% extends "layout.html" %}
{% set page_title = 'All Pastes' %} {% set page_title = _('All Pastes') %}
{% set active_page = 'all' %} {% set active_page = 'all' %}
{% block body %} {% block body %}
<ul class="paste_list"> <ul class="paste_list">

View File

@ -3,18 +3,18 @@
{% set active_page = 'all' %} {% set active_page = 'all' %}
{% block body %} {% block body %}
<div class="related"> <div class="related">
<h3><a href="javascript:LodgeIt.toggleRelatedBox()">Paste Details</a></h3> <h3><a href="javascript:LodgeIt.toggleRelatedBox()">{% trans %}Paste Details{% endtrans %}</a></h3>
<div class="content"> <div class="content">
<p>posted on {{ paste.pub_date|datetimeformat }}</p> <p>{% trans pub_date=paste.pub_date|datetimeformat %}posted on {{ pub_date }}{% endtrans %}</p>
<ul> <ul>
<li><a class="autoclose" href="/?reply_to={{ paste.identifier }}">reply to this paste</a></li> <li><a class="autoclose" href="/?reply_to={{ paste.identifier }}">{% trans %}reply to this paste{% endtrans %}</a></li>
{% if paste.parent %} {% if paste.parent %}
<li><a class="autoclose" href="/compare/{{ paste.identifier }}/{{ <li><a class="autoclose" href="/compare/{{ paste.identifier }}/{{
paste.parent.identifier }}/">compare it with the parent paste</a></li> paste.parent.identifier }}/">{% trans %}compare it with the parent paste{% endtrans %}</a></li>
<li><a class="autoclose" href="{{ paste.parent.url|e }}">look at the parent paste</a></li> <li><a class="autoclose" href="{{ paste.parent.url|e }}">{% trans %}look at the parent paste{% endtrans %}</a></li>
{% endif %} {% endif %}
{% if paste.children %} {% if paste.children %}
<li>the following pastes replied to this paste: <li>{% trans %}the following pastes replied to this paste:{% endtrans %}
{% for child in paste.children %} {% for child in paste.children %}
<a class="autoclose" href="{{ child.url|e }}">#{{ child.identifier }}</a> <a class="autoclose" href="{{ child.url|e }}">#{{ child.identifier }}</a>
{%- if not loop.last %},{% endif -%} {%- if not loop.last %},{% endif -%}
@ -22,24 +22,24 @@
</li> </li>
{% endif %} {% endif %}
{% if paste.parent or paste.children %} {% if paste.parent or paste.children %}
<li><a href="/tree/{{ paste.identifier }}/">show paste tree</a></li> <li><a href="/tree/{{ paste.identifier }}/">{% trans %}show paste tree{% endtrans %}</a></li>
{% endif %} {% endif %}
<li><a href="/raw/{{ paste.identifier }}/">download paste</a></li> <li><a href="/raw/{{ paste.identifier }}/">{% trans %}download paste{% endtrans %}</a></li>
<li>compare with paste <form action="/compare/" method="post"> <li>{% trans %}compare with paste{% endtrans %} <form action="/compare/" method="post">
<input type="hidden" name="old" value="{{ paste.identifier }}"> <input type="hidden" name="old" value="{{ paste.identifier }}">
<input type="text" name="new" value="#"> <input type="text" name="new" value="#">
<input type="submit" value="compare"> <input type="submit" value="{% trans %}compare{% endtrans %}">
</form></li> </form></li>
<li>select different colorscheme <form action="/colorscheme/" method="post"> <li>{% trans %}select different colorscheme{% endtrans %} <form action="/colorscheme/" method="post">
<select name="style"> <select name="style">
{%- for key, caption in styles|dictsort %} {%- for key, caption in styles|dictsort %}
<option value="{{ key }}"{% if key == style <option value="{{ key }}"{% if key == style
%} selected="selected"{% endif %}>{{ caption }}</option> %} selected="selected"{% endif %}>{{ caption }}</option>
{%- endfor %} {%- endfor %}
</select> </select>
<input type="submit" value="change"> <input type="submit" value="{% trans %}change{% endtrans %}">
</form></li> </form></li>
<li><a href="?linenos={{ linenos and 'no' or 'yes' }}" onclick="LodgeIt.toggleLineNumbers(); return false;">toggle line numbers</a></li> <li><a href="?linenos={{ linenos and 'no' or 'yes' }}" onclick="LodgeIt.toggleLineNumbers(); return false;">{% trans %}toggle line numbers{% endtrans %}</a></li>
</ul> </ul>
</div> </div>
</div> </div>

View File

@ -1,13 +1,13 @@
{% extends "layout.html" %} {% extends "layout.html" %}
{% set page_title = "XMLRPC" %} {% set page_title = _('XMLRPC') %}
{% set active_page = 'about' %} {% set active_page = 'about' %}
{% block body %} {% block body %}
<div class="text"> <div class="text">
<h3>XMLRPC Entrypoint</h3> <h3>{% trans %}XMLRPC Entrypoint{% endtrans %}</h3>
<p> <p>{% trans %}
This is the entrypoint for the XMLRPC system. If you're interested This is the entrypoint for the XMLRPC system. If you're interested
in using it head over to the <a href="/help/xmlrpc/">XMLRPC in using it head over to the <a href="/help/xmlrpc/">XMLRPC documentation</a>.
documentation</a>. {%- endtrans %}
</p> </p>
</div> </div>
{% endblock %} {% endblock %}