/**
* ownCloud
*
+ * @author Frank Karlitschek
* @author Jakob Sack
* @copyright 2012 Frank Karlitschek frank@owncloud.org
+ * @copyright 2013 Jakob Sack
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
/**
* get an L10N instance
+ * @param $app string
+ * @param $lang string|null
* @return OC_L10N
*/
public static function get($app, $lang=null) {
/**
* @brief The constructor
- * @param $app the app requesting l10n
- * @param $lang default: null Language
+ * @param $app string app requesting l10n
+ * @param $lang string default: null Language
* @returns OC_L10N-Object
*
* If language is not set, the constructor tries to find the right
/**
* @brief Creates a function that The constructor
- * @param $app the app requesting l10n
- * @param $lang default: null Language
- * @returns OC_L10N-Object
*
* If language is not set, the constructor tries to find the right
* language.
*
* Parts of the code is copied from Habari:
* https://github.com/habari/system/blob/master/classes/locale.php
+ * @param $string string
+ * @return string
*/
protected function createPluralFormFunction($string){
if(preg_match( '/^\s*nplurals\s*=\s*(\d+)\s*;\s*plural=(.*)$/u', $string, $matches)) {
'nplurals='. $nplurals . '; plural=' . $plural
);
- // add parens
+ // add parents
// important since PHP's ternary evaluates from left to right
$body .= ';';
$res = '';
/**
* @brief getPluralFormString
- * @returns Fetches the gettext "Plural-Forms"-string
+ * @returns string containing the gettext "Plural-Forms"-string
*
* Returns a string like "nplurals=2; plural=(n != 1);"
*/
/**
* @brief getPluralFormFunction
- * @returns returns the plural form function
+ * @returns string the plural form function
*
* returned function accepts the argument $n
*/
public function getPluralFormFunction() {
$this->init();
if(is_null($this->plural_form_function)) {
- $this->plural_form_function = createPluralFormFunction($this->plural_form_string);
+ $this->plural_form_function = $this->createPluralFormFunction($this->plural_form_string);
}
return $this->plural_form_function;
}
case 'date':
case 'datetime':
case 'time':
- if($data instanceof DateTime) return $data->format($this->localizations[$type]);
- elseif(is_string($data)) $data = strtotime($data);
+ if($data instanceof DateTime) {
+ return $data->format($this->localizations[$type]);
+ }
+ elseif(is_string($data)) {
+ $data = strtotime($data);
+ }
$locales = array(self::findLanguage());
if (strlen($locales[0]) == 2) {
$locales[] = $locales[0].'_'.strtoupper($locales[0]);