/
translate.html
179 lines (173 loc) · 8.26 KB
/
translate.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
{# vim: set ts=2 et sts=2 sw=2: #}
{% extends "wiki/base.html" %}
{% from "layout/errorlist.html" import errorlist %}
{% from "wiki/includes/sidebar_modules.html" import document_tools %}
{% from "includes/common_macros.html" import content_editor %}
{% from "wiki/includes/document_macros.html" import revision_diff, submit_revision, edit_messages with context %}
{% from "wiki/includes/document_macros.html" import document_lock_warning with context %}
{% set title = _('Translate Article | {document}')|f(document=parent.title) %}
{% set crumbs = [(parent.get_absolute_url(), parent.title),
(None, _('Translate Article'))] %}
{% set classes = 'translate' %}
{% set scripts = ('wiki', 'wiki.diff', 'wiki.editor') %}
{% block content %}
{% set language = settings.LANGUAGES[locale.lower()] %}
<div class="grid_9">
{{ edit_messages(document, show_revision_warning) }}
{{ document_lock_warning() }}
<article id="localize-document" class="main form-page{% if locked %} locked{% endif %}" data-slug="{{ parent.slug }}">
<h1>{{ _('Translating {title}')|f(title=parent.title) }}</h1>
<div class="change-locale">
<p>
{{ _('Translating article to {locale}' )|f(locale=language) }}.
</p>
{% if not based_on.is_ready_for_localization %}
<div class="warning-box">
{{ _('You are translating an English document which is not yet ready for localization.') }}
</div>
{% endif %}
</div>
{% if not document %}
{# If this is the first translation to this locale, we use 1 big form. #}
<form action="" method="post" data-json-url="{{ url('wiki.json') }}">
{{ csrf() }}
<input type="hidden" name="form" value="both" />
{% endif %}
{% if document_form %}
<details class="h2"{% if disclose_description %} open="open"{% endif %}>
<summary>{{ _('Translate Description') }}</summary>
{{ errorlist(document_form) }}
{% if document %}
{# If there are existing translations in this locale, we use 2 separate forms. #}
<form action="" method="post" data-json-url="{{ url('wiki.json') }}" data-document-id="{{ document.id }}">
{{ csrf() }}
<input type="hidden" name="form" value="doc" />
{% endif %}
<ul class="description">
<li>
<div class="approved">
<h3>{{ _('Title:') }}</h3>
<div class="val">{{ parent.title }}</div>
</div>
<div class="localized">
<h3><label for="{{ document_form.title.auto_id }}" title="{{ document_form.title.help_text }}">{{ _('Title in {locale}:')|f(locale=language) }}</label></h3>
{{ document_form.title|safe }}
</div>
</li>
<li>
<div class="approved">
<h3>{{ _('Slug:') }}</h3>
<div class="val">{{ parent.slug }}</div>
</div>
<div class="localized">
<h3><label for="{{ document_form.slug.auto_id }}" title="{{ document_form.slug.help_text }}">{{ _('Slug in {locale}:')|f(locale=language) }}</label></h3>
{{ document_form.slug|safe }}
</div>
</li>
<li>
{{ document_form.allow_discussion|label_with_help }}{{ document_form.allow_discussion }}
</li>
</ul>
{% if document %}
<div class="submit">
<button class="btn btn-important" type="submit">{{ _('Save description') }}</button>
</div>
</form>
{% endif %}
</details>
{% endif %}
{% if revision_form %}
<details class="h2" open="open">
<summary>{{ _('Translate Content') }}</summary>
{{ errorlist(revision_form) }}
{% if document %}
{# If there are existing translations in this locale, we use 2 separate forms. #}
<form action="" method="post">
{{ csrf() }}
<input type="hidden" name="form" value="rev" />
{% endif %}
{% if recent_approved_revs %}
<h3>{{ _('Recently approved updates') }}:</h3>
<ul class="recent-revisions">
{% for rev in recent_approved_revs %}
<li>
<a href="{{ url('wiki.revision', parent.slug, rev.id, locale=parent.locale) }}" rel="nofollow, noindex">{{ datetimeformat(rev.created, format='date') }}</a>:
[<a href="{{ profile_url(rev.creator) }}">{{ rev.creator }}</a>]
{{ rev.comment }}
</li>
{% endfor %}
</ul>
{% endif %}
<h3>{{ _('Differences') }}:</h3>
{% if document.current_revision and document.current_revision.based_on and parent.latest_localizable_revision %}
{# Diff between the English version the current translation is based on and the most recent ready-to-localize English version. #}
{{ revision_diff(document.current_revision.based_on, parent.latest_localizable_revision, show_picker=True) }}
{% elif not parent.latest_localizable_revision %}
<p>{{ _('Note: This article has no revisions ready for localization.') }}</p>
{% else %}
<p>{{ _('Note: There are no approved translations for this article.') }}</p>
{% endif %}
<ul class="description">
<li>
<div class="approved">
<h3><label>{{ _('Keywords:') }}</label></h3>
<div class="val">{{ based_on.keywords }}</div>
</div>
<div class="localized">
<h3><label for="{{ revision_form.keywords.auto_id }}" title="{{ revision_form.keywords.help_text }}">{{ _('Keywords in {locale}:')|f(locale=language) }}</label></h3>
{{ revision_form.keywords|safe }}
</div>
</li>
<li>
<div class="approved">
<h3><label>{{ _('Search result summary:') }}</label></h3>
<div class="val">{{ based_on.summary }}</div>
</div>
<div class="localized">
<h3><label for="{{ revision_form.summary.auto_id }}" title="{{ revision_form.summary.help_text }}">{{ _('Search result summary in {locale}:')|f(locale=language) }}</label></h3>
{{ revision_form.summary|safe }}
<p><span id="remaining-characters">{{ revision_form.summary.field.max_length }}</span> {{_('characters remaining.') }}</p>
</div>
</li>
</ul>
<div id="content-fields">
<div class="approved">
<h3>{{ _('Approved {default_locale} version:')|f(default_locale=settings.LANGUAGES[settings.WIKI_DEFAULT_LANGUAGE.lower()]) }}</h3>
<textarea readonly="readonly">{{ based_on.content }}</textarea>
</div>
<div class="localized">
<h3>{{ _('{locale} translation:')|f(locale=language) }}</h3>
{{ content_editor(revision_form.content) }}
</div>
</div>
{{ revision_form.hidden_fields()|join|safe }}
<div class="buttons-and-preview">
{# If the document has been created and has a current revision,
we allow the localizer to keep the translation out of date
with this new revision. #}
{{ submit_revision(revision_form, show_no_update_checkbox=(document and document.current_revision), include_diff=True) }}
<div id="preview"></div>
<div id="preview-diff">
<div class="from">{{ revision_form.content.value() }}</div>
<div class="to"></div>
<div class="output"></div>
</div>
<div class="submit" id="preview-bottom">
{{ submit_revision(revision_form, buttons_only=True, include_diff=True) }}
</div>
</div>
{% if document %}
</form>
{% endif %}
</details>
{% endif %}
{% if not document %}
</form>
{% endif %}
</article>
</div>
{% endblock %}
{% block side_top %}
{{ document_tools(document, parent, user, 'localize', settings) }}
{% endblock %}
{% block side_promos %}{% endblock %}