Skip to content

Conversation

@ShGKme
Copy link
Contributor

@ShGKme ShGKme commented Feb 14, 2025

☑️ Resolves

  • @nextcloud/moment:
    • uses unmaintained moment
    • uses old @nextcloud/l10n v2
    • isn't really needed in modern Chromium

@ShGKme ShGKme self-assigned this Feb 14, 2025
@ShGKme ShGKme force-pushed the chore/remove-moment branch from d864a61 to faea871 Compare February 15, 2025 07:51
@ShGKme ShGKme requested a review from Antreesy February 15, 2025 07:52
@ShGKme ShGKme marked this pull request as ready for review February 15, 2025 07:52
@ShGKme ShGKme marked this pull request as draft February 15, 2025 08:31
Signed-off-by: Grigorii K. Shartsev <[email protected]>
@ShGKme ShGKme force-pushed the chore/remove-moment branch from faea871 to b4b61ae Compare February 15, 2025 11:21
@ShGKme ShGKme marked this pull request as ready for review February 15, 2025 12:08
Signed-off-by: Grigorii K. Shartsev <[email protected]>
@ShGKme ShGKme force-pushed the chore/remove-moment branch from b4b61ae to 1046165 Compare February 15, 2025 13:18
Copy link
Contributor

@Antreesy Antreesy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated to changes comment. Otherwise works fine

import type { ClearAtPredefinedConfig, PredefinedUserStatus, UserStatus, UserStatusStatusType } from './userStatus.types.ts'
import moment from '@nextcloud/moment'
import { translate as t } from '@nextcloud/l10n'
import { t, getFirstDay } from '@nextcloud/l10n'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screenshot from appData.userMetadata, this results in empty <html data-locale > (when was not set on personal settings). Maybe it should defaults to selected language; here to 'de'?

image

also custom window.firstDay from settings is not provided as in web, and always leads to default locale value:

  • 'en' - Sunday
  • 'de' - Monday

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also custom window.firstDay from settings is not provided as in web

Yes, this info is not available for clients, so, using locale data

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screenshot from appData.userMetadata, this results in empty <html data-locale > (when was not set on personal settings). Maybe it should defaults to selected language; here to 'de'?

I cannot reproduce this state... Even for new accounts it's en initially. How do you unset it?

Anyway, Nextcloud defaults it to 'en' in @nextcloud/l10n, so should be fixed there. But I'd fallback for the local device settings, not the language.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

occ user:setting <userid> --delete core locale. Then in web it defaults to core.lang

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ShGKme ShGKme merged commit c082eb0 into main Feb 15, 2025
10 checks passed
@ShGKme ShGKme deleted the chore/remove-moment branch February 15, 2025 21:49
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

import { getCanonicalLocale } from '@nextcloud/l10n'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Late-thought opinion: getLanguage should be used for relative time (not absolute, that required locale format):

With 'en' language and 'de' locale we are geting human-readable represenation, but language of it won't match expected system:

Locale \ Lang 'en' 'de'
'en' 1:23 PM, 'in 1 day' 🟢 13:23, 'in 1 day'
'de' 1:23 PM, 'in 1 Tag' 13:23, 'in 1 Tag' 🟢

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, and this is an old discussion about using locale for durations.

Here it works the same way it works on the server.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants