Skip to content

Commit

Permalink
Merge branch 'master' into feature/setup-wizard-7163
Browse files Browse the repository at this point in the history
  • Loading branch information
Johannes Meyer committed Sep 29, 2014
2 parents e9e4ef0 + ab8436d commit 513d5e3
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 4 deletions.
17 changes: 15 additions & 2 deletions library/Icinga/Util/Translator.php
Expand Up @@ -43,7 +43,11 @@ class Translator
public static function translate($text, $domain, $context = null)
{
if ($context !== null) {
return self::pgettext($text, $domain, $context);
$res = self::pgettext($text, $domain, $context);
if ($res === $text && $domain !== self::DEFAULT_DOMAIN) {
$res = self::pgettext($text, self::DEFAULT_DOMAIN, $context);
}
return $res;
}

$res = dgettext($domain, $text);
Expand All @@ -56,6 +60,8 @@ public static function translate($text, $domain, $context = null)
/**
* Translate a plural string
*
* Falls back to the default domain in case the string cannot be translated using the given domain
*
* @param string $textSingular The string in singular form to translate
* @param string $textPlural The string in plural form to translate
* @param integer $number The number to get the plural or singular string
Expand All @@ -67,10 +73,17 @@ public static function translate($text, $domain, $context = null)
public static function translatePlural($textSingular, $textPlural, $number, $domain, $context = null)
{
if ($context !== null) {
return self::pngettext($textSingular, $textPlural, $number, $domain, $context);
$res = self::pngettext($textSingular, $textPlural, $number, $domain, $context);
if (($res === $textSingular || $res === $textPlural) && $domain !== self::DEFAULT_DOMAIN) {
$res = self::pngettext($textSingular, $textPlural, $number, self::DEFAULT_DOMAIN, $context);
}
return $res;
}

$res = dngettext($domain, $textSingular, $textPlural, $number);
if (($res === $textSingular || $res === $textPlural) && $domain !== self::DEFAULT_DOMAIN) {
$res = dngettext(self::DEFAULT_DOMAIN, $textSingular, $textPlural, $number);
}
return $res;
}

Expand Down
15 changes: 13 additions & 2 deletions library/Icinga/Web/Form/Element/Note.php
Expand Up @@ -4,13 +4,24 @@

namespace Icinga\Web\Form\Element;

use Zend_Form_Element_Xhtml;
use Zend_Form_Element;

/**
* Implements note element for Zend forms
*/
class Note extends Zend_Form_Element_Xhtml
class Note extends Zend_Form_Element
{
/**
* Disable default decorators
*
* \Icinga\Web\Form sets default decorators for elements.
*
* @var bool
*
* @see \Icinga\Web\Form::__construct() For default element decorators.
*/
protected $_disableLoadDefaultDecorators = true;

/**
* Name of the view helper
*
Expand Down

0 comments on commit 513d5e3

Please sign in to comment.