Skip to content

Commit

Permalink
i10n to i18n
Browse files Browse the repository at this point in the history
The Accept-Language header seems to be given higher priority than the
LANGUAGE_CODE setting.

[#37]
  • Loading branch information
zackmdavis committed Nov 29, 2014
1 parent cbe415b commit 505fff7
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ logs/finetooth.log*
.coverage
htmlcov/

# compiled translation files
*.mo

# the SQLite database
db.sqlite3

Expand Down
11 changes: 11 additions & 0 deletions settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
"""

import os

from django.utils.translation import ugettext_lazy as _

BASE_DIR = os.path.dirname(os.path.dirname(__file__))

IS_DEVELOPMENT = os.path.exists('.development')
Expand Down Expand Up @@ -35,6 +38,7 @@

MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.locale.LocaleMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
Expand Down Expand Up @@ -75,6 +79,13 @@

USE_TZ = False

LANGUAGES = (
('en', _('English')),
('es', _('Spanish')),
)

LOCALE_PATHS = ('translations',)

TEMPLATE_DIRS = ('templates',)
TEMPLATE_CONTEXT_PROCESSORS = (
'django.contrib.auth.context_processors.auth',
Expand Down
5 changes: 4 additions & 1 deletion templates/base.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{% load i18n %}
{% load bootstrap3 %}

<!DOCTYPE html>
Expand All @@ -14,7 +15,9 @@

<div class="navbar navbar-default navbar-static-top">
<div class="container">
<span id="brand" class="pull-left"><a href="/">Finetooth</a></span>
<span id="brand" class="pull-left">
<a href="/">{% trans "Finetooth" %}</a>
</span>
<ul class="nav navbar-nav">
<li class="active"><a href="/">Home</a></li>
{% if not user.is_authenticated %}
Expand Down
27 changes: 27 additions & 0 deletions translations/es/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Spanish translation message file for Finetooth.
# Copyright (C) 2014 Zack M. Davis
# This file is distributed under the same license as Finetooth.
#
#, fuzzy
msgid ""
msgstr ""
"POT-Creation-Date: 2014-11-29 01:30+0000\n"
"PO-Revision-Date: 2014-11-29 17:51-0800\n"
"Last-Translator: well, Google Translate is doing most of the actual work\n"
"Language: Spanish\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"

#: settings.py:83
msgid "English"
msgstr "Inglés"

#: settings.py:84
msgid "Spanish"
msgstr "Español"

#: templates/base.html:18
msgid "Finetooth"
msgstr "Púas-finas"

0 comments on commit 505fff7

Please sign in to comment.