summaryrefslogtreecommitdiffstats
path: root/lib/private
diff options
context:
space:
mode:
authorLukas Reschke <lukas@owncloud.com>2015-03-26 20:15:33 +0100
committerLukas Reschke <lukas@owncloud.com>2015-03-26 20:15:33 +0100
commit74a9fc29b43b54ec8aa9f6b9cac1cbfa4a5136e2 (patch)
tree9489220921b93420730b13a9dd7c23a1d0e6ec29 /lib/private
parentc8c722bc6de3a58e10ba42a55a178d3ba9308bae (diff)
parentae60108692a2c34b0ab474e7d9fa35bb8b689992 (diff)
downloadnextcloud-server-74a9fc29b43b54ec8aa9f6b9cac1cbfa4a5136e2.tar.gz
nextcloud-server-74a9fc29b43b54ec8aa9f6b9cac1cbfa4a5136e2.zip
Merge pull request #14399 from owncloud/ignore-empty-plurals
Ignore empty plurals just like with singulars
Diffstat (limited to 'lib/private')
-rw-r--r--lib/private/l10n.php2
-rw-r--r--lib/private/l10n/string.php22
2 files changed, 3 insertions, 21 deletions
diff --git a/lib/private/l10n.php b/lib/private/l10n.php
index b16a0468e23..95b80bebdb2 100644
--- a/lib/private/l10n.php
+++ b/lib/private/l10n.php
@@ -305,7 +305,7 @@ class OC_L10N implements \OCP\IL10N {
$this->init();
$identifier = "_${text_singular}_::_${text_plural}_";
if( array_key_exists($identifier, $this->translations)) {
- return new OC_L10N_String($this, $identifier, $parameters, $count, array($text_singular, $text_plural));
+ return new OC_L10N_String( $this, $identifier, $parameters, $count );
}else{
if($count === 1) {
return new OC_L10N_String($this, $text_singular, $parameters, $count);
diff --git a/lib/private/l10n/string.php b/lib/private/l10n/string.php
index 21fe765618b..6167a6737dc 100644
--- a/lib/private/l10n/string.php
+++ b/lib/private/l10n/string.php
@@ -41,11 +41,6 @@ class OC_L10N_String{
protected $parameters;
/**
- * @var array
- */
- protected $plurals;
-
- /**
* @var integer
*/
protected $count;
@@ -53,12 +48,11 @@ class OC_L10N_String{
/**
* @param OC_L10N $l10n
*/
- public function __construct($l10n, $text, $parameters, $count = 1, $plurals = array()) {
+ public function __construct($l10n, $text, $parameters, $count = 1) {
$this->l10n = $l10n;
$this->text = $text;
$this->parameters = $parameters;
$this->count = $count;
- $this->plurals = $plurals;
}
public function __toString() {
@@ -69,19 +63,7 @@ class OC_L10N_String{
if(is_array($translations[$this->text])) {
$fn = $this->l10n->getPluralFormFunction();
$id = $fn($this->count);
-
- if ($translations[$this->text][$id] !== '') {
- // The translation of this plural case is not empty, so use it
- $text = $translations[$this->text][$id];
- } else {
- // We didn't find the plural in the language,
- // so we fall back to english.
- $id = ($id != 0) ? 1 : 0;
- if (isset($this->plurals[$id])) {
- // Fallback to the english plural
- $text = $this->plurals[$id];
- }
- }
+ $text = $translations[$this->text][$id];
}
else{
$text = $translations[$this->text];