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
This commit is contained in:
@@ -3,15 +3,24 @@
|
||||
#error-container(class="error-404")
|
||||
#error-box
|
||||
.error-top-container
|
||||
.error-title Not found.
|
||||
.error-title {{ _("Not found.") }}
|
||||
.error-lead
|
||||
p Whatever you're looking for, it's not here.
|
||||
p {{ _("Whatever you're looking for, it's not here.") }}
|
||||
|
||||
.error-lead.extra
|
||||
p.
|
||||
Looking for the Open Movies? Check out <a href="https://www.youtube.com/BlenderFoundation">Blender Foundation's YouTube</a> channel. <br/> Were you looking for tutorials instead? <a href="http://www.blender.org/support/tutorials/">blender.org</a> has a good selection.
|
||||
{% autoescape false %}
|
||||
{{ gettext("Looking for the Open Movies? Check out %(link_start)s Blender Foundation's Youtube %(link_end)s channel.",
|
||||
link_start='<a href="https://www.youtube.com/BlenderFoundation">', link_end='</a>') }} <br/>
|
||||
{{ gettext("Were you looking for tutorials instead? %(blender_org)s has a good selection.",
|
||||
blender_org='<a href="http://www.blender.org/support/tutorials/">blender.org</a>') }}
|
||||
{% endautoescape %}
|
||||
p.
|
||||
Is this content missing? Let us know on <a href="https://twitter.com/Blender_Cloud">Twitter</a>
|
||||
or <a href="mailto:cloudsupport@blender.org">e-mail</a>.
|
||||
{% autoescape false %}
|
||||
{{ gettext("Is this content missing? Let us know on %(twitter)s or %(email_start)s e-mail %(email_end)s",
|
||||
twitter='<a href="https://twitter.com/Blender_Cloud">Twitter</a>',
|
||||
email_start='<a href="mailto:cloudsupport@blender.org">',
|
||||
email_end='</a>') }}
|
||||
{% endautoescape %}
|
||||
|
||||
| {% endblock %}
|
||||
|
Reference in New Issue
Block a user