Merge pull request #14867 from nextcloud/backport/14628/stable15

[stable15] Fix plural rule detection for languages
This commit is contained in:
Roeland Jago Douma 2019-03-28 08:52:53 +01:00 committed by GitHub
commit f4cc549e86
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -167,18 +167,18 @@ OC.L10N = {
* @private
*/
_getPlural: function(number) {
var locale = OC.getLocale();
if ('pt_BR' === locale) {
var language = OC.getLanguage();
if ('pt_BR' === language) {
// temporary set a locale for brazilian
locale = 'xbr';
language = 'xbr';
}
if (typeof locale === 'undefined') {
if (typeof language === 'undefined' || language === '') {
return (1 == number) ? 0 : 1;
}
if (locale.length > 3) {
locale = locale.substring(0, locale.lastIndexOf('_'));
if (language.length > 3) {
language = language.substring(0, language.lastIndexOf('_'));
}
/*
@ -186,7 +186,7 @@ OC.L10N = {
* which is subject to the new BSD license (http://framework.zend.com/license/new-bsd).
* Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
*/
switch (locale) {
switch (language) {
case 'az':
case 'bo':
case 'dz':