Commit Graph

17 Commits

Author SHA1 Message Date
Dalai Felinto
303a33c3bf Internationalization: Backend support to localization based on user browser
User experience
===============
For users it means we can provide localized web-sites to enrich their
overall experiences.

Although for the Blender Cloud this doesn't make much sense (since the
content is in English), Flamenco and Attract can really benefit from
this.

New configuration settings
==========================
There are two new parameters in config.py:

* DEFAULT_LOCALE='en_US'
* SUPPORT_ENGLISH=True

They are both properly documented in the `config.py` file.

Technicall details
==================
We are using the 'Accept-Languages' header to match the
available translations with the user supported languages.

If an extension has a `translations` folder, it's used for translations.
However the main application (e.g., Blender Cloud) is the one that
determines the supported languages based on its `languages` folder.

How to mark strings for translation
===================================
See the documentation in README.md.

But as an example, 404.pug and pillar/__init__.py::handle_sdk_resource_invalid
have marked up strings that will be extracted once you install pillar,
or run any of the translations commangs.

Remember to **gulp** after you update the template files.

How to setup translations
=========================
You will need to create translation for the main project, and for each
extension that you want to see translated. I added a new entry-point to
the installation of Pillar.

So all you need is to use the `translations`
script to initialize, update and compile your translations.

Pending tasks
=============
Aside from marking more strings for extraction and start the translation
effort it would be interesting to replace the pretty_date routine with
momentjs.

Acknowledgement
===============
Many thanks for Sybren Stüvel for the suggestions and throughout code
review. Thanks also to Francesco Siddi for the original documentation
and suggesting me to tackle this. And Kudos for Pablo Vazquez for the
motivational support and for the upcoming "strings mark up" task force!

The core of the implementation is based on Miguel Grinberg i18n chapter
of his great 'The Mega Flask Tutorial'.

Reviewers: sybren

Differential Revision: https://developer.blender.org/D2826
2017-09-09 00:26:18 +02:00
2b09711eb0 Load user capabilities from Pillar config and allow extensions to extend.
Default caps can be overridden using the USER_CAPABILITIES name in
config_local.py. These can be extended by Pillar Extensions.
2017-08-22 11:31:17 +02:00
8e02de32ab Pillar Extensions can now determine which user roles to index in Algola 2017-06-15 11:31:48 +02:00
13b67702b4 Let Pillar extensions register new roles.
These will be available via the app.user_roles property.
2017-06-15 11:06:01 +02:00
efa2321ac3 Pillar extensions can now register global Jinja2 context processors. 2017-06-14 16:10:11 +02:00
5af54237b9 Integrated Celery startup / management / config with PillarServer. 2017-06-02 10:44:37 +02:00
2c78697e80 Pass extension pages to all extensions' "project settings" pages. 2017-05-31 10:35:49 +02:00
2ba52e2467 Allow extensions to have a project settings page. 2017-05-24 15:48:27 +02:00
b7bccfeee3 Annotate sidebar_links(project) param + return type 2017-05-24 15:48:27 +02:00
43a04880e0 Allow extensions to declare their icon.
The PillarExtension.icon() property returns the icon HTML class,
for use like i.pi-{{ext.icon}}
2017-05-24 15:48:27 +02:00
1f2dd34683 No longer using deprecated @abc.abstractproperty
See https://docs.python.org/3/library/abc.html#abc.abstractproperty for
more info.
2017-05-24 15:48:27 +02:00
663627358f Ran 2to3 on pillar + some manual fixups
The 'manual fixups' are:

- incorrect use of dict.items() where dict.iteritems() was meant; this
  results in list(dict.items()), which I changed to dict.items().
- removal of 'from __future__ import' lines, which 2to3 changes into
  empty lines; I removed the empty lines.
2017-03-22 15:49:51 +01:00
5dd49fa5dd Pillar Extensions can now add links to the sidebar. 2016-10-11 16:33:44 +02:00
9e6b998c50 Refactored static file handling so that extensions can provide static files 2016-09-07 16:36:25 +02:00
4ae36a0dc3 Allow custom template dirs for extensions 2016-09-06 18:39:35 +02:00
3d9b9e40d4 Added PillarExtension.setup_app(app)
It's called on each extension after all extensions have been processed,
and after all built-in Pillar modules have had their setup_app() called.
Call order is random.
2016-08-31 16:03:45 +02:00
2c5dc34ea2 Introducing Pillar Framework
Refactor of pillar-server and pillar-web into a single python package. This
simplifies the overall architecture of pillar applications.

Special thanks @sybren and @venomgfx
2016-08-19 09:19:06 +02:00