commit f252696e9c2a8186e6c5172418cb8449312568ac
parent 9343593c77acf6b9109bdd9cbdb51ae156bd6c50
Author: Antoine Amarilli <a3nm@a3nm.net>
Date: Tue, 17 Jan 2012 14:58:46 +0100
better title, localization
Diffstat:
2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/drime.py b/drime.py
@@ -7,15 +7,20 @@ app = Flask(__name__)
def get_locale():
return request.accept_languages.best_match(['en', 'fr'])
+def get_title():
+ if get_locale() == 'fr':
+ return "drime -- dictionnaire de rimes"
+ else:
+ return "drime -- French rhyme dictionary"
@app.route('/')
def root():
- return render_template('index.html', title="drime", noform=True,
+ return render_template('index.html', title=get_title(), noform=True,
lang=get_locale())
@app.route('/about')
def about():
- return render_template('about.html', title="drime", pagesize=query.PAGESIZE,
+ return render_template('about.html', title=get_title(), pagesize=query.PAGESIZE,
lang=get_locale())
@app.route('/query')
@@ -37,7 +42,7 @@ def q():
d['lang'] = get_locale()
d['pagesize'] = query.PAGESIZE
d['mode'] = 'query'
- d['title'] = 'drime'
+ d['title'] = get_title()
d['count'] = count
d['displayed'] = min(d['pagesize'], count)
d['keys'] = r['keys']
diff --git a/templates/page.html b/templates/page.html
@@ -3,7 +3,11 @@
<head>
<title>{{ title }}</title>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
+{% if lang == 'fr' %}
+ <meta name="description" content="dictionnaire de rimes drime" />
+{% else %}
<meta name="description" content="drime rhyme dictionary" />
+{% endif %}
<link rel="stylesheet" href="static/main.css" type="text/css" media="screen" />
<link rel="stylesheet" href="static/style.css" type="text/css" media="screen" />
<script type="text/javascript" src="static/jquery.js"></script>