Pluginless translation.
This commit is contained in:
parent
549a882acb
commit
723e047add
6 changed files with 18 additions and 22 deletions
12
README.md
12
README.md
|
@ -10,6 +10,8 @@ A minimalist [Pelican](http://blog.getpelican.com/) theme.
|
||||||
- SEO Best Practices
|
- SEO Best Practices
|
||||||
- Open Graph
|
- Open Graph
|
||||||
- Rich Snippets (JSON-LD)
|
- 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)
|
- [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)
|
- [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.
|
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
|
## Docs
|
||||||
|
|
||||||
[Go to Wiki](https://github.com/alexandrevicenzi/Flex/wiki)
|
[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
|
## 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¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted)
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
|
|
|
@ -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
|
|
|
@ -14,9 +14,9 @@
|
||||||
<header>
|
<header>
|
||||||
<h1 id="{{ article.slug }}">{{ article.title }}</h1>
|
<h1 id="{{ article.slug }}">{{ article.title }}</h1>
|
||||||
<p>
|
<p>
|
||||||
{% with category_url='<a href="%s/%s">%s</a>' % (SITEURL, article.category.url, article.category) %}
|
{{ _('Posted on %(when)s in %(category)s',
|
||||||
{{ _('Posted on %(when)s in %(category)s', when=article.locale_date, category=category_url|safe) }}
|
when=article.locale_date,
|
||||||
{% endwith %}
|
category='<a href="%s/%s">%s</a>'|format(SITEURL, article.category.url, article.category)|safe) }}
|
||||||
|
|
||||||
{% if 'post_stats' in PLUGINS %}
|
{% if 'post_stats' in PLUGINS %}
|
||||||
• {{ article.stats['read_mins'] }} min read
|
• {{ article.stats['read_mins'] }} min read
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
{% if 'jinja2.ext.i18n' not in JINJA_EXTENSIONS %}
|
||||||
|
{% macro _(msg) %}
|
||||||
|
{{ msg % kwargs }}
|
||||||
|
{% endmacro %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="{{ DEFAULT_LANG }}">
|
<html lang="{{ DEFAULT_LANG }}">
|
||||||
<head>
|
<head>
|
||||||
|
|
|
@ -6,9 +6,9 @@
|
||||||
<header>
|
<header>
|
||||||
<h2><a href="{{ SITEURL }}/{{ article.url }}#{{ article.slug }}">{{ article.title }}</a></h2>
|
<h2><a href="{{ SITEURL }}/{{ article.url }}#{{ article.slug }}">{{ article.title }}</a></h2>
|
||||||
<p>
|
<p>
|
||||||
{% with category_url='<a href="%s/%s">%s</a>' % (SITEURL, article.category.url, article.category) %}
|
{{ _('Posted on %(when)s in %(category)s',
|
||||||
{{ _('Posted on %(when)s in %(category)s', when=article.locale_date, category=category_url|safe) }}
|
when=article.locale_date,
|
||||||
{% endwith %}
|
category='<a href="%s/%s">%s</a>'|format(SITEURL, article.category.url, article.category)|safe) }}
|
||||||
|
|
||||||
{% if 'post_stats' in PLUGINS %}
|
{% if 'post_stats' in PLUGINS %}
|
||||||
• {{ article.stats['read_mins'] }} min read
|
• {{ article.stats['read_mins'] }} min read
|
||||||
|
|
Loading…
Reference in a new issue