Added translations and cleaned the code a bit.

This commit is contained in:
Tim Schumacher 2015-02-03 21:16:12 +01:00
parent 066fe35e8e
commit 25eddef379
3 changed files with 27 additions and 23 deletions

17
lang/de/lang.php Normal file
View file

@ -0,0 +1,17 @@
<?php
/**
* English language file for whoisinyourhackspace plugin
*
* @author Tim Schumacher <tim@datenknoten.me>
*/
// menu entry for admin plugins
$lang['wiyh_heading'] = 'Raumstatus';
$lang['wiyh_open'] = 'ist besetzt.';
$lang['wiyh_closed'] = 'ist geschlossen.';
$lang['wiyh_stats'] = 'Raumöffnungsstatistiken';
//Setup VIM: ex: et ts=4 :

View file

@ -2,14 +2,14 @@
/** /**
* English language file for whoisinyourhackspace plugin * English language file for whoisinyourhackspace plugin
* *
* @author Tim Schumacher <tim.daniel.schumacher@gmail.com> * @author Tim Schumacher <tim@datenknoten.me>
*/ */
// menu entry for admin plugins // menu entry for admin plugins
// $lang['menu'] = 'Your menu entry'; $lang['wiyh_heading'] = 'State';
$lang['wiyh_open'] = 'is open.';
// custom language strings for the plugin $lang['wiyh_closed'] = 'is closed.';
// $lang['fixme'] = 'FIXME'; $lang['wiyh_stats'] = 'Stats';

View file

@ -44,16 +44,7 @@ class syntax_plugin_whoisinyourhackspace extends DokuWiki_Syntax_Plugin {
public function connectTo($mode) { public function connectTo($mode) {
$this->Lexer->addSpecialPattern('<wiyh[^>]*>',$mode,'plugin_whoisinyourhackspace'); $this->Lexer->addSpecialPattern('\[wiyh\]',$mode,'plugin_whoisinyourhackspace');
}
public function handle($match, $state, $pos, &$handler){
$return = array(
'ample' => true
);
$this->_checkOption($match, "/-ample/i", $return['ample'], true);
return $return;
} }
public function render($mode, &$renderer, $data) { public function render($mode, &$renderer, $data) {
@ -69,23 +60,19 @@ class syntax_plugin_whoisinyourhackspace extends DokuWiki_Syntax_Plugin {
$content = ''; $content = '';
$content .= '<div class="hackerspace-room-state">'; $content .= '<div class="hackerspace-room-state">';
$content .= '<h3>Raumstatus</h3>'; $content .= "<h3>" . $this->getLang('wiyh_heading') . "</h3>";
//$content .= '<dl><dt>Status</dt>';
if ($api->state->open) { if ($api->state->open) {
//$content .= '<dd>Offen</dd>';
$content .= "<img class=\"icon\" src=\"{$api->state->icon->open}\" alt=\"{$api->space} ist besetzt.\" title=\"{$api->space} ist besetzt.\" />"; $content .= "<img class=\"icon\" src=\"{$api->state->icon->open}\" alt=\"{$api->space} ist besetzt.\" title=\"{$api->space} ist besetzt.\" />";
$content .= "<p class=\"text\">{$api->space} ist besetzt.</p>"; $content .= "<p class=\"text\">{$api->space} " . $this->getLang('wiyh_open') . "</p>";
//$renderer->doc .= sprintf('<p class="ample available">%s ist besetzt :).</p>',$api->space);
} else { } else {
//$renderer->doc .= sprintf('<p class="ample not-available">%s ist nicht besetzt :(.</p>',$api->space);
$content .= "<img class=\"icon\" src=\"{$api->state->icon->closed}\" alt=\"{$api->space} ist geschlossen.\" title=\"{$api->space} ist geschlossen.\" />"; $content .= "<img class=\"icon\" src=\"{$api->state->icon->closed}\" alt=\"{$api->space} ist geschlossen.\" title=\"{$api->space} ist geschlossen.\" />";
$content .= "<p class=\"text\">{$api->space} ist geschlossen.</p>"; $content .= "<p class=\"text\">{$api->space} " . $this->getLang('wiyh_closed') . "</p>";
} }
$content .= '<hr />'; $content .= '<hr />';
$content .= sprintf('<p><a href="http://spacestatus.bastinat0r.de/#%s">Raum-Öffnungs-Statistiken</a></p>',strtolower($api->space)); $content .= sprintf('<p><a href="http://spaceapi-stats.n39.eu/#%s">'.$this->getLang('wiyh_stats').'</a></p>',strtolower($api->space));
$content .= '</div>'; $content .= '</div>';
$renderer->doc .= $content; $renderer->doc .= $content;