diff --git a/.gitignore b/.gitignore index f8749fe..94c30c9 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,5 @@ app.db search.db flask +*.mo diff --git a/app/__init__.py b/app/__init__.py index 57bb3d2..99ff54e 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -4,6 +4,7 @@ from flask.ext.sqlalchemy import SQLAlchemy from flask.ext.login import LoginManager from flask.ext.openid import OpenID from flask.ext.mail import Mail +from flask.ext.babel import Babel, lazy_gettext from config import basedir, ADMINS, MAIL_SERVER, MAIL_PORT, MAIL_USERNAME, MAIL_PASSWORD from momentjs import momentjs @@ -13,8 +14,10 @@ db = SQLAlchemy(app) lm = LoginManager() lm.init_app(app) lm.login_view = 'login' +lm.login_message = lazy_gettext('Please log in to access this page.') oid = OpenID(app, os.path.join(basedir, 'tmp')) mail = Mail(app) +babel = Babel(app) if not app.debug: import logging diff --git a/app/forms.py b/app/forms.py index a39fe06..83233a0 100644 --- a/app/forms.py +++ b/app/forms.py @@ -1,5 +1,6 @@ from flask.ext.wtf import Form, TextField, BooleanField, TextAreaField from flask.ext.wtf import Required, Length +from flask.ext.babel import gettext from app.models import User class LoginForm(Form): @@ -19,9 +20,12 @@ class EditForm(Form): return False if self.nickname.data == self.original_nickname: return True + if self.nickname.data != User.make_valid_nickname(self.nickname.data): + self.nickname.errors.append(gettext('This nickname has invalid characters. Please use letters, numbers, dots and underscores only.')) + return False user = User.query.filter_by(nickname = self.nickname.data).first() if user != None: - self.nickname.errors.append('This nickname is already in use. Please choose another one.') + self.nickname.errors.append(gettext('This nickname is already in use. Please choose another one.')) return False return True diff --git a/app/models.py b/app/models.py index 3b1fd48..63c35be 100644 --- a/app/models.py +++ b/app/models.py @@ -2,6 +2,7 @@ from hashlib import md5 from app import db from app import app import flask.ext.whooshalchemy as whooshalchemy +import re ROLE_USER = 0 ROLE_ADMIN = 1 @@ -26,6 +27,10 @@ class User(db.Model): backref = db.backref('followers', lazy = 'dynamic'), lazy = 'dynamic') + @staticmethod + def make_valid_nickname(nickname): + return re.sub('[^a-zA-Z0-9_\.]', '', nickname) + @staticmethod def make_unique_nickname(nickname): if User.query.filter_by(nickname = nickname).first() == None: diff --git a/app/static/js/moment-es.min.js b/app/static/js/moment-es.min.js new file mode 100755 index 0000000..546e172 --- /dev/null +++ b/app/static/js/moment-es.min.js @@ -0,0 +1,4 @@ +// moment.js language configuration +// language : spanish (es) +// author : Julio Napurí : https://github.com/julionc +(function(){function e(e){e.lang("es",{months:"enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre".split("_"),monthsShort:"ene._feb._mar._abr._may._jun._jul._ago._sep._oct._nov._dic.".split("_"),weekdays:"domingo_lunes_martes_mi\u00e9rcoles_jueves_viernes_s\u00e1bado".split("_"),weekdaysShort:"dom._lun._mar._mi\u00e9._jue._vie._s\u00e1b.".split("_"),weekdaysMin:"Do_Lu_Ma_Mi_Ju_Vi_S\u00e1".split("_"),longDateFormat:{LT:"H:mm",L:"DD/MM/YYYY",LL:"D \\de MMMM \\de YYYY",LLL:"D \\de MMMM \\de YYYY LT",LLLL:"dddd, D \\de MMMM \\de YYYY LT"},calendar:{sameDay:function(){return"[hoy a la"+(this.hours()!==1?"s":"")+"] LT"},nextDay:function(){return"[ma\u00f1ana a la"+(this.hours()!==1?"s":"")+"] LT"},nextWeek:function(){return"dddd [a la"+(this.hours()!==1?"s":"")+"] LT"},lastDay:function(){return"[ayer a la"+(this.hours()!==1?"s":"")+"] LT"},lastWeek:function(){return"[el] dddd [pasado a la"+(this.hours()!==1?"s":"")+"] LT"},sameElse:"L"},relativeTime:{future:"en %s",past:"hace %s",s:"unos segundos",m:"un minuto",mm:"%d minutos",h:"una hora",hh:"%d horas",d:"un d\u00eda",dd:"%d d\u00edas",M:"un mes",MM:"%d meses",y:"un a\u00f1o",yy:"%d a\u00f1os"},ordinal:function(e){return"\u00ba"},week:{dow:1,doy:4}})}typeof define=="function"&&define.amd&&define(["moment"],e),typeof window!="undefined"&&window.moment&&e(window.moment)})(); \ No newline at end of file diff --git a/app/templates/404.html b/app/templates/404.html index 203c070..6463c28 100644 --- a/app/templates/404.html +++ b/app/templates/404.html @@ -2,6 +2,6 @@ {% extends "base.html" %} {% block content %} -

File Not Found

-

Back

+

{{ _('File Not Found') }}

+

{{ _('Back') }}

{% endblock %} \ No newline at end of file diff --git a/app/templates/500.html b/app/templates/500.html index 994d77c..152790c 100644 --- a/app/templates/500.html +++ b/app/templates/500.html @@ -2,7 +2,7 @@ {% extends "base.html" %} {% block content %} -

An unexpected error has occurred

-

The administrator has been notified. Sorry for the inconvenience!

-

Back

+

{{ _('An unexpected error has occurred') }}

+

{{ _('The administrator has been notified. Sorry for the inconvenience!') }}

+

{{ _('Back') }}

{% endblock %} \ No newline at end of file diff --git a/app/templates/base.html b/app/templates/base.html index a8fd68d..92497a3 100644 --- a/app/templates/base.html +++ b/app/templates/base.html @@ -11,6 +11,9 @@ + {% if g.locale != 'en' %} + + {% endif %} @@ -24,15 +27,15 @@ microblog @@ -45,3 +48,4 @@ + diff --git a/app/templates/edit.html b/app/templates/edit.html index a1d8288..bd1dde1 100644 --- a/app/templates/edit.html +++ b/app/templates/edit.html @@ -2,13 +2,13 @@ {% extends "base.html" %} {% block content %} -

Edit Your Profile

+

{{ _('Edit Your Profile') }}

{% include 'flash.html' %}
{{form.hidden_tag()}}
- +
{{ form.nickname(maxlength = 64, class = "span4") }} {% for error in form.errors.nickname %} @@ -17,7 +17,7 @@
- +
{{ form.about_me(cols = 64, rows = 4, class = "span4") }} {% for error in form.errors.about_me %} @@ -27,7 +27,7 @@
- +
diff --git a/app/templates/follower_email.html b/app/templates/follower_email.html index b00e00d..7cc91a3 100644 --- a/app/templates/follower_email.html +++ b/app/templates/follower_email.html @@ -1,5 +1,5 @@

Dear {{user.nickname}},

-

{{follower.nickname}} is now a follower.

+

{{ _('%(nickname)s is now a follower.', nickname = '' + follower.nickname + '') }}

@@ -9,5 +9,5 @@
-

Regards,

-

The microblog admin

\ No newline at end of file +

{{ _('Regards,') }}

+

{{ _('The microblog admin') }}

diff --git a/app/templates/follower_email.txt b/app/templates/follower_email.txt index f4c49a2..08c64f8 100644 --- a/app/templates/follower_email.txt +++ b/app/templates/follower_email.txt @@ -1,9 +1,9 @@ -Dear {{user.nickname}}, +{{ _('Dear %(nickname)s,', nickname = user.nickname) }} -{{follower.nickname}} is now a follower. Click on the following link to visit {{follower.nickname}}'s profile page: +{{ _('%(nickname)s is now a follower. Click on the following link to visit %(nickname)s\'s profile page:', nickname = follower.nickname) }} {{url_for("user", nickname = follower.nickname, _external = True)}} -Regards, +{{ _('Regards,') }} -The microblog admin \ No newline at end of file +{{ _('The microblog admin') }} diff --git a/app/templates/index.html b/app/templates/index.html index 8954e6b..5be1beb 100644 --- a/app/templates/index.html +++ b/app/templates/index.html @@ -2,13 +2,13 @@ {% extends "base.html" %} {% block content %} -

Hi, {{g.user.nickname}}!

+

{{ _('Hi, %(nickname)s!', nickname = g.user.nickname) }}

{% include 'flash.html' %}
{{form.hidden_tag()}}
- +
{{ form.post(size = 30, maxlength = 140) }} {% for error in form.errors.post %} @@ -18,7 +18,7 @@
- +
@@ -28,14 +28,14 @@ {% endfor %} -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/app/templates/login.html b/app/templates/login.html index 570abf8..07235d4 100644 --- a/app/templates/login.html +++ b/app/templates/login.html @@ -17,17 +17,17 @@ function set_openid(openid, pr) {% include 'flash.html' %}
-

Please Sign In

+

{{ _('Please Sign In') }}

{{form.hidden_tag()}} -
Click on your OpenID provider below:
+
{{ _('Click on your OpenID provider below:') }}
{% for pr in providers %} {% endfor %}
- +
{{ form.openid(size = 80, class = "span4") }} {% for error in form.errors.openid %} @@ -38,13 +38,13 @@ function set_openid(openid, pr)
- +
diff --git a/app/templates/post.html b/app/templates/post.html index 0207904..52b683a 100644 --- a/app/templates/post.html +++ b/app/templates/post.html @@ -2,7 +2,9 @@ -

{{post.author.nickname}} said {{momentjs(post.timestamp).fromNow()}}:

+ {% autoescape false %} +

{{ _('%(nickname)s said %(when)s:', nickname = '%s' % (url_for('user', nickname = post.author.nickname), post.author.nickname), when = momentjs(post.timestamp).fromNow()) }}

+ {% endautoescape %}

{{post.body}}

diff --git a/app/templates/search_results.html b/app/templates/search_results.html index ef290e0..ea51989 100644 --- a/app/templates/search_results.html +++ b/app/templates/search_results.html @@ -2,7 +2,7 @@ {% extends "base.html" %} {% block content %} -

Search results for "{{query}}":

+

{{ _('Search results for "%(query)s":', query = query) }}

{% include 'flash.html' %} {% for post in results %} {% include 'post.html' %} diff --git a/app/templates/user.html b/app/templates/user.html index a51edf5..35131ca 100644 --- a/app/templates/user.html +++ b/app/templates/user.html @@ -10,15 +10,15 @@

{{user.nickname}}

{% if user.about_me %}

{{user.about_me}}

{% endif %} {% if user.last_seen %} -

Last seen: {{momentjs(user.last_seen).calendar()}}

+

{{ _('Last seen:') }} {{ momentjs(user.last_seen).calendar() }}

{% endif %} -

Followers: {{user.followers.count() - 1}} | Following: {{user.followed.count() - 1}} | +

{{ _('Followers:') }} {{user.followers.count() - 1}} | {{ _('Following:') }} {{user.followed.count() - 1}} | {% if user.id == g.user.id %} - Edit your profile + {{ _('Edit your profile') }} {% elif not g.user.is_following(user) %} - Follow + {{ _('Follow') }} {% else %} - Unfollow + {{ _('Unfollow') }} {% endif %}

@@ -27,14 +27,14 @@ {% endfor %} {% endblock %} diff --git a/app/translations/es/LC_MESSAGES/messages.po b/app/translations/es/LC_MESSAGES/messages.po new file mode 100644 index 0000000..b7d1e30 --- /dev/null +++ b/app/translations/es/LC_MESSAGES/messages.po @@ -0,0 +1,218 @@ +# Spanish translations for PROJECT. +# Copyright (C) 2013 ORGANIZATION +# This file is distributed under the same license as the PROJECT project. +# FIRST AUTHOR , 2013. +# +msgid "" +msgstr "" +"Project-Id-Version: PROJECT VERSION\n" +"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" +"POT-Creation-Date: 2013-01-31 23:19-0800\n" +"PO-Revision-Date: 2013-01-31 23:19-0800\n" +"Last-Translator: Miguel Grinberg \n" +"Language-Team: es \n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 0.9.6\n" +"X-Generator: Poedit 1.5.4\n" + +#: app/__init__.py:17 +msgid "Please log in to access this page." +msgstr "Por favor regístrate para acceder a esta página." + +#: app/forms.py:24 +msgid "" +"This nickname has invalid characters. Please use letters, numbers, dots and " +"underscores only." +msgstr "" +"Este nombre de usuario tiene caracteres inválidos. Por favor usa letras, " +"números, puntos y underscores." + +#: app/forms.py:28 +msgid "This nickname is already in use. Please choose another one." +msgstr "Este nombre de usuario ya esta usado. Por favor elije otro." + +#: app/views.py:49 +msgid "Your post is now live!" +msgstr "¡Tu artículo ha sido publicado!" + +#: app/views.py:74 +msgid "Invalid login. Please try again." +msgstr "Credenciales inválidas. Por favor intenta de nuevo." + +#: app/views.py:107 +#, python-format +msgid "User %(nickname)s not found." +msgstr "El usuario %(nickname)s no existe." + +#: app/views.py:123 +msgid "Your changes have been saved." +msgstr "Tus cambios han sido guardados." + +#: app/views.py:139 +msgid "You can't follow yourself!" +msgstr "¡No te puedes seguir a tí mismo!" + +#: app/views.py:143 +#, python-format +msgid "Cannot follow %(nickname)s." +msgstr "No se pudo seguir a %(nickname)s." + +#: app/views.py:147 +#, python-format +msgid "You are now following %(nickname)s!" +msgstr "¡Ya estás siguiendo a %(nickname)s!" + +#: app/views.py:159 +msgid "You can't unfollow yourself!" +msgstr "¡No te puedes dejar de seguir a tí mismo!" + +#: app/views.py:163 +#, python-format +msgid "Cannot unfollow %(nickname)s." +msgstr "No se pudo dejar de seguir a %(nickname)s." + +#: app/views.py:167 +#, python-format +msgid "You have stopped following %(nickname)s." +msgstr "Ya no sigues más a %(nickname)s." + +#: app/templates/404.html:5 +msgid "File Not Found" +msgstr "Archivo no encontrado" + +#: app/templates/404.html:6 app/templates/500.html:7 +msgid "Back" +msgstr "Volver" + +#: app/templates/500.html:5 +msgid "An unexpected error has occurred" +msgstr "Un error inesperado ha ocurrido" + +#: app/templates/500.html:6 +msgid "The administrator has been notified. Sorry for the inconvenience!" +msgstr "El administrador ha sido notificado. ¡Lo lamento!" + +#: app/templates/base.html:30 +msgid "Home" +msgstr "Inicio" + +#: app/templates/base.html:32 +msgid "Your Profile" +msgstr "Tu Perfil" + +#: app/templates/base.html:33 +msgid "Logout" +msgstr "Desconectarse" + +#: app/templates/base.html:38 +msgid "Search" +msgstr "Buscar" + +#: app/templates/edit.html:5 +msgid "Edit Your Profile" +msgstr "Editar Tu Perfil" + +#: app/templates/edit.html:11 +msgid "Your nickname:" +msgstr "Tu nombre de usuario:" + +#: app/templates/edit.html:20 +msgid "About yourself:" +msgstr "Acerca tuyo:" + +#: app/templates/edit.html:30 +msgid "Save Changes" +msgstr "Guardar" + +#: app/templates/follower_email.html:2 +#, python-format +msgid "%(nickname)s is now a follower." +msgstr "%(nickname)s te está siguiendo." + +#: app/templates/follower_email.html:12 +msgid "Regards," +msgstr "Cordialmente," + +#: app/templates/follower_email.html:13 +msgid "The microblog admin" +msgstr "El administrador de microblog" + +#: app/templates/index.html:5 +#, python-format +msgid "Hi, %(nickname)s!" +msgstr "¡Hola, %(nickname)s!" + +#: app/templates/index.html:11 +msgid "Say something:" +msgstr "Dí algo:" + +#: app/templates/index.html:21 +msgid "Post!" +msgstr "¡Publicar!" + +#: app/templates/index.html:31 app/templates/index.html:33 +#: app/templates/user.html:30 app/templates/user.html:32 +msgid "Newer posts" +msgstr "Artículos nuevos" + +#: app/templates/index.html:36 app/templates/index.html:38 +#: app/templates/user.html:35 app/templates/user.html:37 +msgid "Older posts" +msgstr "Artículos viejos" + +#: app/templates/login.html:20 +msgid "Please Sign In" +msgstr "Por Favor Regístrate" + +#: app/templates/login.html:23 +msgid "Click on your OpenID provider below:" +msgstr "Haz click en tu proveedor de OpenID:" + +#: app/templates/login.html:30 +msgid "Or enter your OpenID here:" +msgstr "O ingresa tu OpenID aquí:" + +#: app/templates/login.html:41 +msgid "Remember Me" +msgstr "Recordarme" + +#: app/templates/login.html:47 +msgid "Sign In" +msgstr "Ingresar" + +#: app/templates/post.html:6 +#, python-format +msgid "%(nickname)s said %(when)s:" +msgstr "%(nickname)s dijo %(when)s:" + +#: app/templates/search_results.html:5 +#, python-format +msgid "Search results for \"%(query)s\":" +msgstr "Resultados de búsqueda de \"%(query)s\":" + +#: app/templates/user.html:13 +msgid "Last seen:" +msgstr "Último acceso:" + +#: app/templates/user.html:15 +msgid "Followers:" +msgstr "Seguidores:" + +#: app/templates/user.html:15 +msgid "Following:" +msgstr "Siguiendo:" + +#: app/templates/user.html:17 +msgid "Edit your profile" +msgstr "Editar Tu Perfil" + +#: app/templates/user.html:19 +msgid "Follow" +msgstr "Seguir" + +#: app/templates/user.html:21 +msgid "Unfollow" +msgstr "Dejar de seguir" diff --git a/app/views.py b/app/views.py index c67c3ec..d55166f 100644 --- a/app/views.py +++ b/app/views.py @@ -1,16 +1,22 @@ from flask import render_template, flash, redirect, session, url_for, request, g from flask.ext.login import login_user, logout_user, current_user, login_required -from app import app, db, lm, oid +from flask.ext.babel import gettext +from app import app, db, lm, oid, babel from forms import LoginForm, EditForm, PostForm, SearchForm from models import User, ROLE_USER, ROLE_ADMIN, Post from datetime import datetime from emails import follower_notification from config import POSTS_PER_PAGE, MAX_SEARCH_RESULTS +from config import LANGUAGES @lm.user_loader def load_user(id): return User.query.get(int(id)) +@babel.localeselector +def get_locale(): + return request.accept_languages.best_match(LANGUAGES.keys()) + @app.before_request def before_request(): g.user = current_user @@ -19,6 +25,7 @@ def before_request(): db.session.add(g.user) db.session.commit() g.search_form = SearchForm() + g.locale = get_locale() @app.errorhandler(404) def internal_error(error): @@ -39,7 +46,7 @@ def index(page = 1): post = Post(body = form.post.data, timestamp = datetime.utcnow(), author = g.user) db.session.add(post) db.session.commit() - flash('Your post is now live!') + flash(gettext('Your post is now live!')) return redirect(url_for('index')) posts = g.user.followed_posts().paginate(page, POSTS_PER_PAGE, False) return render_template('index.html', @@ -64,13 +71,14 @@ def login(): @oid.after_login def after_login(resp): if resp.email is None or resp.email == "": - flash('Invalid login. Please try again.') + flash(gettext('Invalid login. Please try again.')) redirect(url_for('login')) user = User.query.filter_by(email = resp.email).first() if user is None: nickname = resp.nickname if nickname is None or nickname == "": nickname = resp.email.split('@')[0] + nickname = User.make_valid_nickname(nickname) nickname = User.make_unique_nickname(nickname) user = User(nickname = nickname, email = resp.email, role = ROLE_USER) db.session.add(user) @@ -96,7 +104,7 @@ def logout(): def user(nickname, page = 1): user = User.query.filter_by(nickname = nickname).first() if user == None: - flash('User ' + nickname + ' not found.') + flash(gettext('User %(nickname)s not found.', nickname = nickname)) return redirect(url_for('index')) posts = user.posts.paginate(page, POSTS_PER_PAGE, False) return render_template('user.html', @@ -112,7 +120,7 @@ def edit(): g.user.about_me = form.about_me.data db.session.add(g.user) db.session.commit() - flash('Your changes have been saved.') + flash(gettext('Your changes have been saved.')) return redirect(url_for('edit')) elif request.method != "POST": form.nickname.data = g.user.nickname @@ -128,15 +136,15 @@ def follow(nickname): flash('User ' + nickname + ' not found.') return redirect(url_for('index')) if user == g.user: - flash('You can\'t follow yourself!') + flash(gettext('You can\'t follow yourself!')) return redirect(url_for('user', nickname = nickname)) u = g.user.follow(user) if u is None: - flash('Cannot follow ' + nickname + '.') + flash(gettext('Cannot follow %(nickname)s.', nickname = nickname)) return redirect(url_for('user', nickname = nickname)) db.session.add(u) db.session.commit() - flash('You are now following ' + nickname + '!') + flash(gettext('You are now following %(nickname)s!', nickname = nickname)) follower_notification(user, g.user) return redirect(url_for('user', nickname = nickname)) @@ -148,15 +156,15 @@ def unfollow(nickname): flash('User ' + nickname + ' not found.') return redirect(url_for('index')) if user == g.user: - flash('You can\'t unfollow yourself!') + flash(gettext('You can\'t unfollow yourself!')) return redirect(url_for('user', nickname = nickname)) u = g.user.unfollow(user) if u is None: - flash('Cannot unfollow ' + nickname + '.') + flash(gettext('Cannot unfollow %(nickname)s.', nickname = nickname)) return redirect(url_for('user', nickname = nickname)) db.session.add(u) db.session.commit() - flash('You have stopped following ' + nickname + '.') + flash(gettext('You have stopped following %(nickname)s.', nickname = nickname)) return redirect(url_for('user', nickname = nickname)) @app.route('/search', methods = ['POST']) diff --git a/babel.cfg b/babel.cfg new file mode 100644 index 0000000..91cff0a --- /dev/null +++ b/babel.cfg @@ -0,0 +1,4 @@ +[python: **.py] +[jinja2: **/templates/**.html] +extensions=jinja2.ext.autoescape,jinja2.ext.with_ + diff --git a/config.py b/config.py index ad29d77..20bb806 100644 --- a/config.py +++ b/config.py @@ -1,3 +1,4 @@ +# -*- coding: utf8 -*- import os basedir = os.path.abspath(os.path.dirname(__file__)) @@ -23,6 +24,12 @@ MAIL_USE_SSL = False MAIL_USERNAME = 'you' MAIL_PASSWORD = 'your-password' +# available languages +LANGUAGES = { + 'en': 'English', + 'es': 'Español' +} + # administrator list ADMINS = ['you@example.com'] diff --git a/tr_compile.py b/tr_compile.py new file mode 100755 index 0000000..298b9a5 --- /dev/null +++ b/tr_compile.py @@ -0,0 +1,9 @@ +#!flask/bin/python +import os +import sys +if sys.platform == 'win32': + pybabel = 'flask\\Scripts\\pybabel' +else: + pybabel = 'flask/bin/pybabel' +os.system(pybabel + ' compile -d app/translations') + diff --git a/tr_init.py b/tr_init.py new file mode 100755 index 0000000..66e72d8 --- /dev/null +++ b/tr_init.py @@ -0,0 +1,14 @@ +#!flask/bin/python +import os +import sys +if sys.platform == 'win32': + pybabel = 'flask\\Scripts\\pybabel' +else: + pybabel = 'flask/bin/pybabel' +if len(sys.argv) != 2: + print "usage: tr_init " + sys.exit(1) +os.system(pybabel + ' extract -F babel.cfg -k lazy_gettext -o messages.pot app') +os.system(pybabel + ' init -i messages.pot -d app/translations -l ' + sys.argv[1]) +os.unlink('messages.pot') + diff --git a/tr_update.py b/tr_update.py new file mode 100755 index 0000000..ea9212e --- /dev/null +++ b/tr_update.py @@ -0,0 +1,11 @@ +#!flask/bin/python +import os +import sys +if sys.platform == 'wiin32': + pybabel = 'flask\\Scripts\\pybabel' +else: + pybabel = 'flask/bin/pybabel' +os.system(pybabel + ' extract -F babel.cfg -k lazy_gettext -o messages.pot app') +os.system(pybabel + ' update -i messages.pot -d app/translations') +os.unlink('messages.pot') +