facerecognition icon indicating copy to clipboard operation
facerecognition copied to clipboard

Locale, estimated time left in locale rather than language

Open flindeberg opened this issue 3 years ago • 1 comments

Expected behaviour

I would expect a line along the lines of "Ends approximately in 4 days" with consistent language (English in this case).

Actual behaviour

I got a line which says "Ends approximately om 4 dagar". See screenshot below:

Screenshot 2021-09-24 at 14 00 28

Via CLI I get a correct string, see;

> sudo -u www-data php occ face:progress
+--------+-----------+-----------+
| Images | Remaining | ETA       |
+--------+-----------+-----------+
| 18044  | 14831     | in 4 days |
+--------+-----------+-----------+

The issue is the "om 4 dagar", which is "in 4 days" in Swedish.

I think this issue might be quite deep given my 5 minute overview of the code, and that Nextcloud fundamentally confuses language and locale settings by calling them language and locale, instead of, for example, language and date-and-time-format. This issue is further extended by the weird use of locale in moment.js (see https://momentjs.com/docs/#/durations/locale/). Since facerecognition is hardcoded English perhaps the following would be a half decent solution:

var mom = moment(estimatedFinalizeDate)
mom.locale('en')
// Old code to build up desc
desc += t('facerecognition', 'Ends approximately {estimatedFinalize}', {estimatedFinalize: mom.fromNow()});

instead of

https://github.com/matiasdelellis/facerecognition/blob/7179af3100782884b3d467825e7a0334c19aff2a/js/admin.js#L30

Steps to reproduce

  1. Set locale to Swedish (or anything other than English)
  2. Go to the Face Recognition admin settings.

Server configuration

  • Nextcloud version: 21.0.4

Client configuration

Does not seem to matter, tested Firefox / Safari / Chrome on Linux and macOS.

Logs

I cannot find anything relevant in the logs.

flindeberg avatar Sep 24 '21 12:09 flindeberg

Wow @flindeberg I will see it soon.. Thanks for the research!. 😬

matiasdelellis avatar Nov 02 '21 13:11 matiasdelellis