Commit 0247fdff authored by Taddeüs Kroes's avatar Taddeüs Kroes

Added Dutch translations

parent 98e9c747
......@@ -7,5 +7,4 @@ www/js/
www/css/
config.local.json
config.mk
*.po
locale/messages.mo
*.mo
......@@ -53,8 +53,9 @@ $(CACHE_DIR):
# Gettext translations
SRC_FILES := $(wildcard *.php) $(wildcard routes/*.php)
#XXX: $(shell find templates -name \*.latte)
SRC_FILES := $(wildcard *.php) $(wildcard routes/*.php) \
$(shell find templates -name \*.latte)
#$(wildcard $(CACHE_DIR)/latte/*.php)
translations: $(patsubst %,$(LOCALE_DIR)/%/LC_MESSAGES/$(GETTEXT_DOMAIN).mo,$(LOCALES))
......@@ -64,7 +65,7 @@ translations: $(patsubst %,$(LOCALE_DIR)/%/LC_MESSAGES/$(GETTEXT_DOMAIN).mo,$(LO
.PRECIOUS: $(LOCALE_DIR)/%/LC_MESSAGES/$(GETTEXT_DOMAIN).po
$(LOCALE_DIR)/%/LC_MESSAGES/$(GETTEXT_DOMAIN).po: $(SRC_FILES)
@if [ ! -e $@ ]; then mkdir -p $(@D); touch $@; fi
xgettext -j -n -o $@ $^
xgettext -L php --omit-header --join-existing -o $@ $^
# Cleanup
......
......@@ -5,12 +5,22 @@ require 'util.php';
require 'DatabaseAuthenticator.php';
/*
* Set locale based on browser language specification
* Set locale based on browser language specification, and set up gettext
*/
$supported_locales = array('nl_NL'); // English is default, Dutch is optional
if ($locale = locale_accept_from_http($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
putenv("LANG=$locale");
setlocale(LC_ALL, $locale);
// nl -> nl_NL
if (locale_get_region($locale) == '')
$locale .= '_' . strtoupper($locale);
if (in_array($locale, $supported_locales)) {
putenv("LANG=$locale");
putenv("LC_ALL=$locale");
putenv("LC_MESSAGES=$locale");
setlocale(LC_ALL, $locale);
}
}
$domain = 'archery';
......@@ -36,8 +46,13 @@ $view = new Slim\Latte\LatteView(array(
'path' => __DIR__ . '/templates',
'cache' => __DIR__ . '/.cache/latte',
'configure_engine' => function ($engine) {
$engine->addFilter('translate', function($s) {
return gettext($s);
});
$engine->onCompile[] = function ($latte) {
Instante\Bootstrap3Renderer\Latte\FormMacros::install($latte->getCompiler());
$compiler = $latte->getCompiler();
Instante\Bootstrap3Renderer\Latte\FormMacros::install($compiler);
};
}
));
......
msgid ""
msgstr ""
"Project-Id-Version: 0.1\n"
"POT-Creation-Date: 2014-10-09 13:24+0200\n"
"Last-Translator: Taddeus Kroes\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: routes/common.php:15 routes/register.php:18
msgid "Username"
msgstr "Gebruikersnaam"
#: routes/common.php:17 routes/register.php:24
msgid "Password"
msgstr "Wachtwoord"
#: routes/common.php:20 templates/layout.latte:3
msgid "Login"
msgstr "Inloggen"
#: routes/match.php:34
msgid "Match does not exist"
msgstr "Score bestaat niet"
#: routes/match.php:37
msgid "You are not allowed to view this match"
msgstr "Onvoldoende permissies"
#: routes/match.php:77 routes/match.php:105
msgid "Distance"
msgstr "Afstand"
#: routes/match.php:78
msgid "Select a distance"
msgstr "Selecteer een afstand"
#: routes/match.php:79
msgid "Tag"
msgstr "Tag"
#: routes/match.php:80
msgid "Select a tag"
msgstr "Selecteer een tag"
#: routes/match.php:81
msgid "Name"
msgstr "Naam"
#: routes/match.php:82
msgid "Filter"
msgstr "Filteren"
#: routes/match.php:99
msgid "Date"
msgstr "Datum"
#: routes/match.php:102
msgid "YYYY-MM-DD HH:MM"
msgstr ""
#: routes/match.php:103
msgid "Invalid date"
msgstr "Ongeldige datum"
#: routes/match.php:106
msgid "Distance in meters"
msgstr "Afstand in meters"
#: routes/match.php:109
msgid "Discipline"
msgstr "Discipline"
#: routes/match.php:112
msgid "Arrows"
msgstr "Pijlen"
#: routes/match.php:118
msgid "Turns"
msgstr "Beurten"
#: routes/match.php:123
msgid "Notes"
msgstr "Opmerkingen"
#: routes/match.php:124
msgid "Create"
msgstr "Opslaan"
#: routes/register.php:22
msgid "Username may not contain whitespace or special characters"
msgstr "Gebruikersnaam mag geen spaties of speciale tekens bevatten"
#: routes/register.php:23
msgid "This username has already been taken"
msgstr "Deze gebruikersnaam is al in gebruik"
#: routes/register.php:26
msgid "Confirm password"
msgstr "Bevestig wachtwoord"
#: routes/register.php:29
msgid "Passwords must match"
msgstr "Wachtwoorden moeten gelijk zijn"
#: routes/register.php:30 templates/layout.latte:4 templates/login.latte:13
msgid "Register"
msgstr "Registreren"
#: routes/common.php:19
msgid "Remember me"
msgstr "Onthoud mij"
#: templates/layout.latte:2
msgid "Matches"
msgstr "Scores"
#: templates/layout.latte:3
msgid "Logout"
msgstr "Uitloggen"
#: templates/match/create.latte:4
msgid "Add new match"
msgstr "Nieuwe score"
#: templates/match/create.latte:9
msgid "Tags"
msgstr "Tags"
#: templates/match/create.latte:28
msgid "Cancel"
msgstr "Annuleren"
msgid "Add tag"
msgstr "Tag toevoegen"
msgid "Yes, I'm sure"
msgstr "Ja, ik weet het zeker"
msgid "Click to remove tag"
msgstr "Klik om tag te verwijderen"
msgid "Clear filters"
msgstr "Filters wissen"
msgid "Points"
msgstr "Punten"
msgid "Subtotal"
msgstr "Subtotaal"
msgid "Total"
msgstr "Totaal"
msgid "Average"
msgstr "Gemiddeld"
msgid "Click here to make a note"
msgstr "Klik hier om te bewerken"
msgid "Edit metadata"
msgstr "Eigenschappen"
msgid "Edit scores"
msgstr "Punten bewerken"
msgid "Delete"
msgstr "Verwijderen"
msgid "Scores"
msgstr "Punten"
......@@ -12,12 +12,12 @@ function login_form() {
$form->setRenderer(new BootstrapRenderer);
$form->setAction('login');
$form->addText('username', 'Username')
$form->addText('username', _('Username'))
->setRequired();
$form->addPassword('password', 'Password')
$form->addPassword('password', _('Password'))
->setRequired();
//$form->addCheckbox('remember', 'Remember me');
$form->addSubmit('send', 'Login');
//$form->addCheckbox('remember', _('Remember me'));
$form->addSubmit('send', _('Login'));
return $form;
}
......
......@@ -31,10 +31,10 @@ function find_match($id) {
$match = $db->table('match')->get($id);
if (!$match)
$app->halt(404, 'Match does not exist');
$app->halt(404, _('Match does not exist'));
if ($match->user_id != $user->getId() && !$user->hasRole('admin'))
$app->halt(403, 'You are not allowed to view this match');
$app->halt(403, _('You are not allowed to view this match'));
return $match;
}
......@@ -74,12 +74,12 @@ function filter_form($matches) {
asort($distances);
$distances = map_format('%d meters', $distances);
$form->addSelect('distance', 'Distance', $distances)
->setPrompt('Select a distance');
$form->addSelect('tag', 'Tag', $tags)
->setPrompt('Select a tag');
$form->addText('name', 'Name');
$form->addSubmit('send', 'Filter');
$form->addSelect('distance', _('Distance'), $distances)
->setPrompt(_('Select a distance'));
$form->addSelect('tag', _('Tag'), $tags)
->setPrompt(_('Select a tag'));
$form->addText('name', _('Name'));
$form->addSubmit('send', _('Filter'));
return $form;
}
......@@ -94,34 +94,34 @@ function create_form() {
$form->setRenderer(new BootstrapRenderer);
$form->setAction('match');
$form->addText('name', 'Name')
$form->addText('name', _('Name'))
->setRequired();
$form->addText('created_at', 'Date')
$form->addText('created_at', _('Date'))
->setType('datetime-local')
->setDefaultValue(strftime('%Y-%m-%dT%H:%M'))
->setAttribute('placeholder', 'YYYY-MM-DD HH:MM')
->addRule(Form::PATTERN, 'Invalid date', '\d{4}-\d{1,2}-\d{1,2}[T ]\d{1,2}:\d{1,2}')
->setAttribute('placeholder', _('YYYY-MM-DD HH:MM'))
->addRule(Form::PATTERN, _('Invalid date'), '\d{4}-\d{1,2}-\d{1,2}[T ]\d{1,2}:\d{1,2}')
->setRequired();
$form->addText('distance', 'Distance')
->setAttribute('placeholder', 'distance in meters')
$form->addText('distance', _('Distance'))
->setAttribute('placeholder', _('Distance in meters'))
->setType('number')
->setRequired();
$form->addRadioList('discipline', 'Discipline', $disciplines)
$form->addRadioList('discipline', _('Discipline'), $disciplines)
->setAttribute('data-inline', true)
->setRequired();
$form->addText('arrows', 'Arrows')
$form->addText('arrows', _('Arrows'))
->setType('range')
->setAttribute('min', 1)
->setAttribute('max', 10)
->setDefaultValue(3)
->setRequired();
$form->addText('turns', 'Turns')
$form->addText('turns', _('Turns'))
->setType('number')
->setAttribute('min', 1)
->setDefaultValue(10)
->setRequired();
$form->addTextarea('notes', 'Notes');
$form->addSubmit('send', 'Create');
$form->addTextarea('notes', _('Notes'));
$form->addSubmit('send', _('Create'));
// Set attributes from last match as default, since the shooter is likely
// to repeat the previous training in many cases
......
......@@ -15,19 +15,19 @@ function registration_form() {
$form->setRenderer(new BootstrapRenderer);
$form->setAction('register');
$form->addText('username', 'Username')
$form->addText('username', _('Username'))
->setRequired()
->addRule(Form::MIN_LENGTH, null, 3)
->addRule(Form::MAX_LENGTH, null, 100)
->addRule(Form::PATTERN, 'Username may not contain whitespace or special characters', '([a-zA-Z0-9-_])+')
->addRule('validate_unique_user', 'This username has already been taken');
$form->addPassword('password', 'Password')
->addRule(Form::PATTERN, _('Username may not contain whitespace or special characters'), '([a-zA-Z0-9-_])+')
->addRule('validate_unique_user', _('This username has already been taken'));
$form->addPassword('password', _('Password'))
->setRequired();
$form->addPassword('password_repeat', 'Confirm password')
$form->addPassword('password_repeat', _('Confirm password'))
->setRequired()
->addConditionOn($form['password'], Form::FILLED)
->addRule(Form::EQUAL, 'Passwords must match', $form['password']);
$form->addSubmit('send', 'Register');
->addRule(Form::EQUAL, _('Passwords must match'), $form['password']);
$form->addSubmit('send', _('Register'));
return $form;
}
......
{var $menu = [
$user->isLoggedIn() ? ['matches', 'Matches'],
$user->isLoggedIn() ? ['logout', 'Logout'] : ['login', 'Login'],
!$user->isLoggedIn() ? ['register', 'Register'],
$user->isLoggedIn() ? ['matches', _('Matches')],
$user->isLoggedIn() ? ['logout', _('Logout')] : ['login', _('Login')],
!$user->isLoggedIn() ? ['register', _('Register')],
]}
<!doctype html>
<html lang="en">
......
......@@ -2,14 +2,15 @@
{block content}
<div class="row">
<div class="col-sm-8 col-md-6">
<div class="col-md-9">
{form $form}
{form errors}
{form controls}
<div class="form-group">
<div class="form-actions col-sm-offset-2 col-sm-10">
<button type="submit" name="send" class="btn btn-primary">Login</button>
<a href="register" class="btn">Register</a>
<button type="submit" name="send" class="btn
btn-primary">{_'Login'}</button>
<a href="register" class="btn">{_'Register'}</a>
</div>
</div>
{/form}
......
{extends '../layout.latte'}
{block content}
<h2 class="page-header">Add new match</h2>
<h2 class="page-header">{_'Add new match'}</h2>
{form $form}
{form errors}
{form controls}
<div class="form-group">
<label class="control-label col-sm-2" for="frm-tags">Tags</label>
<label class="control-label col-sm-2" for="frm-tags">{_'Tags'}</label>
<div class="form-actions col-sm-10 tags-control">
<div class="input-group">
<input type="text" id="frm-tags" class="form-control" placeholder="Add tag">
<input type="text" id="frm-tags" class="form-control"
placeholder="{_'Add tag'}">
<span class="input-group-btn">
<a class="btn btn-default" title="Add tag">
<a class="btn btn-default" title="{_'Add tag'}">
<span class="glyphicon glyphicon-plus"></span>
</a>
</span>
......@@ -22,13 +23,13 @@
<div class="form-group">
<div class="form-actions col-sm-offset-2 col-sm-10">
<div class="btn-group actions">
<a href="matches" class="btn btn-default" title="Cancel">
<a href="matches" class="btn btn-default" title="{_'Cancel'}>
<span class="glyphicon glyphicon-remove"></span>
<span class="text">Cancel</span>
<span class="text">{_'Cancel'}</span>
</a>
<button type="submit" name="send" class="btn btn-primary" title="Save">
<button type="submit" name="send" class="btn btn-primary" title="{_'Save'}>
<span class="glyphicon glyphicon-save"></span>
<span class="text">Save</span>
<span class="text">{_'Save'}</span>
</button>
</div>
</div>
......
......@@ -11,13 +11,13 @@
<form action="match/{$match->id}" method="post">
<div class="btn-group actions">
<a href="match/{$match->id}" class="btn btn-default" title="cancel">
<a href="match/{$match->id}" class="btn btn-default" title="{_'Cancel'}">
<span class="glyphicon glyphicon-remove"></span>
<span class="text">Cancel</span>
<span class="text">{_'Cancel'}</span>
</a>
<button type="submit" class="btn btn-primary">
<span class="glyphicon glyphicon-ok"></span>
<span class="text">Yes, I'm sure</span>
<span class="text">{_"Yes, I'm sure"}</span>
</button>
</div>
<input type="hidden" name="_METHOD" value="DELETE"/>
......
......@@ -8,19 +8,19 @@
{form errors}
{form controls}
<div class="form-group">
<label class="control-label col-sm-2" for="frm-tags">Tags</label>
<label class="control-label col-sm-2" for="frm-tags">{_'Tags'}</label>
<div class="form-actions col-sm-10 tags-control">
<div class="input-group">
<input type="text" id="frm-tags" class="form-control" placeholder="Add tag">
<input type="text" id="frm-tags" class="form-control" placeholder="{_'Add tag'}">
<span class="input-group-btn">
<a class="btn btn-default" title="Add tag">
<a class="btn btn-default" title="{_'Add tag'}">
<span class="glyphicon glyphicon-plus"></span>
</a>
</span>
</div>
<div class="tags">
<a n:foreach="$tags as $tag" href="javascript:void(0)"
class="tag" title="Click to remove tag">
class="tag" title="{_'Click to remove tag'}">
<span class="label label-default">
<span class="text">{$tag->name}</span>
<span class="glyphicon glyphicon-remove"></span>
......@@ -33,9 +33,9 @@
<div class="form-group">
<div class="form-actions col-sm-offset-2 col-sm-10">
<div class="btn-group actions">
<button type="submit" name="send" class="btn btn-primary" title="Save">
<button type="submit" name="send" class="btn btn-primary" title="{_'Save'}">
<span class="glyphicon glyphicon-ok"></span>
<span class="text">Save</span>
<span class="text">{_'Save'}</span>
</button>
</div>
</div>
......
......@@ -4,10 +4,10 @@
<h2 class="page-header">
Matches
<div class="btn-group">
<a href="match" class="btn btn-sm btn-default" title="Add new match">
<a href="match" class="btn btn-sm btn-default" title="{_'Add new match'}">
<span class="glyphicon glyphicon-plus"></span>
</a>
<a data-toggle="collapse" href="#filter" title="Filter"
<a data-toggle="collapse" href="#filter" title="{_'Filter'}"
class="btn btn-sm btn-default">
<span class="glyphicon glyphicon-filter"></span>
</a>
......@@ -20,8 +20,8 @@
{form controls}
<div class="form-group">
<div class="form-actions col-sm-offset-2 col-sm-10">
<button type="submit" name="send" class="btn btn-primary">Filter</button>
<a href="matches" class="btn btn-default">Clear filters</a>
<button type="submit" name="send" class="btn btn-primary">{_'Filter'}</button>
<a href="matches" class="btn btn-default">{_'Clear filters'}</a>
</div>
</div>
{/form}
......@@ -31,12 +31,12 @@
<table id="results" class="table table-hover matches">
<thead>
<tr>
<th>Name</th>
<th>Date</th>
<th class="hidden-xs-pt">Distance</th>
<th class="hidden-xs-pt">Discipline</th>
<th class="hidden-xs-pt">Arrows</th>
<th>Score</th>
<th>{_'Name'}</th>
<th>{_'Date'}</th>
<th class="hidden-xs-pt">{_'Distance'}</th>
<th class="hidden-xs-pt">{_'Discipline'}</th>
<th class="hidden-xs-pt">{_'Arrows'}</th>
<th>{_'Score'}</th>
</tr>
</thead>
<tbody>
......@@ -54,9 +54,9 @@
<tr n:if="!$matches->count()">
<td colspan="5">
{if $filter_form->isSubmitted()}
No search results.
{_'No search results.'}
{else}
You have not saved any matches yet.
{_'You have not saved any matches yet.'}
{/if}
</td>
</tr>
......
......@@ -22,8 +22,8 @@
<thead>
<tr>
<th class="separator"></th>
<th class="separator" colspan="{$match->arrows}">Points</th>
<th colspan="2">Subtotal</th>
<th class="separator" colspan="{$match->arrows}">{_'Points'}</th>
<th colspan="2">{_'Subtotal'}</th>
</tr>
</thead>
<tbody>
......@@ -40,7 +40,10 @@
</tbody>
<tbody>
<tr>
<th colspan="{$match->arrows + 2}">Total:<br>Average:</th>
<th colspan="{$match->arrows + 2}">
{_'Total'}:<br>
{_'Average'}:
</th>
<td>
<span class="match-total">{$total}</span><br>
<span class="match-avg" title="{$total / ($match->turns * $match->arrows)|number:4}">
......@@ -53,18 +56,18 @@
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Notes</h3>
<h3 class="panel-title">{_'Notes'}</h3>
</div>
<div class="panel-body">
<textarea name="notes" wrap="hard" placeholder="Click here to make a note"
<textarea name="notes" wrap="hard" placeholder="{_'Click here to make a note'}"
>{$match->notes}</textarea>
</div>
</div>
<div class="actions">
<button type="submit" class="btn btn-primary" title="Save">
<button type="submit" class="btn btn-primary" title="{_'Save'}">
<span class="glyphicon glyphicon-ok"></span>
<span class="text">Save</span>
<span class="text">{_'Save'}</span>
</button>
</div>
......
......@@ -13,7 +13,7 @@
{$match->created_at|date:'%A %e %B %Y %H:%m'}
</p>
<p n:if="$tags->count()" class="tags">
<strong>Tags:</strong>
<strong>{_'Tags'}:</strong>
<a n:foreach="$tags as $tag" href="matches?tag={$tag->name}" class="tag">
<span class="label label-primary">{$tag->name}</span>
</a>
......@@ -26,7 +26,7 @@
{*
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Scores</h3>
<h3 class="panel-title">{_'Scores'}</h3>
</div>
*}
......@@ -34,8 +34,8 @@
<thead>
<tr>
<th class="separator"></th>
<th class="separator" colspan="{$match->arrows}">Points</th>
<th colspan="2">Subtotal</th>
<th class="separator" colspan="{$match->arrows}">{_'Points'}</th>
<th colspan="2">{_'Subtotal'}</th>
</tr>
</thead>
<tbody>
......@@ -51,7 +51,10 @@
</tbody>
<tbody>
<tr>
<th colspan="{$match->arrows + 2}">Total:<br>Average:</th>
<th colspan="{$match->arrows + 2}">
{_'Total'}:<br>
{_'Average'}:
</th>
<td>
{$total}<br>
<abbr title="{$total / ($match->turns * $match->arrows)|number:4}">
......@@ -66,23 +69,23 @@
<div n:if="$match->notes" class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Notes</h3>
<h3 class="panel-title">{_'Notes</h3>
</div>
<div class="panel-body">{htmlentities($match->notes, ENT_QUOTES)|noescape|nl2br}</div>
</div>
<div class="btn-group actions">
<a href="match/{$match->id}/edit" class="btn btn-default" title="Edit metadata">
<a href="match/{$match->id}/edit" class="btn btn-default" title="{_'Edit metadata'}">
<span class="glyphicon glyphicon-cog"></span>
<span class="text">Edit metadata</span>
<span class="text">{_'Edit metadata'}</span>
</a>
<a href="match/{$match->id}/scores" class="btn btn-default" title="Edit scores">
<a href="match/{$match->id}/scores" class="btn btn-default" title="{_'Edit scores'}">
<span class="glyphicon glyphicon-pencil"></span>
<span class="text">Edit scores</span>
<span class="text">{_'Edit scores'}</span>
</a>
<a href="match/{$match->id}/delete" class="btn btn-danger" title="Delete">
<a href="match/{$match->id}/delete" class="btn btn-danger" title="{_'Delete'}">
<span class="glyphicon glyphicon-trash"></span>
<span class="text">Delete</span>
<span class="text">{_'Delete'}</span>
</a>
</div>
......
......@@ -2,7 +2,7 @@
{block content}
<div class="row">
<div class="col-sm-8 col-md-6">
<div class="col-md-9">
{$form}
</div>
</div>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment