Pluginless translation.

This commit is contained in:
Alexandre Vicenzi 2016-08-11 21:05:34 -03:00
parent 549a882acb
commit 723e047add
6 changed files with 18 additions and 22 deletions

View file

@ -10,6 +10,8 @@ A minimalist [Pelican](http://blog.getpelican.com/) theme.
- SEO Best Practices
- Open Graph
- Rich Snippets (JSON-LD)
- Related Posts (via [plugin](https://github.com/getpelican/pelican-plugins/tree/master/related_posts))
- Minute read like [Medium](https://medium.com/) (via [plugin](https://github.com/getpelican/pelican-plugins/tree/master/post_stats)) (coming in 2.0)
- [Multiple Code Highlight Styles](https://github.com/alexandrevicenzi/Flex/wiki/Code-Highlight)
- [Translation Support](https://github.com/alexandrevicenzi/Flex/wiki/Multi-language-support) (draft/coming in 2.0)
@ -29,10 +31,6 @@ The recommend way to install is over [pelican-themes](https://github.com/getpeli
The `master` branch is the development branch. If you're happy with fresh new things and maybe sometimes (~most of time~) broken things you can clone the `master`, but I would recommend to you to clone a tag branch.
## Migrate from 1.x to 2.x
Release 2.0 will include [Translation Support](https://github.com/alexandrevicenzi/Flex/wiki/Multi-language-support). In order to use Flex you need to configure your `pelicanconf.py` to support i18n. See [Multi language support](https://github.com/alexandrevicenzi/Flex/wiki/Multi-language-support) for examples.
## Docs
[Go to Wiki](https://github.com/alexandrevicenzi/Flex/wiki)
@ -54,9 +52,11 @@ I'm using Flex in my [personal blog](http://blog.alexandrevicenzi.com/).
## Donate
Did you liked? Buy me a coffee.
Did you liked this theme? Buy me a beer and support new features.
[![Gratipay](https://img.shields.io/gratipay/JSFiddle.svg?style=flat-square)](https://gratipay.com/~alexandrevicenzi/)
[![Gratipay](https://img.shields.io/gratipay/user/alexandrevicenzi.svg?maxAge=2592000)](https://gratipay.com/~alexandrevicenzi/)
[![PayPal](https://img.shields.io/badge/paypal-donate-yellow.svg?maxAge=2592000)](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=KZCMH3N74KKFN&lc=BR&item_name=Alexandre%20Vicenzi&item_number=flex&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted)
## License

View file

View file

@ -1,10 +0,0 @@
import jinja2.ext
class ByPassTrans(jinja2.ext.InternationalizationExtension):
def __init__(self, environment):
super(ByPassTrans, self).__init__(environment)
self._install_null()
i18n = ByPassTrans

View file

@ -14,9 +14,9 @@
<header>
<h1 id="{{ article.slug }}">{{ article.title }}</h1>
<p>
{% with category_url='<a href="%s/%s">%s</a>' % (SITEURL, article.category.url, article.category) %}
{{ _('Posted on %(when)s in %(category)s', when=article.locale_date, category=category_url|safe) }}
{% endwith %}
{{ _('Posted on %(when)s in %(category)s',
when=article.locale_date,
category='<a href="%s/%s">%s</a>'|format(SITEURL, article.category.url, article.category)|safe) }}
{% if 'post_stats' in PLUGINS %}
&#8226; {{ article.stats['read_mins'] }} min read

View file

@ -1,3 +1,9 @@
{% if 'jinja2.ext.i18n' not in JINJA_EXTENSIONS %}
{% macro _(msg) %}
{{ msg % kwargs }}
{% endmacro %}
{% endif %}
<!DOCTYPE html>
<html lang="{{ DEFAULT_LANG }}">
<head>

View file

@ -6,9 +6,9 @@
<header>
<h2><a href="{{ SITEURL }}/{{ article.url }}#{{ article.slug }}">{{ article.title }}</a></h2>
<p>
{% with category_url='<a href="%s/%s">%s</a>' % (SITEURL, article.category.url, article.category) %}
{{ _('Posted on %(when)s in %(category)s', when=article.locale_date, category=category_url|safe) }}
{% endwith %}
{{ _('Posted on %(when)s in %(category)s',
when=article.locale_date,
category='<a href="%s/%s">%s</a>'|format(SITEURL, article.category.url, article.category)|safe) }}
{% if 'post_stats' in PLUGINS %}
&#8226; {{ article.stats['read_mins'] }} min read