Server: Plural translations don't seem to work

Created on 13 Apr 2020  路  12Comments  路  Source: nextcloud/server

Steps to reproduce

  1. Inside the server, set the language to a translation, for example, Spanish Argentina
  2. Find some plural translations. For example the summary of the current folder.
  3. Just check if the plural works.

Expected behaviour

In summary expect:

6 carpetas y 5 archivos 8,5 GB

Actual behaviour

In summary i see:

6 carpeta y 5 archivo 8,5 GB

imagen
:disappointed:

Note that the translation is programmed correctly:

https://github.com/nextcloud/server/blob/2b913de41706aae531d476d80f64c4fd2fd91b92/apps/files/js/filesummary.js#L223-L226

..and also is translated.

https://github.com/nextcloud/server/blob/df463f90be01be2d38f6cdd5b2b1a20900696b54/apps/files/l10n/es_AR.js#L61-L62

But use the singular, with the number greater than 1.

Server configuration detail

Operating system: Linux 5.5.10-200.fc31.x86_64 #1 SMP Wed Mar 18 14:21:38 UTC 2020 x86_64

Webserver: Apache/2.4.43 (Fedora) OpenSSL/1.1.1d (fpm-fcgi)

Database: mysql 10.3.22

PHP version:

7.3.16
Modules loaded: Core, date, libxml, openssl, pcre, zlib, filter, hash, Reflection, SPL, session, standard, cgi-fcgi, bz2, calendar, ctype, curl, dom, mbstring, fileinfo, ftp, gd, gettext, iconv, imap, intl, json, ldap, exif, mysqlnd, PDO, Phar, posix, shmop, SimpleXML, sockets, sqlite3, sysvmsg, sysvsem, sysvshm, tokenizer, xml, xmlwriter, xsl, mcrypt, mysqli, pdo_mysql, pdo_sqlite, wddx, xmlreader, apcu, igbinary, imagick, msgpack, pcov, pdlib, smbclient, zip, redis, libsmbclient, Zend OPcache

Nextcloud version: 18.0.2 - 18.0.2.2

Updated from an older Nextcloud/ownCloud or fresh install:

Where did you install Nextcloud from:

Signing status

List of activated apps


Configuration (config/config.php)


Are you using external storage, if yes which one:

Are you using encryption:

Are you using an external user-backend, if yes which one:

Client configuration

Browser: Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:74.0) Gecko/20100101 Firefox/74.0

Operating system:

Logs

Web server error log

Insert your web server log here 

Nextcloud log

Insert your Nextcloud log here

Browser log

Insert your browser log here, this could for example include:

a) The javascript console log
b) The network log
c) ...

1. to develop bug language l10n and translations good first issue

All 12 comments

Good finding :+1:

image

It seems to work with es.

image

That seems to be the issue. The function assumes that the language is es_AR but es-AR is passed. I'm not sure why the language is es-AR or where this value is coming from ;)

cc @gary-kim @nextcloud/javascript

We updatet the lang list recently iirc?
Maybe before they made sure to convert everything to _ and not - ?
Or the other way around :p
Anyway, simple fix I guess?

image

It's correct over there :man_shrugging:

https://github.com/nextcloud/server/commit/e5be2991019f1a6716d253596562f8ab0f4df008 That's the commit / code changing es_AR to es-AR. It's like that since Nextcloud 14 so changing the _getPlural function should do it.

Well, I guess is difficult to discuss about translations to Transifex, but seem that they use underscores to separate counties from translations, which seems wrong. I don't know what would be the right thing ..

@skjnldsv There was a reason why it is - instead of _ but I can't find it right now. For the transformation it might also help to just specify it here: https://github.com/nextcloud/server/blob/master/.tx/config#L3 ?

@skjnldsv There was a reason why it is - instead of _ but I can't find it right now. For the transformation it might also help to just specify it here: https://github.com/nextcloud/server/blob/master/.tx/config#L3 ?

Keep in mind that this then needs to be updated in every single app out there. So fixing the JS part to look for the transifex version of the string might be the easier solution.

And do the fix within the tool translationtool.phar? I think we all use this to apply translations.

EDIT: This would fix only the underscore, but I guess the problem goes further. For example, in my applications, I don't have translated es-AR, however when configuring es-AR it shows es. Which is correct, but the plural translation is still wrong.

I'm confused now. Are we still talking about the same thing?

https://github.com/nextcloud/server/pull/8217 changed es_AR to es-AR. The reason is that https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/lang expects the language tag as defined at https://www.ietf.org/rfc/bcp/bcp47.txt.

What needs to done is to check the usages of OC.getLanguage() and other places using the lang attribute and make sure the code expects - instead of _. Fixing _getPlural might be a start.

In Lithuanian plurals also do not work even though strings in Transifex are translated...

Thank you very much @kesselb

Was this page helpful?
0 / 5 - 0 ratings