Skip to content

Commit

Permalink
stub a ja-JP translation and add routing (#43)
Browse files Browse the repository at this point in the history
  • Loading branch information
rviscomi committed Jun 12, 2019
1 parent 55da858 commit f3c51e6
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 3 deletions.
12 changes: 10 additions & 2 deletions src/main.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from flask import Flask, render_template
from flask import Flask, render_template, abort
from flask_talisman import Talisman
from csp import csp

Expand All @@ -7,10 +7,18 @@
content_security_policy=csp,
content_security_policy_nonce_in=['script-src'])

SUPPORTED_LANGS = ('en', 'ja')

@app.route('/')
def index():
return render_template('en-US/index.html')
return render_template('en/index.html')

@app.route('/<lang>/')
def index_i18n(lang):
if lang not in SUPPORTED_LANGS:
abort(404)

return render_template('%s/index.html' % lang)


@app.errorhandler(500)
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends "en-US/base.html" %}
{% extends "en/base.html" %}

{% block title %}
The Web Almanac by HTTP Archive
Expand Down
3 changes: 3 additions & 0 deletions src/templates/ja/base.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{% extends "base.html" %}

{% block lang %}ja-JP{% endblock %}
32 changes: 32 additions & 0 deletions src/templates/ja/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{% extends "ja/base.html" %}

{% block title %}
The Web Almanac by HTTP Archive
{% endblock %}

{# TODO(MSakamaki): Translate to Japanese. #}
{% block main %}
<section>
<div>
<img src="../static/images/ha.png" alt="HTTP Archive">

<h1>
Introducing the <b>Web Almanac</b>, coming November 2019.
</h1>

<p>
The Web Almanac is HTTP Archive's annual "state of the web" report.
Our mission is to combine the powerful analytics of HTTP Archive with the
expertise of the web community. The Almanac is made up of four primary
sections: page content, user experience, content delivery, and
content distribution. Each section is comprised of chapters that explore
the state of specific areas like JavaScript usage, accessibility,
content management systems, and compression.
</p>

<a href="https://github.com/HTTPArchive/almanac.httparchive.org">
Learn more
</a>
</div>
</section>
{% endblock %}

0 comments on commit f3c51e6

Please sign in to comment.