[WIP] adding translations for everything, everywhere, using the beautiful rainbow placeholder

parent bf9c8a5d
# 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: 2017-12-12 17:27+0000\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"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: failmap_admin/map/static/js/failmap.js:68
#: failmap_admin/map/static/js/views.js:405
#: failmap_admin/map/static/js/views.js:410
#: failmap_admin/map/static/js/views.js:413
msgid "View Full Screen"
msgstr ""
#: failmap_admin/map/static/js/failmap.js:115
msgid "Search organization"
msgstr ""
#: failmap_admin/map/static/js/failmap.js:136
#: failmap_admin/map/static/js/failmap.js:140
msgid "High"
msgstr ""
#: failmap_admin/map/static/js/failmap.js:137
#: failmap_admin/map/static/js/failmap.js:141
msgid "Medium"
msgstr ""
#: failmap_admin/map/static/js/failmap.js:138
#: failmap_admin/map/static/js/failmap.js:142
msgid "Low"
msgstr ""
#: failmap_admin/map/static/js/failmap.js:188
msgid "Url"
msgstr ""
#: failmap_admin/map/static/js/failmap.js:189
msgid "H"
msgstr ""
#: failmap_admin/map/static/js/failmap.js:190
msgid "M"
msgstr ""
#: failmap_admin/map/static/js/failmap.js:191
msgid "L"
msgstr ""
#: failmap_admin/map/static/js/failmap.js:210
msgid "Good"
msgstr ""
#: failmap_admin/map/static/js/failmap.js:211
msgid "Mediocre"
msgstr ""
#: failmap_admin/map/static/js/failmap.js:212
msgid "Bad"
msgstr ""
#: failmap_admin/map/static/js/failmap.js:213
msgid "Unknown"
msgstr ""
#: failmap_admin/map/static/js/graphs.js:102
msgid "low"
msgstr ""
#: failmap_admin/map/static/js/graphs.js:104
msgid "medium"
msgstr ""
#: failmap_admin/map/static/js/graphs.js:106
msgid "high"
msgstr ""
#: failmap_admin/map/static/js/script.js:11
msgid "2 weeks ago"
msgstr ""
#: failmap_admin/map/static/js/script.js:12
msgid "3 weeks ago"
msgstr ""
#: failmap_admin/map/static/js/script.js:13
msgid "1 month ago"
msgstr ""
#: failmap_admin/map/static/js/script.js:14
msgid "2 months ago"
msgstr ""
#: failmap_admin/map/static/js/script.js:15
msgid "3 months ago"
msgstr ""
#: failmap_admin/map/static/js/script.js:16
msgid "7 days ago"
msgstr ""
#: failmap_admin/map/static/js/script.js:17
msgid "now"
msgstr ""
#: failmap_admin/map/static/js/views.js:44
msgid "week"
msgstr ""
#: failmap_admin/map/static/js/views.js:211
msgid "score perfect"
msgstr ""
#: failmap_admin/map/static/js/views.js:213
msgid "score high"
msgstr ""
#: failmap_admin/map/static/js/views.js:215
msgid "score medium"
msgstr ""
#: failmap_admin/map/static/js/views.js:217
msgid "score low"
msgstr ""
#: failmap_admin/map/static/js/views.js:411
msgid "Exit Full Screen"
msgstr ""
#: failmap_admin/map/static/js/views.js:442
#: failmap_admin/map/static/js/views.js:447
msgid "top congratulations"
msgstr ""
#: failmap_admin/map/static/js/views.js:443
#: failmap_admin/map/static/js/views.js:448
msgid "top position"
msgstr ""
#: failmap_admin/map/static/js/views.js:444
msgid "top fail on failmap"
msgstr ""
#: failmap_admin/map/static/js/views.js:445
#: failmap_admin/map/static/js/views.js:450
msgid "hastag fail"
msgstr ""
#: failmap_admin/map/static/js/views.js:445
#: failmap_admin/map/static/js/views.js:450
msgid "hastag failmap"
msgstr ""
#: failmap_admin/map/static/js/views.js:449
msgid "top win on failmap"
msgstr ""
# 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: 2017-12-12 17:27+0000\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"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: failmap_admin/map/static/js/failmap.js:68
#: failmap_admin/map/static/js/views.js:405
#: failmap_admin/map/static/js/views.js:410
#: failmap_admin/map/static/js/views.js:413
msgid "View Full Screen"
msgstr "Volledig scherm"
#: failmap_admin/map/static/js/failmap.js:115
msgid "Search organization"
msgstr "Zoek op gemeente..."
#: failmap_admin/map/static/js/failmap.js:136
#: failmap_admin/map/static/js/failmap.js:140
msgid "High"
msgstr "Hoog"
#: failmap_admin/map/static/js/failmap.js:137
#: failmap_admin/map/static/js/failmap.js:141
msgid "Medium"
msgstr "Midden"
#: failmap_admin/map/static/js/failmap.js:138
#: failmap_admin/map/static/js/failmap.js:142
msgid "Low"
msgstr "Laag"
#: failmap_admin/map/static/js/failmap.js:188
msgid "Url"
msgstr ""
#: failmap_admin/map/static/js/failmap.js:189
msgid "H"
msgstr ""
#: failmap_admin/map/static/js/failmap.js:190
msgid "M"
msgstr ""
#: failmap_admin/map/static/js/failmap.js:191
msgid "L"
msgstr ""
#: failmap_admin/map/static/js/failmap.js:210
msgid "Good"
msgstr "Goed"
#: failmap_admin/map/static/js/failmap.js:211
msgid "Mediocre"
msgstr "Matig"
#: failmap_admin/map/static/js/failmap.js:212
msgid "Bad"
msgstr "Slecht"
#: failmap_admin/map/static/js/failmap.js:213
msgid "Unknown"
msgstr "Onbekend"
#: failmap_admin/map/static/js/graphs.js:102
msgid "low"
msgstr "laag"
#: failmap_admin/map/static/js/graphs.js:104
msgid "medium"
msgstr "midden"
#: failmap_admin/map/static/js/graphs.js:106
msgid "high"
msgstr "hoog"
#: failmap_admin/map/static/js/script.js:11
msgid "2 weeks ago"
msgstr ""
#: failmap_admin/map/static/js/script.js:12
msgid "3 weeks ago"
msgstr ""
#: failmap_admin/map/static/js/script.js:13
msgid "1 month ago"
msgstr ""
#: failmap_admin/map/static/js/script.js:14
msgid "2 months ago"
msgstr ""
#: failmap_admin/map/static/js/script.js:15
msgid "3 months ago"
msgstr ""
#: failmap_admin/map/static/js/script.js:16
msgid "7 days ago"
msgstr ""
#: failmap_admin/map/static/js/script.js:17
#, fuzzy
#| msgid "Low"
msgid "now"
msgstr "Laag"
#: failmap_admin/map/static/js/views.js:44
msgid "week"
msgstr ""
#: failmap_admin/map/static/js/views.js:211
msgid "score perfect"
msgstr "perfect"
#: failmap_admin/map/static/js/views.js:213
msgid "score high"
msgstr "hoog"
#: failmap_admin/map/static/js/views.js:215
msgid "score medium"
msgstr "midden"
#: failmap_admin/map/static/js/views.js:217
msgid "score low"
msgstr "laag"
#: failmap_admin/map/static/js/views.js:411
msgid "Exit Full Screen"
msgstr "Sluit volledig scherm"
#: failmap_admin/map/static/js/views.js:442
#: failmap_admin/map/static/js/views.js:447
msgid "top congratulations"
msgstr ""
#: failmap_admin/map/static/js/views.js:443
#: failmap_admin/map/static/js/views.js:448
msgid "top position"
msgstr ""
#: failmap_admin/map/static/js/views.js:444
msgid "top fail on failmap"
msgstr ""
#: failmap_admin/map/static/js/views.js:445
#: failmap_admin/map/static/js/views.js:450
msgid "hastag fail"
msgstr ""
#: failmap_admin/map/static/js/views.js:445
#: failmap_admin/map/static/js/views.js:450
msgid "hastag failmap"
msgstr ""
#: failmap_admin/map/static/js/views.js:449
msgid "top win on failmap"
msgstr ""
This diff is collapsed.
# 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: 2017-12-12 17:27+0000\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"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: failmap_admin/map/static/js/failmap.js:68
#: failmap_admin/map/static/js/views.js:405
#: failmap_admin/map/static/js/views.js:410
#: failmap_admin/map/static/js/views.js:413
msgid "View Full Screen"
msgstr "🌈"
#: failmap_admin/map/static/js/failmap.js:115
msgid "Search organization"
msgstr "🌈"
#: failmap_admin/map/static/js/failmap.js:136
#: failmap_admin/map/static/js/failmap.js:140
msgid "High"
msgstr "🌈"
#: failmap_admin/map/static/js/failmap.js:137
#: failmap_admin/map/static/js/failmap.js:141
msgid "Medium"
msgstr "🌈"
#: failmap_admin/map/static/js/failmap.js:138
#: failmap_admin/map/static/js/failmap.js:142
msgid "Low"
msgstr "🌈"
#: failmap_admin/map/static/js/failmap.js:188
msgid "Url"
msgstr "🌈"
#: failmap_admin/map/static/js/failmap.js:189
msgid "H"
msgstr "🌈"
#: failmap_admin/map/static/js/failmap.js:190
msgid "M"
msgstr "🌈"
#: failmap_admin/map/static/js/failmap.js:191
msgid "L"
msgstr "🌈"
#: failmap_admin/map/static/js/failmap.js:210
msgid "Good"
msgstr "🌈"
#: failmap_admin/map/static/js/failmap.js:211
msgid "Mediocre"
msgstr "🌈"
#: failmap_admin/map/static/js/failmap.js:212
msgid "Bad"
msgstr "🌈"
#: failmap_admin/map/static/js/failmap.js:213
msgid "Unknown"
msgstr "🌈"
#: failmap_admin/map/static/js/graphs.js:102
msgid "low"
msgstr "🌈"
#: failmap_admin/map/static/js/graphs.js:104
msgid "medium"
msgstr "🌈"
#: failmap_admin/map/static/js/graphs.js:106
msgid "high"
msgstr "🌈"
#: failmap_admin/map/static/js/script.js:11
msgid "2 weeks ago"
msgstr "🌈"
#: failmap_admin/map/static/js/script.js:12
msgid "3 weeks ago"
msgstr "🌈"
#: failmap_admin/map/static/js/script.js:13
msgid "1 month ago"
msgstr "🌈"
#: failmap_admin/map/static/js/script.js:14
msgid "2 months ago"
msgstr "🌈"
#: failmap_admin/map/static/js/script.js:15
msgid "3 months ago"
msgstr "🌈"
#: failmap_admin/map/static/js/script.js:16
msgid "7 days ago"
msgstr "🌈"
#: failmap_admin/map/static/js/script.js:17
msgid "now"
msgstr "🌈"
#: failmap_admin/map/static/js/views.js:44
msgid "week"
msgstr "🌈"
#: failmap_admin/map/static/js/views.js:211
msgid "score perfect"
msgstr "🌈"
#: failmap_admin/map/static/js/views.js:213
msgid "score high"
msgstr "🌈"
#: failmap_admin/map/static/js/views.js:215
msgid "score medium"
msgstr "🌈"
#: failmap_admin/map/static/js/views.js:217
msgid "score low"
msgstr "🌈"
#: failmap_admin/map/static/js/views.js:411
msgid "Exit Full Screen"
msgstr "🌈"
#: failmap_admin/map/static/js/views.js:442
#: failmap_admin/map/static/js/views.js:447
msgid "top congratulations"
msgstr "🌈"
#: failmap_admin/map/static/js/views.js:443
#: failmap_admin/map/static/js/views.js:448
msgid "top position"
msgstr "🌈"
#: failmap_admin/map/static/js/views.js:444
msgid "top fail on failmap"
msgstr "🌈"
#: failmap_admin/map/static/js/views.js:445
#: failmap_admin/map/static/js/views.js:450
msgid "hastag fail"
msgstr "🌈"
#: failmap_admin/map/static/js/views.js:445
#: failmap_admin/map/static/js/views.js:450
msgid "hastag failmap"
msgstr "🌈"
#: failmap_admin/map/static/js/views.js:449
msgid "top win on failmap"
msgstr "🌈"
......@@ -2,6 +2,7 @@
# This tries to help you avoid remembering the "messages" mess from Django.
import logging
from django.conf import settings
from django.core.management import call_command
from django.core.management.base import BaseCommand
......@@ -11,26 +12,38 @@ logger = logging.getLogger(__package__)
class Command(BaseCommand):
help = "Automatically updates any explicitly maintained translations. Helps you on your way."
# replaces django-admin makemessages -a with explicitly maintained translations.
# You should not have to remember these commands: they are a burden.
"""
# Replaces django-admin makemessages -a with explicitly maintained translation commands.
# You should not have to remember those commands: they are a burden.
# This command automatically updates any explicitly maintained translation for you.
# Annoyingly, the django config uses language codes, see:
# Just use this command twice: first to create the translations, secondly to compile them.
# In any case it does both, first makemessages and then compilmessages.
# Languages are defined in settings.
# Django uses language codes inconstently, in this project we always use two letter language codes until
# something better comes along.
# https://docs.djangoproject.com/en/1.11/topics/i18n/#term-language-code
# and this should use locales, according to the documentation, which is confusing.
# Django should use one approach, preferably ditch their own invention of language codes
# and just go for locales of some ISO list.
# Django's translation is a terrible mess to begin with. Perhaps we should move to vue trans.
# and just go for locales centrally defined, such as a list from ISO.
"""
def handle(self, *args, **options):
# try and find new strings for all languages
call_command('makemessages', '-a')
# django-admin compilemessages
call_command('makemessages', '-l', 'nl')
call_command('makemessages', '-l', 'en')
call_command('compilemessages', '-l', 'nl')
call_command('compilemessages', '-l', 'en')
logger.debug('You can find the locale files in ./locale/--/LC_MESSAGES/django.po')
logger.debug('Compiled files are located in ./locale/--/LC_MESSAGES/django.mo')
logger.debug('Run this command again to have your updates compiled.')
for language in settings.LANGUAGES:
# -d djangojs =
# https://docs.djangoproject.com/en/2.0/topics/i18n/translation/#creating-message-files-from-js-code
call_command('makemessages', '-d', 'djangojs', '-l', language[0])
call_command('compilemessages', '-l', language[0])
logger.info('You can find the locale files in ./locale/(language code)/LC_MESSAGES/django(js).po')
logger.info('Compiled files are located in ./locale/(language code)/LC_MESSAGES/django(js).mo')
logger.info('')
logger.info('Run this command again to have your changes compiled.')
logger.info('Remember to keep the amount of translations in javascript as low as possible.')
......@@ -65,7 +65,7 @@ var failmap = {
console.log('entered fullscreen');
} else {
vueFullScreenReport.hide();
vueFullscreen.fullscreen = "View Full Screen" // ugly fix :)
vueFullscreen.fullscreen = gettext("View Full Screen") // ugly fix :)
}
});
......@@ -112,7 +112,7 @@ var failmap = {
add_searchbar: function () {
this.searchbar.onAdd = function (map) {
this._div = L.DomUtil.create('div', 'info');
this._div.innerHTML = "<input id='searchbar' type='text' onkeyup='failmap.search(this.value)' placeholder=\"Zoek op gemeente...\"/>";
this._div.innerHTML = "<input id='searchbar' type='text' onkeyup='failmap.search(this.value)' placeholder=\"" + gettext('Search organization') + "\"/>";
L.DomEvent.disableClickPropagation(this._div);
return this._div;
};
......@@ -133,13 +133,13 @@ var failmap = {
if (props) {
sometext += "<h4>" + props.organization_name + "</h4>";
if (props.high || props.medium || props.low) {
sometext += '<b>High: </b><span style="color: ' + failmap.getColor(1000) + '">' + props.high + '</span><br />';
sometext += '<b>Medium: </b><span style="color: ' + failmap.getColor(500) + '">' + props.medium + '</span><br />';
sometext += '<b>Low: </b><span style="color: ' + failmap.getColor(0) + '">' + props.low + '</span><br />';
sometext += '<b>' + gettext('High') + ': </b><span style="color: ' + failmap.getColor(1000) + '">' + props.high + '</span><br />';
sometext += '<b>' + gettext('Medium') + ': </b><span style="color: ' + failmap.getColor(500) + '">' + props.medium + '</span><br />';
sometext += '<b>' + gettext('Low') + ': </b><span style="color: ' + failmap.getColor(0) + '">' + props.low + '</span><br />';
} else {
sometext += '<b>High: </b><span style="color: ' + failmap.getColor(1000) + '">0</span><br />';
sometext += '<b>Medium: </b><span style="color: ' + failmap.getColor(500) + '">0</span><br />';
sometext += '<b>Low: </b><span style="color: ' + failmap.getColor(0) + '">0</span><br />';
sometext += '<b>' + gettext('High') + ': </b><span style="color: ' + failmap.getColor(1000) + '">0</span><br />';
sometext += '<b>' + gettext('Medium') + ': </b><span style="color: ' + failmap.getColor(500) + '">0</span><br />';
sometext += '<b>' + gettext('Low') + ': </b><span style="color: ' + failmap.getColor(0) + '">0</span><br />';
}
vueDomainlist.load(props.organization_id, vueMap.week);
this._div.innerHTML = sometext;
......@@ -167,7 +167,7 @@ var failmap = {
this._div = L.DomUtil.create('div', 'info');
L.DomEvent.disableClickPropagation(this._div);
dataslider_control = " <div id=\"historycontrol\">" +
" <h4>{{ visibleweek }}<span v-if='loading'> (loading...)</span></h4>" +
" <h4>{{ visibleweek }}<span v-if='loading'> (' + gettext('Loading') + '...)</span></h4>" +
" <input id='history' type='range' v-on:change='show_week' :value='week' min='0' max='52' step='1' :disabled='loading'/>" +
" <input id='previous_week' type='button' v-on:click='previous_week()' :disabled='loading' value='&lt;&lt;&lt;'/>" +
" <input id='next_week' type='button' v-on:click='next_week()' :disabled='loading' value='&gt;&gt;&gt;'/>" +
......@@ -185,7 +185,10 @@ var failmap = {
L.DomEvent.disableClickPropagation(this._div);
this._div.innerHTML = "<div id=\"domainlist\" v-if=\"urls\">\n" +
"<table width='100%'><thead>" +
"<tr><th>Url</th><th width='5%'>H</th><th width='5%'>M</th><th width='5%'>L</th></tr></thead>" +
"<tr><th>" + gettext('Url') + "</th>" +
"<th width='5%'>" + gettext('H') + "</th>" +
"<th width='5%'>" + gettext('M') + "</th>" +
"<th width='5%'>" + gettext('L') + "</th></tr></thead>" +
"<tr v-for=\"url in urls\">\n" +
"<td><span v-bind:class=\"colorize(url.high, url.medium, url.low)\">{{ url.url }}</span></td>" +
"<td><span v-bind:class=\"colorize(url.high, url.medium, url.low)\">{{ url.high }}</span></td>" +
......@@ -204,10 +207,10 @@ var failmap = {
var div = L.DomUtil.create('div', 'info legend'), labels = [];
labels.push('<i style="background:' + failmap.getColor(199) + '"></i> Good');
labels.push('<i style="background:' + failmap.getColor(999) + '"></i> Average');
labels.push('<i style="background:' + failmap.getColor(1000) + '"></i> Bad');
labels.push('<i style="background:' + failmap.getColor(-1) + '"></i> Unknown');
labels.push('<i style="background:' + failmap.getColor(199) + '"></i> '+ gettext('Good'));
labels.push('<i style="background:' + failmap.getColor(999) + '"></i> '+ gettext('Mediocre'));
labels.push('<i style="background:' + failmap.getColor(1000) + '"></i> '+ gettext('Bad'));
labels.push('<i style="background:' + failmap.getColor(-1) + '"></i> '+ gettext('Unknown'));
div.innerHTML = labels.join('<br>');
return div;
......
......@@ -97,6 +97,15 @@ function d3stats() {
.style("font", "10px sans-serif")
.style("text-anchor", "end")
.text(function (d) {
// the switch is explicit for gettext translations
if (d.key === "low")
return gettext("low");
if (d.key === "medium")
return gettext("medium");
if (d.key === "high")
return gettext("high");
// and for any other cases we don't know yet.
return d.key;
});
......
......@@ -5,6 +5,18 @@ if (sentry_token) {
Raven.config(sentry_token, {release: version}).install();
}
// https://stackoverflow.com/questions/7625991/
// how-to-properly-add-entries-for-computed-values-to-the-django-internationalizati
var dynamic_translations = function(){
gettext('2 weeks ago');
gettext('3 weeks ago');
gettext('1 month ago');
gettext('2 months ago');
gettext('3 months ago');
gettext('7 days ago');
gettext('now');
};
$(document).ready(function () {
failmap.initializemap("nl");
views();
......@@ -18,4 +30,5 @@ $(document).ready(function () {
location.href = '#report';
vueReport.selected = organization_id;
}
});
......@@ -41,7 +41,7 @@ Date.prototype.getWeek = function () {
// support for an intuitive timestamp
// translation?
Date.prototype.humanTimeStamp = function () {
return this.getFullYear() + " Week " + this.getWeek();
return this.