Add URL::to_language and HTML::link_to_language localization helpers

Signed-off-by: Anahkiasen <ehtnam6@gmail.com>
This commit is contained in:
Anahkiasen
2012-10-26 22:32:52 +01:00
parent 205cc4869d
commit 89e3bf1fbd
5 changed files with 84 additions and 4 deletions

View File

@@ -238,6 +238,19 @@ class HTML {
return static::link(URL::to_action($action, $parameters), $title, $attributes);
}
/**
* Generate an HTML link to a different language
*
* @param string $language
* @param string $title
* @param array $attributes
* @return string
*/
public static function link_to_language($language, $title = null, $attributes = array())
{
return static::link(URL::to_language($language), $title, $attributes);
}
/**
* Generate an HTML mailto link.
*
@@ -347,7 +360,7 @@ class HTML {
return '<'.$type.static::attributes($attributes).'>'.$html.'</'.$type.'>';
}
/**
* Generate a definition list.
*
@@ -360,13 +373,13 @@ class HTML {
$html = '';
if (count($list) == 0) return $html;
foreach ($list as $term => $description)
{
$html .= '<dt>'.static::entities($term).'</dt>';
$html .= '<dd>'.static::entities($description).'</dd>';
}
return '<dl'.static::attributes($attributes).'>'.$html.'</dl>';
}