Permalink
Browse files

Merge branch 'master' into bug-797379-state-of-mozilla

  • Loading branch information...
2 parents b91e80f + b26f331 commit e7a2e401894eaa6eaf2a8f1a93e9673b14dde0c4 @pmac pmac committed Nov 6, 2012
@@ -66,6 +66,10 @@ <h1 class="large">Game On</h1>
<p><small>We will only send you Mozilla-related information.</small></p>
<input type="hidden" name="submit" value="submit">
</form>
+<h3>Supported by</h3>
+<p>Game On is made possible in part thanks to the support of Nesta and Nominet Trust.</p>
+<a href="http://www.nesta.org.uk/"><img src="{{ media('img/gameon/nesta-logo.png') }}" alt="Nesta" width="220" height="51" /></a>
+<a href="http://www.nominettrust.org.uk/"><img src="{{ media('img/gameon/nominet-logo.png') }}" alt="Nominet Trust" width="220" height="52" /></a>
{% endblock %}
</aside>
@@ -44,7 +44,7 @@
<dt>Can I be certain my email and password are secure?</dt>
<dd>
- <p>We take security and privacy very seriously (you can read our complete corporate <a href="http://www.mozilla.org/about/policies/privacy-policy.html)">privacy policy here</a>. With Persona, verified email addresses and encrypted passwords are saved on the Mozilla server.</p>
+ <p>We take security and privacy very seriously (you can read our complete corporate <a href="http://www.mozilla.org/about/policies/privacy-policy.html">privacy policy here</a>). With Persona, verified email addresses and encrypted passwords are saved on the Mozilla server.</p>
<p>It uses a client-side cryptographic certificate (that is, it stores tamper-resistant proof in your browser) to prove to the site that the current user owns an particular email address. The site that you're logging in to never actually sees your password.</p>
</dd>
<dt>What is the difference between Persona and BrowserID?</dt>
@@ -9,7 +9,25 @@
{% block content_area %}
<section id="intro">
- <h2>Coming soon</h2>
- <p>This is the future home of our evolving Firefox OS brand (formerly Boot to Gecko) for mobile devices. Check back soon for complete usage examples and rules.</p>
+ <h2>Introduction</h2>
+ <p>Welcome to home of our evolving Firefox OS brand (formerly Boot to Gecko) for mobile devices. Check back soon for complete usage examples and rules.</p>
+</section>
+<section id="wordmark">
+ <div class="build">
+ <h2>Wordmark</h2>
+ <p>The Firefox OS wordmark follows our <a href="{{ url('styleguide.communications.typefaces') }}#wordmarks">tiered font system</a>.</p>
+ </div>
+ <div class="logo">
+ <img src="{{ media('/img/styleguide/box-arrow-left.png') }}" alt="" class="box-arrow" />
+ <img src="{{ media('/img/styleguide/identity/firefoxos/wordmark.png') }}" alt="Logo" />
+ </div>
+ <div class="download">
+ <h4>Download</h4>
+ <ul class="button-list">
+ <li><a href="https://assets.mozillalabs.com/Brands-Logos/Firefox%20OS/wordmark-only/firefox-os_wordmark-only_CMYK.eps" class="button-sand">EPS</a>
+ </li><li><a href="https://assets.mozillalabs.com/Brands-Logos/Firefox%20OS/wordmark-only/firefox-os_wordmark-only_RGB-300dpi.jpg" class="button-sand">JPG (300dpi)</a>
+ </li><li><a href="https://assets.mozillalabs.com/Brands-Logos/Firefox%20OS/wordmark-only/firefox-os_wordmark-only_RGB.png" class="button-sand">PNG</a></li>
+ </ul>
+ </div>
</section>
{% endblock %}
@@ -25,9 +25,10 @@ def add_lang_files(ctx, files):
req.langfiles = files + req.langfiles
-@jingo.register.function
+# TODO: make an ngettext compatible function. The pluaralize clause of a
+# trans block won't work untill we do.
@jinja2.contextfunction
-def _(ctx, text):
+def gettext(ctx, text):
"""Translate a string, loading the translations for the locale if
necessary."""
install_lang_files(ctx)
@@ -38,17 +39,17 @@ def _(ctx, text):
@jingo.register.function
@jinja2.contextfunction
-def gettext(ctx, text):
- """Override the gettext call to pass through our system. This is
- hacky, but lets us use the trans blocks and other nice integration
- features of gettext. """
- return _(ctx, text)
-
-
-@jingo.register.function
-@jinja2.contextfunction
def lang_files(ctx, *files):
"""Add more lang files to the translation object"""
# Filter out empty files
install_lang_files(ctx)
add_lang_files(ctx, [f for f in files if f])
+
+
+# backward compatible for imports
+_ = gettext
+
+
+# Once tower is fixed and we only need to install the above `gettext` function
+# into Jinja2 once, we should do it here. The call is simply:
+# jingo.env.install_gettext_callables(gettext, gettext)
@@ -0,0 +1,17 @@
+import jingo
+
+from l10n_utils.helpers import gettext
+
+
+# TODO: Fix tower and remove this.
+class FixLangFileTranslationsMiddleware(object):
+ """
+ Middleware that will overwrite the gettext functions in the Jinja2 setup.
+ tower.activate() called by LocaleURLMiddleware sets them to tower's own
+ functions.
+
+ Bug 808580
+ """
+
+ def process_request(self, request):
+ jingo.env.install_gettext_callables(gettext, gettext)
@@ -1,7 +1,16 @@
-import re
-import uuid
+from jinja2.ext import Extension, InternationalizationExtension, nodes
+from tower import strip_whitespace
-from jinja2.ext import Environment, Extension, nodes
+
+class I18nExtension(InternationalizationExtension):
+ """
+ Use this instead of `tower.template.i18n` because the override of `_`
+ global was throwing errors.
+ """
+ def _parse_block(self, parser, allow_pluralize):
+ ref, buffer = super(I18nExtension, self)._parse_block(parser,
+ allow_pluralize)
+ return ref, strip_whitespace(buffer)
class L10nBlockExtension(Extension):
@@ -80,7 +89,6 @@ def parse(self, parser):
content_nodes.insert(0, [nodes.Call(nodes.Name('super', 'load'),
[], [], None, None)])
-
# Since we are a block, we must emit a block too, so make a
# random one that contains a call to the load function
node = nodes.Block().set_lineno(lineno)
@@ -94,3 +102,4 @@ def parse(self, parser):
# Makes for a prettier import in settings.py
l10n_blocks = L10nBlockExtension
lang_blocks = LoadLangExtension
+i18n = I18nExtension
@@ -0,0 +1,6 @@
+;The State of Mozilla
+Die Lage von Mozilla
+
+
+;Mozilla‘s vision of the Internet is a place where anyone can access information, a place where everyone can hack and tinker; one that has openness, freedom and transparency; where users have control over their personal data and where all minds have the freedom to create and to consume without walls or tight restrictions.
+Mozillas Vision des Internets ist ein Ort, wo jeder auf Informationen zugreifen kann, ein Ort, wo jeder programmieren und herumspielen kann; einer, der offen, frei und transparent ist; wo Benutzer die Kontrolle über ihre persönlichen Daten haben und wo jeder Geist die Freiheit hat, zu schaffen und zu konsumieren, ohne Mauern oder enge Einschränkungen.
@@ -0,0 +1,14 @@
+<html>
+ <body>
+ <h1>{{ _('The State of Mozilla') }}</h1>
+ <p>
+ {% trans %}
+ Mozilla‘s vision of the Internet is a place where anyone can
+ access information, a place where everyone can hack and tinker;
+ one that has openness, freedom and transparency; where users have
+ control over their personal data and where all minds have the
+ freedom to create and to consume without walls or tight restrictions.
+ {% endtrans %}
+ </p>
+ </body>
+</html>
@@ -0,0 +1,7 @@
+from django.conf.urls.defaults import *
+from mozorg.util import page
+
+
+urlpatterns = patterns('',
+ page('trans-block-reload-test', 'trans_block_reload_test.html'),
+)
@@ -1,10 +1,15 @@
import os
+from django.conf import settings
+from django.core.urlresolvers import clear_url_caches
+from django.test.client import Client
+
from jingo import env
from jinja2 import FileSystemLoader
from mock import patch
from nose.plugins.skip import SkipTest
-from nose.tools import eq_
+from nose.tools import eq_, ok_
+from pyquery import PyQuery as pq
from mozorg.tests import TestCase
@@ -13,6 +18,33 @@
TEMPLATE_DIRS = (os.path.join(ROOT, 'templates'),)
+class TestTransBlocks(TestCase):
+ def setUp(self):
+ clear_url_caches()
+ self.client = Client()
+
+ @patch.object(env, 'loader', FileSystemLoader(TEMPLATE_DIRS))
+ @patch.object(settings, 'ROOT_URLCONF', 'l10n_utils.tests.test_files.urls')
+ @patch.object(settings, 'ROOT', ROOT)
+ def test_trans_block_works(self):
+ """ Sanity check to make sure translations work at all. """
+ response = self.client.get('/de/trans-block-reload-test/')
+ doc = pq(response.content)
+ gettext_call = doc('h1')
+ trans_block = doc('p')
+ eq_(gettext_call.text(), 'Die Lage von Mozilla')
+ ok_(trans_block.text().startswith('Mozillas Vision des Internets ist'))
+
+ def test_trans_block_works_reload(self):
+ """
+ Translation should work after a reload.
+
+ bug 808580
+ """
+ self.test_trans_block_works()
+ self.test_trans_block_works()
+
+
class TestTemplateLangFiles(TestCase):
@patch.object(env, 'loader', FileSystemLoader(TEMPLATE_DIRS))
def test_added_lang_files(self):
@@ -79,6 +79,9 @@ hgroup {
#gameon .sidebar {
width: (@gridColumnWidth * 3) + (@gridGutterWidth * 2);
margin-left: @gridGutterWidth / 2;
+ img {
+ margin-bottom: @gridGutterWidth;
+ }
}
@media only screen and (min-width: @breakTablet) and (max-width: @breakDesktop) {
#gameon .main-column {
@@ -4,15 +4,47 @@
.firefoxos-branding {
#intro {
- clear: both;
- .clearfix;
- min-height: 300px;
- background: url(/media/img/styleguide/identity/firefoxos/firefoxos-placeholder.png) 100% 0 no-repeat;
+ float: left;
+ .divider;
h2 {
.span_guide(3);
}
p {
- .span_guide(5);
+ .span_guide(9);
+ }
+ }
+ #wordmark {
+ float: left;
+ .build {
+ .span_guide(3);
+ }
+ .logo {
+ .span_guide(6);
+ position: relative;
+ img {
+ background-color: #fff;
+ margin-bottom: 10px;
+ padding: 10px;
+ }
+ img.box-arrow {
+ background: none;
+ position: absolute;
+ top: 0;
+ left: -20px;
+ }
+ }
+ .download {
+ .span_guide(3);
+ span {
+ display: block;
+ font-size: 18px;
+ }
+ p {
+ margin-bottom: 0;
+ }
+ }
+ .button-sand, .button-sand:link, .button-sand:visited {
+ padding: 0 12px;
}
}
}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
@@ -48,7 +48,7 @@
def JINJA_CONFIG():
return {
'extensions': [
- 'tower.template.i18n', 'jinja2.ext.do', 'jinja2.ext.with_',
+ 'l10n_utils.template.i18n', 'jinja2.ext.do', 'jinja2.ext.with_',
'jinja2.ext.loopcontrols', 'l10n_utils.template.l10n_blocks',
'l10n_utils.template.lang_blocks'
],
@@ -417,6 +417,7 @@ def JINJA_CONFIG():
'mozorg.middleware.CacheMiddleware',
'mozorg.middleware.NewsletterMiddleware',
'dnt.middleware.DoNotTrackMiddleware',
+ 'l10n_utils.middleware.FixLangFileTranslationsMiddleware',
)
INSTALLED_APPS = (

0 comments on commit e7a2e40

Please sign in to comment.