Add contribute to translations section
This commit is contained in:
parent
0d385daa37
commit
ae4ee13bbb
11 changed files with 229 additions and 9 deletions
|
|
@ -3,6 +3,7 @@ name = BeeWare
|
|||
url = http://pybee.org
|
||||
url_style = absolute
|
||||
|
||||
# `name` in alternatives should be in english. This is used for translations
|
||||
[alternatives.en]
|
||||
name = English
|
||||
primary = yes
|
||||
|
|
|
|||
9
content/community/members/569abb48/contents+es.lr
Normal file
9
content/community/members/569abb48/contents+es.lr
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
email: mjmccaffrey@******.com
|
||||
---
|
||||
join_date: 2016-10-03
|
||||
---
|
||||
level: individual
|
||||
---
|
||||
name: Mike McCaffrey
|
||||
---
|
||||
uid: 569abb48
|
||||
|
|
@ -38,10 +38,12 @@ Documentación
|
|||
|
||||
¿Está actualizada la documentación? ¿Crees que las cosas podrían ser redactadas de una manera diferente? ¿Hay secciones incompletas? ¿Tienes una idea para un tutorial que podría ser escrito? Por favor, envía una solicitud de un *Pull Request*!
|
||||
|
||||
Este sitio web
|
||||
------------------
|
||||
Ayuda a traducir y mejorar este sitio web
|
||||
---------------------------------------------------
|
||||
|
||||
¿Hay algo malo o incompleto en este sitio web? Por favor, sientete libre de `hacer ediciones <https://github.com/pybee/pybee.github.io>`__ y enviar una solicitud con un *Pull Request*!
|
||||
¿Hay algo malo o incompleto en este sitio web? Por favor, siéntete libre de `hacer ediciones <https://github.com/pybee/pybee.github.io>`__ y enviar una solicitud con un *Pull Request*!
|
||||
|
||||
Quieres ayudar a traducir o actualizar páginas del sitio? Visita la `sección de traducciones </es/contribuir/como-ayudar/traducciones>`__.
|
||||
|
||||
Algo más
|
||||
-------------
|
||||
|
|
|
|||
|
|
@ -53,11 +53,13 @@ Documentation
|
|||
|
||||
Is the documentation up to date? Do you think things could be worded differently? Are there missing sections? Do you have an idea for a tutorial that could be written? Please submit a Pull Request!
|
||||
|
||||
This Website
|
||||
-------------
|
||||
Help translate and update this Website
|
||||
-------------------------------------------------
|
||||
|
||||
Is there anything wrong or missing from this website? Please feel free to `make edits <https://github.com/pybee/pybee.github.io>`__ and submit a pull request!
|
||||
|
||||
Want to help translate or update the content of this website? Visit the `translations section </contributing/how/translations>`__.
|
||||
|
||||
Something else
|
||||
-------------------------
|
||||
|
||||
|
|
|
|||
11
content/contributing/how/translations/contents+es.lr
Normal file
11
content/contributing/how/translations/contents+es.lr
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
_template: translations.html
|
||||
---
|
||||
body:
|
||||
|
||||
Ayuda a traducir el contenido del sitio web!
|
||||
|
||||
Algunas secciones del sitio web se encuentran disponibles en los siguientes idiomas:
|
||||
---
|
||||
title: Traducciones
|
||||
---
|
||||
_slug: traducciones
|
||||
13
content/contributing/how/translations/contents.lr
Normal file
13
content/contributing/how/translations/contents.lr
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
_model: page
|
||||
---
|
||||
title: Translations
|
||||
---
|
||||
body:
|
||||
|
||||
Want to help translate or update the content of this website?
|
||||
|
||||
Some parts of this website are currently available in the following languages:
|
||||
|
||||
|
||||
---
|
||||
_template: translations.html
|
||||
11
content/news/events/djangocon-us-2016-sprints/contents+es.lr
Normal file
11
content/news/events/djangocon-us-2016-sprints/contents+es.lr
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
date: 2016-07-21
|
||||
---
|
||||
event_type: sprint
|
||||
---
|
||||
speaker: Russell Keith-Magee, Philip James
|
||||
---
|
||||
title: DjangoCon US 2016
|
||||
---
|
||||
upcoming: no
|
||||
---
|
||||
url: https://2016.djangocon.us/sprints/
|
||||
|
|
@ -108,16 +108,62 @@ my_interests = I am interested in
|
|||
email_format = Email Format
|
||||
other = Other
|
||||
|
||||
; Contributions
|
||||
outdated_translations = The following pages may contain outdated translations
|
||||
missing_translations = The following pages are missing a translation
|
||||
|
||||
; Languages
|
||||
english = English
|
||||
arabic = Arabic
|
||||
portuguese = Portuguese
|
||||
chinese = Chinese
|
||||
german = German
|
||||
spanish = Spanish
|
||||
|
||||
[ar]
|
||||
; Languages
|
||||
english = English
|
||||
arabic = العَرَبِيَّة
|
||||
portuguese = Português
|
||||
chinese = Chinese
|
||||
german = German
|
||||
spanish = Spanish
|
||||
|
||||
[de]
|
||||
; Languages
|
||||
english = English
|
||||
arabic = Arabic
|
||||
portuguese = Português
|
||||
chinese = Chinese
|
||||
german = Deutsch
|
||||
spanish = Spanish
|
||||
|
||||
[pt]
|
||||
incomplete_text = O conteúdo dessa página está incompleto. Você pode
|
||||
incomplete_link = expandí-lo
|
||||
|
||||
; Languages
|
||||
english = English
|
||||
arabic = Arabic
|
||||
portuguese = Português
|
||||
chinese = Chinese
|
||||
german = German
|
||||
spanish = Spanish
|
||||
|
||||
[zh]
|
||||
before_link_text = 這個頁面的內容尚未翻譯完成。請協助
|
||||
incomplete_link = 貢獻翻譯
|
||||
incomplete_after_link_text = 。
|
||||
incomplete_space_before_link = false
|
||||
|
||||
; Languages
|
||||
english = English
|
||||
arabic = Arabic
|
||||
portuguese = Portuguese
|
||||
chinese = 漢語
|
||||
german = German
|
||||
spanish = Spanish
|
||||
|
||||
[es]
|
||||
; Breadcrumbs
|
||||
home = Inicio
|
||||
|
|
@ -227,3 +273,15 @@ my_name = Me gustaría que me llamen
|
|||
my_interests = Estoy interesado en
|
||||
email_format = Formato de correo
|
||||
other = Otro
|
||||
|
||||
; Contributions
|
||||
missing_translations = Las siguientes páginas no tienen traducción aun
|
||||
outdated_translations = Las siguientes páginas pueden contener traducciones desactualizadas
|
||||
|
||||
; Languages
|
||||
english = Inglés
|
||||
arabic = Árabe
|
||||
portuguese = Portugués
|
||||
chinese = Chino
|
||||
german = Alemán
|
||||
spanish = Español
|
||||
|
|
|
|||
|
|
@ -132,7 +132,15 @@ class PyBeePlugin(Plugin):
|
|||
|
||||
return css
|
||||
|
||||
def is_alt_outdated(record):
|
||||
"""Check if record alternative is outdated."""
|
||||
return _alt_outdated_diff(record, return_diff=False)
|
||||
|
||||
def alt_outdated_diff(record):
|
||||
"""Check if record alternative is outdated and returns the diff."""
|
||||
return _alt_outdated_diff(record, return_diff=True)
|
||||
|
||||
def _alt_outdated_diff(record, return_diff=True):
|
||||
"""Check if record alternative is outdated and returns the diff."""
|
||||
if not isinstance(record, Record):
|
||||
raise ValueError('Must provide a `Record` object')
|
||||
|
|
@ -162,10 +170,13 @@ class PyBeePlugin(Plugin):
|
|||
alt_modtime = git_modified_date(alt_path)
|
||||
|
||||
diff = None
|
||||
if alt_modtime and primary_modtime > alt_modtime:
|
||||
if alt_modtime and primary_modtime > alt_modtime and return_diff:
|
||||
diff = git_diff(primary_path,
|
||||
alt_modtime.strftime(self.DATE_FORMAT))
|
||||
|
||||
if not return_diff:
|
||||
diff = alt_modtime and primary_modtime > alt_modtime
|
||||
|
||||
return diff
|
||||
|
||||
def urlencode_limit(string, limit=6000):
|
||||
|
|
@ -183,6 +194,7 @@ class PyBeePlugin(Plugin):
|
|||
return string
|
||||
|
||||
# Add additional methods to the environment globlas
|
||||
self.env.jinja_env.globals.update(is_alt_outdated=is_alt_outdated)
|
||||
self.env.jinja_env.globals.update(alt_outdated_diff=alt_outdated_diff)
|
||||
self.env.jinja_env.globals.update(urlencode_limit=urlencode_limit)
|
||||
self.env.jinja_env.globals.update(
|
||||
|
|
|
|||
|
|
@ -81,14 +81,27 @@ ga('send', 'pageview');
|
|||
{{ menu_item('contributing') }}
|
||||
{{ menu_item('contact') }}
|
||||
<li class="nav-item dropdown">
|
||||
<a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">{{ t_languages }} <span class="caret"></span></a>
|
||||
<a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">
|
||||
<i class="fa fa-globe" aria-hidden="true"></i> <span class="caret"></span>
|
||||
</a>
|
||||
<div class="dropdown-menu" aria-labelledby="dropdown01">
|
||||
{%- set eng_active = this.alt == 'en' %}
|
||||
<a class="dropdown-item {% if eng_active %}active{% endif %}" href="{{ '.'|url(alt='en') }}">English</a>
|
||||
<a class="dropdown-item {% if eng_active %}active{% endif %}" href="{{ '.'|url(alt='en') }}">
|
||||
English
|
||||
{%- if this.alt != 'en' -%}
|
||||
<small>(<i>{{ transbag('translate', this.alt, 'english' )|trim }}</i>)</small>
|
||||
{%- endif -%}
|
||||
</a>
|
||||
|
||||
{%- for alt, alternative in config.ALTERNATIVES.items()|sort -%}
|
||||
{%- set alt_active = alt == this.alt -%}
|
||||
{%- if alt != config.primary_alternative -%}
|
||||
<a class="dropdown-item {% if alt_active %}active{% endif %}" href="{{ '.'|url(alt=alt) }}">{{ alternative.name.en }}</a>
|
||||
<a class="dropdown-item {% if alt_active %}active{% endif %}" href="{{ '.'|url(alt=alt) }}">
|
||||
{{ transbag('translate', alt, alternative.name.en.lower()) }}
|
||||
{%- if this.alt != alt -%}
|
||||
<small>(<i>{{ transbag('translate', this.alt, alternative.name.en.lower())|trim }}</i>)</small>
|
||||
{%- endif -%}
|
||||
</a>
|
||||
{%- endif -%}
|
||||
{%- endfor -%}
|
||||
</div>
|
||||
|
|
|
|||
88
templates/translations.html
Normal file
88
templates/translations.html
Normal file
|
|
@ -0,0 +1,88 @@
|
|||
{%- extends "layout.html" -%}
|
||||
{%- from "macros/breadcrumbs.html" import breadcrumbs -%}
|
||||
{%- from "macros/incomplete.html" import incomplete -%}
|
||||
{%- from "macros/translation.html" import transbag -%}
|
||||
|
||||
{%- set t_missing_translations = transbag('translate', this.alt, 'missing_translations') -%}
|
||||
{%- set t_outdated_translations = transbag('translate', this.alt, 'outdated_translations') -%}
|
||||
|
||||
{% block title %}{{ this.title }}{% endblock %}
|
||||
{% block preamble %}
|
||||
<div class="banner">
|
||||
<div class="container">
|
||||
<p>{{ breadcrumbs(this) }}</p>
|
||||
<h1>{{ this.title }}</h1>
|
||||
<p>{{ this.summary }}</p>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
{% block body %}
|
||||
<div class="row">
|
||||
<div class="col-sm-8">
|
||||
{{ incomplete(this) }}
|
||||
{% block main %}
|
||||
{{ this.body }}
|
||||
<ul>
|
||||
{%- for alt, alternative in config.ALTERNATIVES.items()|sort -%}
|
||||
{% if this.alt != alt %}
|
||||
<li><a href="{{ '.'|url(alt=alt) }}">
|
||||
{{ transbag('translate', alt, alternative.name['en'].lower()) }}
|
||||
<small>(<i>{{ transbag('translate', this.alt, alternative.name['en'].lower())|trim }}</i>)</small></a></li>
|
||||
{% endif %}
|
||||
{%- endfor -%}
|
||||
</ul>
|
||||
{% for child in this.children %}
|
||||
{% if not child.hide_from_index %}
|
||||
<h2><a href="{{ child|url(alt=this.alt) }}">{{ child.title }}</a></h2>
|
||||
<p>{{ child.summary }}</p>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endblock %}
|
||||
|
||||
{%- if this.alt != config.primary_alternative -%}
|
||||
<h2>{{ t_missing_translations }}:</h2>
|
||||
{%- for page in site.query('/', alt=this.alt) recursive -%}
|
||||
{%- if not page.alt in get_alts(source=page, fallback=False) -%}
|
||||
<li>
|
||||
<a href="{{ page|url(alt=this.alt) }}">
|
||||
{{ page['title'] or page['name'] or page.record_label }}
|
||||
</a>
|
||||
{%- endif -%}
|
||||
{%- if page.children -%}
|
||||
{{- loop(page.children) -}}
|
||||
</li>
|
||||
{%- endif -%}
|
||||
{%- endfor -%}
|
||||
|
||||
<h2>{{ t_outdated_translations }}:</h2>
|
||||
{%- for page in site.query('/', alt=this.alt) recursive -%}
|
||||
{%- if is_alt_outdated(page) -%}
|
||||
<li>
|
||||
<a href="{{ page|url(alt=this.alt) }}">
|
||||
{{ page['title'] or page['name'] or page.record_label }}
|
||||
</a>
|
||||
{%- endif -%}
|
||||
{%- if page.children -%}
|
||||
{{- loop(page.children) -}}
|
||||
</li>
|
||||
{%- endif -%}
|
||||
{%- endfor -%}
|
||||
{%- endif -%}
|
||||
|
||||
</div>
|
||||
{% block gutter %}
|
||||
{% if this.gutter and this.gutter.source %}
|
||||
<!-- <div class="col-sm-12 col-md-4 gutter"> -->
|
||||
<div class="col-sm-4">
|
||||
<div class="sidebar-module sidebar-module-inset gutter">
|
||||
{{ this.gutter }}
|
||||
</div>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="hidden-sm-down col-sm-4">
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% endblock %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
Loading…
Reference in a new issue