Skip to content
Browse files

adding internationalization support

  • Loading branch information...
1 parent b45a123 commit d05dcb14c5d1bb5b1bcdfbb80814966844c7dd6d @ialbert committed Sep 28, 2012
View
9 biostar.sh
@@ -81,6 +81,15 @@ while (( "$#" )); do
$PYTHON_EXE $DJANGO_ADMIN flush --noinput --settings=$DJANGO_SETTINGS_MODULE
fi
+ if [ "$1" = "messages" ]; then
+ echo "*** compiling messages"
+ pushd .
+ cd main/server
+ ../../django-admin.py makemessages -l hu_HU -e html
+ ../../django-admin.py compilemessages
+ popd
+ fi
+
if [ "$1" = "init" ]; then
echo "*** initializing server on $BIOSTAR_HOSTNAME"
$PYTHON_EXE $DJANGO_ADMIN syncdb -v $VERBOSITY --noinput --settings=$DJANGO_SETTINGS_MODULE
View
5 conf/default.env
@@ -1,6 +1,6 @@
# biostar source directory
-SRC=.
+SRC=`pwd`
# load the biostar home
export BIOSTAR_HOME=$SRC
@@ -9,7 +9,8 @@ export BIOSTAR_HOME=$SRC
export DJANGO_SETTINGS_MODULE=main.settings
# extra python libraries
-export PYTHONPATH=$PYTHONPATH:$SRC:$SRC/main:$SRC/libs:$SRC/libs/libraries.zip
+export PYTHONPATH=$SRC:$SRC/main:$SRC/libs:$SRC/libs/libraries.zip
+#echo PYTHONPATH=$PYTHONPATH
# hostname
export BIOSTAR_HOSTNAME="0.0.0.0:8080"
View
9 conf/hu.env
@@ -0,0 +1,9 @@
+#
+# source default.env then this file
+#
+export DJANGO_SETTINGS_MODULE=conf.hu
+
+#
+# extract the parameters from the django settings file
+#
+echo "*** reading DJANGO_SETTINGS_MODULE=$DJANGO_SETTINGS_MODULE"
View
28 conf/hu.py
@@ -0,0 +1,28 @@
+# -*- coding: utf-8 -*-
+#
+# import from the main settings then override some of the values
+#
+from main.settings import *
+
+USE_I18N = True
+
+USE_L10N = True
+
+LANGUAGE_CODE = 'hu-HU'
+
+ANON_PILL_BAR = [
+ ("all", "/", "Minden", "" ),
+ ("news", "/show/news/", "Hírek", "News" ),
+ ("questions", "/show/questions/", "Kérdések", "Question" ),
+ ("unanswered", "/show/unanswered/", "Válaszolatlan", "Unanswered" ),
+ ("tutorials", "/show/tutorials/", "Lecke", "Tutorial" ),
+ ("tools", "/show/tools/", "Progi", "Tool" ),
+ ("videos", "/show/videos/", "Videó", "Video" ),
+ ("jobs", "/show/jobs/", "Állas", "Job" ),
+ ]
+
+USER_PILL_BAR = list(ANON_PILL_BAR)
+
+USER_PILL_BAR.insert(1,
+ ("mytags", "/show/mytags/", "Saját Cimke", "" ),
+)
View
BIN main/server/locale/hu_HU/LC_MESSAGES/django.mo
Binary file not shown.
View
109 main/server/locale/hu_HU/LC_MESSAGES/django.po
@@ -0,0 +1,109 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2012-09-28 12:52-0500\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: templates/pages/about.html:8
+msgid "About Biostar"
+msgstr "Biosztár Info"
+
+#: templates/pages/about.html:16
+msgid ""
+"\n"
+" This site's focus is <b>bioinformatics</b>, <b>computational genomics</"
+"b> and <b>biological data analysis</b>.\n"
+" We welcome posts that are:\n"
+" "
+msgstr ""
+"\n"
+"OK"
+
+#: templates/widgets/nav.bar.html:15
+msgid "BioStar"
+msgstr "BioSztár"
+
+#: templates/widgets/nav.bar.html:20
+msgid "Tags"
+msgstr "Cinkék!"
+
+#: templates/widgets/nav.bar.html:21
+msgid "Users"
+msgstr "Sztárok"
+
+#: templates/widgets/nav.bar.html:22
+msgid "Badges"
+msgstr "Érmék"
+
+#: templates/widgets/nav.bar.html:23
+msgid "About"
+msgstr "Rólunk"
+
+#: templates/widgets/nav.bar.html:24
+msgid "RSS"
+msgstr ""
+
+#: templates/widgets/nav.bar.html:28 templates/widgets/tab.bar.html:13
+msgid "Search"
+msgstr "Keress"
+
+#: templates/widgets/nav.bar.html:39
+msgid "Logout"
+msgstr "Kilép"
+
+#: templates/widgets/nav.bar.html:43
+msgid "Sign In"
+msgstr "Belép"
+
+#: templates/widgets/page.bar.html:5 templates/widgets/page.bar.html.py:8
+msgid "previous"
+msgstr "előző"
+
+#: templates/widgets/page.bar.html:6 templates/widgets/page.bar.html.py:8
+msgid "first"
+msgstr "első"
+
+#: templates/widgets/page.bar.html:11
+msgid "page"
+msgstr "lap"
+
+#: templates/widgets/page.bar.html:11
+msgid "of"
+msgstr ""
+
+#: templates/widgets/page.bar.html:14 templates/widgets/page.bar.html.py:17
+msgid "last"
+msgstr "utolsó"
+
+#: templates/widgets/page.bar.html:15 templates/widgets/page.bar.html.py:17
+msgid "next"
+msgstr "következő"
+
+#: templates/widgets/tab.bar.html:10
+msgid "Recent"
+msgstr "Friss"
+
+#: templates/widgets/tab.bar.html:11
+msgid "Posts"
+msgstr "Cikkek"
+
+#: templates/widgets/tab.bar.html:12
+msgid "Planet"
+msgstr "Bolygó"
+
+#: templates/widgets/tab.bar.html:14
+msgid "New Post!"
+msgstr "Új Cikk!"
View
7 main/server/templates/pages/about.html
@@ -1,19 +1,22 @@
{% extends "base.html" %}
+{% load i18n %}
{% load basic %}
{% load widgets %}
{% load humanize %}
{% block title %}
- About BioStar
+ {% trans "About Biostar" %}
{% endblock %}
{% block body %}
<div class="row">
<div class="par">
- This site's focus is <b>bioinformatics</b>, <b>computational genomics</b> and <b>biological data analysis</b>.
+ {% blocktrans %}
+ This site's focus is <b>bioinformatics</b>, <b>computational genomics</b> and <b>biological data analysis</b>.
We welcome posts that are:
+ {% endblocktrans %}
</div>
<ul>
View
21 main/server/templates/widgets/nav.bar.html
@@ -1,4 +1,5 @@
- {% load basic %}
+{% load i18n %}
+{% load basic %}
{% load widgets %}
{% load url from future %}
@@ -11,20 +12,20 @@
<span class="i-bar"></span>
</a>
- <a class="brand" href="/">BioStar</a>
+ <a class="brand" href="/">{% trans "BioStar" %}</a>
<div class="nav-collapse">
<ul class="nav">
- <li {% active 'tags' nav %}><a href="{% url 'main.server.views.tag_list' %}">Tags</a></li>
- <li {% active 'users' nav %}><a href="{% url 'main.server.views.user_list' %}">Users</a></li>
- <li {% active 'badges' nav %}><a href="{% url 'main.server.views.badge_list' %}">Badges</a></li>
- <li {% active 'about' nav %}><a href="{% url 'main.server.pages.about' %}">About</a></li>
- <li {% active 'rss' nav %}><a href="{% url 'main.server.pages.rss' %}">RSS</a></li>
+ <li {% active 'tags' nav %}><a href="{% url 'main.server.views.tag_list' %}">{% trans "Tags" %}</a></li>
+ <li {% active 'users' nav %}><a href="{% url 'main.server.views.user_list' %}">{% trans "Users" %}</a></li>
+ <li {% active 'badges' nav %}><a href="{% url 'main.server.views.badge_list' %}">{% trans "Badges" %}</a></li>
+ <li {% active 'about' nav %}><a href="{% url 'main.server.pages.about' %}">{% trans "About" %}</a></li>
+ <li {% active 'rss' nav %}><a href="{% url 'main.server.pages.rss' %}">{% trans "RSS" %}</a></li>
</ul>
<form class="navbar-search pull-left" action="{% url 'main.server.search.main' %}" method="get">
- <input type="text" name='q' class="search-query" value="{{q}}" placeholder="Search">
+ <input type="text" name='q' class="search-query" value="{{q}}" placeholder="{% trans "Search" %}">
</form>
{%if user.is_authenticated %}
@@ -35,11 +36,11 @@
&nbsp;
<i class="icon-user icon-white"></i>
<a href="{% url 'main.server.views.user_profile' user.id %}">{{ user.profile.display_name }}</a> {% flair user %} <b>{% bignum user.profile.score %}</b>
- | <a href="/logout/?next_page=/">Logout</a>
+ | <a href="/logout/?next_page=/">{% trans "Logout" %}</a>
</p>
{% else %}
<p class="navbar-text pull-right login">
- <a class="btn btn-success" href='/openid/login/' rel="nofollow"><i class="icon-user icon-white"></i> Sign In</a>
+ <a class="btn btn-success" href='/openid/login/' rel="nofollow"><i class="icon-user icon-white"></i> {% trans "Sign In" %}</a>
</p>
{% endif %}
View
15 main/server/templates/widgets/page.bar.html
@@ -1,19 +1,20 @@
+{% load i18n %}
<div class="page_bar">&nbsp;
{% if page.paginator.num_pages > 1 %}
{% if page.has_previous %}
- <a href="{{path}}?page={{page.previous_page_number}}&q={{params.q}}&sort={{params.sort}}">&lt;previous</a>
- &bull; <a href="{{path}}?page=1&q={{params.q}}&sort={{params.sort}}">first</a>
+ <a href="{{path}}?page={{page.previous_page_number}}&q={{params.q}}&sort={{params.sort}}">&lt;{% trans "previous" %}</a>
+ &bull; <a href="{{path}}?page=1&q={{params.q}}&sort={{params.sort}}">{% trans "first" %}</a>
{% else %}
- <span style="color:#555555;">&lt;previous &bull; first</span>
+ <span style="color:#555555;">&lt;{% trans "previous" %} &bull; {% trans "first" %}</span>
{% endif %}
- &bull; page {{ page.number }} of {{ page.paginator.num_pages }}
+ &bull; {% trans "page" %} {{ page.number }} {% trans "of" %} {{ page.paginator.num_pages }}
{% if page.has_next %}
- &bull; <a href="{{path}}?page={{page.paginator.num_pages}}&q={{params.q}}&sort={{params.sort}}">last</a>
- &bull; <a href="{{path}}?page={{page.next_page_number}}&q={{params.q}}&sort={{params.sort}}">next&gt;</a>
+ &bull; <a href="{{path}}?page={{page.paginator.num_pages}}&q={{params.q}}&sort={{params.sort}}">{% trans "last" %}</a>
+ &bull; <a href="{{path}}?page={{page.next_page_number}}&q={{params.q}}&sort={{params.sort}}">{% trans "next" %}&gt;</a>
{% else %}
- <span style="color:#555555;">&bull; last &bull; next&gt;</span>
+ <span style="color:#555555;">&bull; {% trans "last" %}&bull; {% trans "next" %}&gt;</span>
{% endif %}
{% endif %}
&nbsp;
View
11 main/server/templates/widgets/tab.bar.html
@@ -1,3 +1,4 @@
+{% load i18n %}
{% load basic %}
{% load widgets %}
{% load url from future %}
@@ -6,11 +7,11 @@
<div class="row">
<div>
<ul class="nav nav-tabs">
- <li {% active 'recent' tab %}><a href="/show/recent/">Recent</a></li>
- <li {% active 'posts' tab %}><a href="/">Posts</a></li>
- <li {% active 'planet' tab %}><a href="/show/planet/">Planet&nbsp;{% show_count 'Blog' counts %}</a></li>
- <li {% active 'search' tab %}><a href="{% url 'main.server.search.main' %}">Search</a></li>
- <li {% active 'new' tab %}><a href="/new/post/"> <span class="newpost">New Post!</span></a></li>
+ <li {% active 'recent' tab %}><a href="/show/recent/">{% trans "Recent" %}</a></li>
+ <li {% active 'posts' tab %}><a href="/">{% trans "Posts" %}</a></li>
+ <li {% active 'planet' tab %}><a href="/show/planet/">{% trans "Planet" %} {% show_count 'Blog' counts %}</a></li>
+ <li {% active 'search' tab %}><a href="{% url 'main.server.search.main' %}">{% trans "Search" %}</a></li>
+ <li {% active 'new' tab %}><a href="/new/post/"> <span class="newpost">{% trans "New Post!" %}</span></a></li>
</ul>
</div>
View
2 main/settings.py
@@ -152,6 +152,7 @@ def path(*args):
MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
+ #'django.middleware.locale.LocaleMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
@@ -183,6 +184,7 @@ def path(*args):
'django.core.context_processors.request',
'django.core.context_processors.static',
'django.contrib.messages.context_processors.messages',
+ 'django.core.context_processors.i18n',
"main.context.extras",
"main.context.popular_tags"
)

0 comments on commit d05dcb1

Please sign in to comment.
Something went wrong with that request. Please try again.