Commit aff3c477 by Ned Batchelder

i18n fixes for wiki templates.

parent 3eb69da5
...@@ -6,6 +6,8 @@ from django.conf import settings ...@@ -6,6 +6,8 @@ from django.conf import settings
from django.contrib.sites.models import Site from django.contrib.sites.models import Site
from django.core.exceptions import ImproperlyConfigured from django.core.exceptions import ImproperlyConfigured
from django.shortcuts import redirect from django.shortcuts import redirect
from django.utils.translation import ugettext as _
from wiki.core.exceptions import NoRootURL from wiki.core.exceptions import NoRootURL
from wiki.models import URLPath, Article from wiki.models import URLPath, Article
...@@ -79,12 +81,19 @@ def course_wiki_redirect(request, course_id): ...@@ -79,12 +81,19 @@ def course_wiki_redirect(request, course_id):
# recerate it. # recerate it.
urlpath.delete() urlpath.delete()
content = cgi.escape(
# Translators: this string includes wiki markup. Leave the ** and the _ alone.
_("This is the wiki for **{organization}**'s _{course_name}_.").format(
organization=course.display_org_with_default,
course_name=course.display_name_with_default,
)
)
urlpath = URLPath.create_article( urlpath = URLPath.create_article(
root, root,
course_slug, course_slug,
title=course_slug, title=course_slug,
content=cgi.escape(u"This is the wiki for **{0}**'s _{1}_.".format(course.display_org_with_default, course.display_name_with_default)), content=content,
user_message="Course page automatically created.", user_message=_("Course page automatically created."),
user=None, user=None,
ip_address=None, ip_address=None,
article_kwargs={'owner': None, article_kwargs={'owner': None,
...@@ -112,12 +121,12 @@ def get_or_create_root(): ...@@ -112,12 +121,12 @@ def get_or_create_root():
pass pass
starting_content = "\n".join(( starting_content = "\n".join((
"Welcome to the edX Wiki", _("Welcome to the edX Wiki"),
"===", "===",
"Visit a course wiki to add an article.")) _("Visit a course wiki to add an article."),
))
root = URLPath.create_root(title="Wiki", root = URLPath.create_root(title=_("Wiki"), content=starting_content)
content=starting_content)
article = root.article article = root.article
article.group = None article.group = None
article.group_read = True article.group_read = True
......
{% extends "main_django.html" %} {% extends "main_django.html" %}
{% load compressed %}{% load sekizai_tags i18n microsite %}{% load url from future %}{% load staticfiles %} {% load compressed %}{% load sekizai_tags i18n microsite %}{% load url from future %}{% load staticfiles %}
{% block title %}<title>{% block pagetitle %}{% endblock %} | Wiki | {% platform_name %}</title>{% endblock %} {% block title %}<title>{% block pagetitle %}{% endblock %} | {% trans "Wiki" %} | {% platform_name %}</title>{% endblock %}
{% block headextra %} {% block headextra %}
{% compressed_css 'course' %} {% compressed_css 'course' %}
......
...@@ -111,7 +111,7 @@ ...@@ -111,7 +111,7 @@
{% elif revision.automatic_log %} {% elif revision.automatic_log %}
{{ revision.automatic_log }} {{ revision.automatic_log }}
{% else %} {% else %}
({% trans "no log message" %}) {% trans "(no log message)" %}
{% endif %} {% endif %}
</small> </small>
</div> </div>
......
...@@ -8,8 +8,8 @@ ...@@ -8,8 +8,8 @@
<li class="${"active" if selected_tab == "view" else ""}"> <li class="${"active" if selected_tab == "view" else ""}">
<a href="${reverse('wiki:get', kwargs={'article_id' : article.id, 'path' : urlpath.path})}"> <a href="${reverse('wiki:get', kwargs={'article_id' : article.id, 'path' : urlpath.path})}">
<span class="icon-home icon"></span> <span class="icon-home icon"></span>
View ${_("View")}
${_("{span_start}active{span_end}").format(span_start="<span class='sr'>(", span_end=")</span>") if selected_tab == "view" else ""} ${_("{span_start}(active){span_end}").format(span_start="<span class='sr'>", span_end="</span>") if selected_tab == "view" else ""}
</a> </a>
</li> </li>
...@@ -17,8 +17,8 @@ ...@@ -17,8 +17,8 @@
<li class="${"active" if selected_tab == "edit" else ""}"> <li class="${"active" if selected_tab == "edit" else ""}">
<a href="${reverse('wiki:edit', kwargs={'article_id' : article.id, 'path' : urlpath.path})}"> <a href="${reverse('wiki:edit', kwargs={'article_id' : article.id, 'path' : urlpath.path})}">
<span class="icon-edit icon"></span> <span class="icon-edit icon"></span>
Edit ${_("Edit")}
${_("{span_start}active{span_end}").format(span_start="<span class='sr'>(", span_end=")</span>") if selected_tab == "edit" else ""} ${_("{span_start}(active){span_end}").format(span_start="<span class='sr'>", span_end="</span>") if selected_tab == "edit" else ""}
</a> </a>
</li> </li>
%endif %endif
...@@ -26,8 +26,8 @@ ...@@ -26,8 +26,8 @@
<li class="${"active" if selected_tab == "history" else ""}"> <li class="${"active" if selected_tab == "history" else ""}">
<a href="${reverse('wiki:history', kwargs={'article_id' : article.id, 'path' : urlpath.path})}"> <a href="${reverse('wiki:history', kwargs={'article_id' : article.id, 'path' : urlpath.path})}">
<span class="icon-changes icon"></span> <span class="icon-changes icon"></span>
Changes ${_("Changes")}
${_("{span_start}active{span_end}").format(span_start="<span class='sr'>(", span_end=")</span>") if selected_tab == "history" else ""} ${_("{span_start}(active){span_end}").format(span_start="<span class='sr'>", span_end="</span>") if selected_tab == "history" else ""}
</a> </a>
</li> </li>
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
<a href="${reverse('wiki:plugin', kwargs={'slug' : plugin.slug, 'article_id' : article.id, 'path' : urlpath.path}) }"> <a href="${reverse('wiki:plugin', kwargs={'slug' : plugin.slug, 'article_id' : article.id, 'path' : urlpath.path}) }">
<span class="${plugin.article_tab[1]} icon"></span> <span class="${plugin.article_tab[1]} icon"></span>
${plugin.article_tab[0]} ${plugin.article_tab[0]}
${_("{span_start}active{span_end}").format(span_start="<span class='sr'>(", span_end=")</span>") if selected_tab == plugin.slug else ""} ${_("{span_start}(active){span_end}").format(span_start="<span class='sr'>", span_end="</span>") if selected_tab == plugin.slug else ""}
</a> </a>
</li> </li>
%endif %endif
......
## mako ## mako
<%! from django.core.urlresolvers import reverse %> <%!
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext as _
%>
%if urlpath is not Undefined and urlpath: %if urlpath is not Undefined and urlpath:
<header> <header>
...@@ -29,7 +32,7 @@ ...@@ -29,7 +32,7 @@
%if create_article_root: %if create_article_root:
<a class="add-article-btn btn pull-left" href="${reverse('wiki:create', kwargs={'path' : create_article_root.path})}" style="padding: 7px;"> <a class="add-article-btn btn pull-left" href="${reverse('wiki:create', kwargs={'path' : create_article_root.path})}" style="padding: 7px;">
<span class="icon-plus"></span> <span class="icon-plus"></span>
Add article ${_("Add article")}
</a> </a>
%endif %endif
</div> </div>
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
{# Translators: Do not translate "edX" #} {# Translators: Do not translate "edX" #}
<h3>{% trans "edX Additions:" %}</h3> <h3>{% trans "edX Additions:" %}</h3>
<pre>circuit-schematic:</pre> <pre>circuit-schematic:</pre>
<pre>$LaTeX Math Expression$</pre> <pre>$LaTeX {% trans "Math Expression" %}$</pre>
</section> </section>
</div> </div>
...@@ -33,8 +33,8 @@ ...@@ -33,8 +33,8 @@
<h3>{% trans "Useful examples:" %}</h3> <h3>{% trans "Useful examples:" %}</h3>
<pre> <pre>
http://wikipedia.org http://wikipedia.org
[Wikipedia](http://wikipedia.org) [{% trans "Wikipedia" %}](http://wikipedia.org)
[edX Wiki](wiki:/edx/) [{% trans "edX Wiki" %}](wiki:/edx/)
</pre> </pre>
<pre> <pre>
{% trans "Huge Header" %} {% trans "Huge Header" %}
......
...@@ -10,17 +10,18 @@ ...@@ -10,17 +10,18 @@
<div class="main-article"> <div class="main-article">
{% if revision %} {% if revision %}
<div class="alert alert-info"> <div class="alert alert-info">
<strong>{% trans "Previewing revision" %}:</strong> <strong>{% trans "Previewing revision:" %}</strong>
{% include "wiki/includes/revision_info.html" %} {% include "wiki/includes/revision_info.html" %}
</div> </div>
{% endif %} {% endif %}
{% if merge %} {% if merge %}
<div class="alert alert-info"> <div class="alert alert-info">
<strong>{% trans "Previewing merge between" %}:</strong> <strong>{% trans "Previewing a merge between two revisions:" %}</strong>
{% include "wiki/includes/revision_info.html" with revision=merge1 %} <ol>
<strong>{% trans "and" %}</strong> <li>{% include "wiki/includes/revision_info.html" with revision=merge1 %}</li>
{% include "wiki/includes/revision_info.html" with revision=merge2 %} <li>{% include "wiki/includes/revision_info.html" with revision=merge2 %}</li>
</ol>
</div> </div>
{% endif %} {% endif %}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment