pillar/README.md

85 lines
3.3 KiB
Markdown
Raw Permalink Normal View History

2015-08-31 18:22:50 +02:00
Pillar
======
2014-04-20 12:09:16 +02:00
2015-08-31 18:22:50 +02:00
This is the latest iteration on the Attract project. We are building a unified
framework called Pillar. Pillar will combine Blender Cloud and Attract. You
2016-01-05 15:50:03 +01:00
can see Pillar in action on the [Blender Cloud](https://cloud.bender.org).
## Custom fonts
The icons on the website are drawn using a custom font, stored in
[pillar/web/static/font](pillar/web/static/font).
This font is generated via [Fontello](http://fontello.com/) by uploading
[pillar/web/static/font/config.json](pillar/web/static/font/config.json).
Note that we only use the WOFF and WOFF2 formats, and discard the others
supplied by Fontello.
After replacing the font files & `config.json`, edit the Fontello-supplied
`font.css` to remove all font formats except `woff` and `woff2`. Then upload
it to [css2sass](http://css2sass.herokuapp.com/) to convert it to SASS, and
2017-06-01 12:10:33 +02:00
place it in [src/styles/font-pillar.sass](src/styles/font-pillar.sass).
Don't forget to Gulp!
2016-09-29 10:01:15 +02:00
## Installation
Make sure your /data directory exists and is writable by the current user.
Alternatively, provide a `pillar/config_local.py` that changes the relevant
settings.
```
git clone git@git.blender.org:pillar-python-sdk.git ../pillar-python-sdk
pip install -e ../pillar-python-sdk
pip install -U -r requirements.txt
pip install -e .
```
## HDRi viewer
The HDRi viewer uses [Google VRView](https://github.com/googlevr/vrview). To upgrade,
get those files:
* [three.min.js](https://raw.githubusercontent.com/googlevr/vrview/master/build/three.min.js)
* [embed.min.js](https://raw.githubusercontent.com/googlevr/vrview/master/build/embed.min.js)
* [loading.gif](https://raw.githubusercontent.com/googlevr/vrview/master/images/loading.gif)
and place them in `pillar/web/static/assets/vrview`. Replace `images/loading.gif` in `embed.min.js` with `static/pillar/assets/vrview/loading.gif`.
You may also want to compare their
[index.html](https://raw.githubusercontent.com/googlevr/vrview/master/index.html) to our
`src/templates/vrview.pug`.
When on a HDRi page with the viewer embedded, use this JavaScript code to find the current
yaw: `vrview_window.contentWindow.yaw()`. This can be passed as `default_yaw` parameter to
the iframe.
## Celery
Pillar requires [Celery](http://www.celeryproject.org/) for background task processing. This in
turn requires a backend and a broker, for which the default Pillar configuration uses Redis and
RabbitMQ.
You can run the Celery Worker using `manage.py celery worker`.
Find other Celery operations with the `manage.py celery` command.
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:02:24 +02:00
## Elasticsearch
Pillar uses [Elasticsearch](https://www.elastic.co/products/elasticsearch) to power the search engine.
You will need to run the `manage.py elastic reset_index` command to initialize the indexing.
If you need to reindex your documents in elastic you run the `manage.py elastic reindex` command.
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:02:24 +02:00
## Translations
If the language you want to support doesn't exist, you need to run: `translations init es_AR`.
Every time a new string is marked for translation you need to update the entire catalog: `translations update`
And once more strings are translated, you need to compile the translations: `translations compile`
*To mark strings strings for translations in Python scripts you need to
wrap them with the `flask_babel.gettext` function.
For .pug templates wrap them with `_()`.*