drime

French rhyme dictionary with web and CLI interface
git clone https://a3nm.net/git/drime/
Log | Files | Refs | README

commit 2e232e0823d478ad5e0752b18e601aa622fdb07b
parent 6e54136be5bfa013ac6d0500a1913b57518f0bc2
Author: Antoine Amarilli <a3nm@a3nm.net>
Date:   Tue, 10 Jul 2012 22:41:30 +0200

force language with GET parameter

Diffstat:
drime.py | 8+++++++-
1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drime.py b/drime.py @@ -5,8 +5,14 @@ from flask import Flask, render_template, request, jsonify app = Flask(__name__) +languages = ['en', 'fr'] + def get_locale(): - return request.accept_languages.best_match(['en', 'fr']) + if request.args.get('lang'): + lang = request.args.get('lang') + if lang in languages: + return lang + return request.accept_languages.best_match(languages) def get_title(): if get_locale() == 'fr': return "drime -- dictionnaire de rimes"