diff options
author | Morris Jobke <hey@morrisjobke.de> | 2017-08-09 13:41:10 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-09 13:41:10 +0200 |
commit | 576f370ddc19d280bb04e12180253318deea09e7 (patch) | |
tree | d84faf31ecfd3205af99c6e654054fb297684904 /lib | |
parent | 395325d5c5c5330becca08abe7417e6c5fdb0884 (diff) | |
parent | ed3b391e4799bf1b4a4c2f990020f1069d46d3ac (diff) | |
download | nextcloud-server-576f370ddc19d280bb04e12180253318deea09e7.tar.gz nextcloud-server-576f370ddc19d280bb04e12180253318deea09e7.zip |
Merge pull request #6009 from nextcloud/symfony_translations
Use symfony/translation for L10N plurals
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/L10N/L10N.php | 7 | ||||
-rw-r--r-- | lib/public/L10N/IFactory.php | 9 |
2 files changed, 6 insertions, 10 deletions
diff --git a/lib/private/L10N/L10N.php b/lib/private/L10N/L10N.php index b933048982f..620c99dd1ec 100644 --- a/lib/private/L10N/L10N.php +++ b/lib/private/L10N/L10N.php @@ -25,6 +25,7 @@ namespace OC\L10N; use OCP\IL10N; use OCP\L10N\IFactory; use Punic\Calendar; +use Symfony\Component\Translation\PluralizationRules; class L10N implements IL10N { @@ -191,8 +192,12 @@ class L10N implements IL10N { */ public function getPluralFormFunction() { if (is_null($this->pluralFormFunction)) { - $this->pluralFormFunction = $this->factory->createPluralFunction($this->pluralFormString); + $lang = $this->getLanguageCode(); + $this->pluralFormFunction = function($n) use ($lang) { + return PluralizationRules::get($n, $lang); + }; } + return $this->pluralFormFunction; } diff --git a/lib/public/L10N/IFactory.php b/lib/public/L10N/IFactory.php index b5f93c2389c..9820082c72e 100644 --- a/lib/public/L10N/IFactory.php +++ b/lib/public/L10N/IFactory.php @@ -60,13 +60,4 @@ interface IFactory { * @since 9.0.0 */ public function languageExists($app, $lang); - - /** - * Creates a function from the plural string - * - * @param string $string - * @return string Unique function name - * @since 9.0.0 - */ - public function createPluralFunction($string); } |