Skip to content

Commit

Permalink
basic i18n setup
Browse files Browse the repository at this point in the history
  • Loading branch information
Cedrik Vanderhaegen committed Apr 18, 2014
1 parent ee50315 commit e799ff9
Show file tree
Hide file tree
Showing 9 changed files with 91 additions and 36 deletions.
1 change: 1 addition & 0 deletions atramhasis/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ def includeme(config):
config.add_route('search_result', pattern='/conceptschemes/{scheme_id}/c', accept='text/html')
config.include('pyramid_skosprovider')
config.scan('pyramid_skosprovider')
config.add_translation_dirs('atramhasis:locale/')

config.scan()

Expand Down
21 changes: 0 additions & 21 deletions atramhasis/locale/de/LC_MESSAGES/atramhasis.po

This file was deleted.

23 changes: 23 additions & 0 deletions atramhasis/locale/en/LC_MESSAGES/atramhasis.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# English translations for atramhasis.
# Copyright (C) 2014 ORGANIZATION
# This file is distributed under the same license as the atramhasis project.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2014.
#
msgid ""
msgstr ""
"Project-Id-Version: atramhasis 0.0\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2014-04-18 14:14+0200\n"
"PO-Revision-Date: 2014-04-18 14:38+0200\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: en <[email protected]>\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 1.3\n"

#: atramhasis/templates/atramhasis.jinja2:10
msgid "tr_search"
msgstr "Search"

26 changes: 14 additions & 12 deletions atramhasis/locale/fr/LC_MESSAGES/atramhasis.po
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
# Translations template for PROJECT.
# Copyright (C) 2011 ORGANIZATION
# This file is distributed under the same license as the PROJECT project.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2011.
# French translations for atramhasis.
# Copyright (C) 2014 ORGANIZATION
# This file is distributed under the same license as the atramhasis project.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2014.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Project-Id-Version: atramhasis 0.0\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2011-05-12 09:14-0330\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"POT-Creation-Date: 2014-04-18 14:14+0200\n"
"PO-Revision-Date: 2014-04-18 14:38+0200\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
"Language-Team: fr <[email protected]>\n"
"Plural-Forms: nplurals=2; plural=(n > 1)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 0.9.6\n"
"Generated-By: Babel 1.3\n"

#: atramhasis/templates/atramhasis.jinja2:10
msgid "tr_search"
msgstr "Rechercher"

msgid "Hello!"
msgstr "Bonjour!"
23 changes: 23 additions & 0 deletions atramhasis/locale/nl/LC_MESSAGES/atramhasis.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Dutch translations for atramhasis.
# Copyright (C) 2014 ORGANIZATION
# This file is distributed under the same license as the atramhasis project.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2014.
#
msgid ""
msgstr ""
"Project-Id-Version: atramhasis 0.0\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2014-04-18 14:14+0200\n"
"PO-Revision-Date: 2014-04-18 14:22+0200\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: nl <[email protected]>\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 1.3\n"

#: atramhasis/templates/atramhasis.jinja2:10
msgid "tr_search"
msgstr "Zoeken"

18 changes: 17 additions & 1 deletion atramhasis/static/js/vendor/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,20 @@ $(document).ready(function () {
var url = $("#scheme").val();
$("#search-form").attr("action", url);
});
});

/*
* Language cookie
*/
var usrLang = $.cookie( '_LOCALE_' );
if (usrLang==null)usrLang='en'
$('#LanguageDropDownList').val(usrLang);
$('#LanguageDropDownList').change(function () {
changeLanguage($('#LanguageDropDownList').val());
});
});

function changeLanguage(usrLang) {
$.cookie('_LOCALE_', usrLang, { expires: 365, path: '/' });
location.reload();
}

2 changes: 1 addition & 1 deletion atramhasis/templates/atramhasis.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
{% block content %}
<div class="row">
<div class="large-12 columns">
<h5 class="title">Search</h5>
<h5 class="title"> {% trans %}tr_search{% endtrans %} </h5>
<div class="content">
<form id="search-form" action="#" method="get">
<div class="row collapse">
Expand Down
12 changes: 12 additions & 0 deletions atramhasis/templates/base.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,17 @@
<h1><a href="{{ request.route_path('home') }}">[atramhasis]</a></h1>
</li>
</ul>


<section class="top-bar-section">
<ul class="right">
<select id="LanguageDropDownList">
<option value="nl">nl</option>
<option value="fr">fr</option>
<option value="en">en</option>
</select>
</ul>
</section>
</nav>
</div>
</div>
Expand All @@ -41,6 +52,7 @@
</footer>

<script src="{{request.application_url}}/static/js/vendor/jquery.js"></script>
<script src="{{request.application_url}}/static/js/vendor/jquery.cookie.js"></script>
<!-- Included JS Files (Compressed) -->
<script src="{{request.application_url}}/static/js/foundation.min.js"></script>
<script src="{{request.application_url}}/static/js/vendor/app.js"></script>
Expand Down
1 change: 0 additions & 1 deletion message-extraction.ini
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
[python: **.py]
[jinja2: **.jinja2]
encoding = utf-8

0 comments on commit e799ff9

Please sign in to comment.