facerecognition
facerecognition copied to clipboard
Locale, estimated time left in locale rather than language
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:

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
- Set locale to Swedish (or anything other than English)
- 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.
Wow @flindeberg I will see it soon.. Thanks for the research!. 😬