Author: Jan Schneider (jan@horde.org)
Inheritance: extends Horde_Translation_Autodetect
 public function formatUsage($usage)
 {
     return sprintf(Horde_Argv_Translation::t("Usage:") . " %s\n", $usage);
 }
Example #2
0
 public function formatOptionHelp($formatter = null)
 {
     if (is_null($formatter)) {
         $formatter = $this->formatter;
     }
     $formatter->storeOptionStrings($this);
     $result = array();
     $result[] = $formatter->formatHeading(Horde_Argv_Translation::t("Options"));
     $formatter->indent();
     if ($this->optionList) {
         $result[] = parent::formatOptionHelp($formatter);
         $result[] = "\n";
     }
     foreach ($this->optionGroups as $group) {
         $result[] = $group->formatHelp($formatter);
         $result[] = "\n";
     }
     $formatter->dedent();
     // Drop the last "\n", or the header if no options or option groups:
     array_pop($result);
     return implode('', $result);
 }
Example #3
0
 /**
  * Returns the plural translation of a message.
  *
  * @param string $singular  The singular version to translate.
  * @param string $plural    The plural version to translate.
  * @param integer $number   The number that determines singular vs. plural.
  *
  * @return string  The string translation, or the original string if no
  *                 translation exists.
  */
 public static function ngettext($singular, $plural, $number)
 {
     self::$_domain = 'Horde_Argv';
     self::$_directory = '@data_dir@' == '@' . 'data_dir' . '@' ? __DIR__ . '/../../../locale' : '@data_dir@/Horde_Argv/locale';
     return parent::ngettext($singular, $plural, $number);
 }
Example #4
0
 public function formatUsage($usage)
 {
     return sprintf("%s  %s\n", $this->formatHeading(Horde_Argv_Translation::t("Usage")), $usage);
 }
Example #5
0
 public function checkChoice($opt, $value)
 {
     if (in_array($value, $this->choices)) {
         return $value;
     } else {
         $choices = array();
         foreach ($this->choices as $choice) {
             $choices[] = (string) $choice;
         }
         $choices = "'" . implode("', '", $choices) . "'";
         throw new Horde_Argv_OptionValueException(sprintf(Horde_Argv_Translation::t("option %s: invalid choice: '%s' (choose from %s)"), $opt, $value, $choices));
     }
 }