ubuntu / app-center

App Store for Ubuntu made with Flutter 🧡 💙
GNU General Public License v3.0
659 stars 116 forks source link

Missing locale causes `DateFormat` to throw an exception #1659

Open Snubletunge opened 6 months ago

Snubletunge commented 6 months ago

When I choose an app in the Ubuntu App Center, it won't show details about the app, or the information images just flash for a moment.

(snap-store:17779): WARNING : 18:43:14.817: atk-bridge: get_device_events_reply: unknown signature flutter: Another exception was thrown: Instance of 'DiagnosticsProperty'

I have tried to reinstall Ubuntu, but the issue persist.

System Details Report


Report details

Hardware Information:

Software Information:

d-loose commented 6 months ago

Thanks for the report - could you provide the log files from $HOME/snap/snap-store/current/.local/share/snap-store and the output of glxinfo -B to help diagnose possible rendering issues?

Feichtmeier commented 6 months ago

This looks like the error widget in release mode :) (a widget that flutter draws when something went wrong) Could you start snap-store from the terminal and provide any errors / outputs / exceptions here?

Snubletunge commented 6 months ago

Here is the error message when running the snap from terminal:

Gtk-Message: 19:02:17.408: Not loading module "atk-bridge": The functionality is provided by GTK natively. Please try to not load it. flutter: INFO snap-store: Logging to /home/chello/snap/snap-store/1134/.local/share/snap-store/snap-store.log flutter: INFO appstream: Unsupported locale: nn. Defaulting to "en".

(snap-store:3529): WARNING : 19:02:42.600: atk-bridge: get_device_events_reply: unknown signature

@d-loose $HOME /snap/snap-store/current/.local/share/snap-store$ glxinfo -b Command 'glxinfo' not found, but can be installed with: sudo apt install mesa-utils

snap-store.log (Copy).txt

Snubletunge commented 6 months ago

And another when I start snap-store from Terminal, and select an app from the main page (Transmission) to view in the store:

$ snap run snap-store
Gtk-Message: 19:33:49.940: Not loading module "atk-bridge": The functionality is provided by GTK natively. Please try to not load it.
flutter: INFO snap-store: Logging to /home/chello/snap/snap-store/1134/.local/share/snap-store/snap-store.log
flutter: INFO appstream: Unsupported locale: nn. Defaulting to "en".
flutter: Invalid argument(s): Invalid locale "nn"
flutter: #0      _throwLocaleError (package:intl/src/intl_helpers.dart:204)
flutter: #1      verifiedLocale (package:intl/src/intl_helpers.dart:198)
flutter: #2      verifiedLocale (package:intl/src/intl_helpers.dart:183)
flutter: #3      new DateFormat (package:intl/src/intl/date_format.dart:267)
flutter: #4      new DateFormat.yMMMd (package:intl/src/intl/date_format.dart:470)
flutter: #5      _SnapView.build (package:app_center/src/snapd/snap_page.dart:129)
flutter: #6      _ConsumerState.build (package:flutter_riverpod/src/consumer.dart:476)
flutter: #7      StatefulElement.build (package:flutter/src/widgets/framework.dart:5592)
flutter: #8      ConsumerStatefulElement.build (package:flutter_riverpod/src/consumer.dart:539)
flutter: #9      ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:5480)
flutter: #10     StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:5643)
flutter: #11     Element.rebuild (package:flutter/src/widgets/framework.dart:5196)
flutter: #12     ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:5462)
flutter: #13     StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:5634)
flutter: #14     ComponentElement.mount (package:flutter/src/widgets/framework.dart:5456)
flutter: #15     Element.inflateWidget (package:flutter/src/widgets/framework.dart:4335)
flutter: #16     Element.updateChild (package:flutter/src/widgets/framework.dart:3846)
flutter: #17     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:5505)
flutter: #18     Element.rebuild (package:flutter/src/widgets/framework.dart:5196)
flutter: #19     ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:5462)
flutter: #20     ComponentElement.mount (package:flutter/src/widgets/framework.dart:5456)
flutter: #21     Element.inflateWidget (package:flutter/src/widgets/framework.dart:4335)
flutter: #22     Element.updateChild (package:flutter/src/widgets/framework.dart:3846)
flutter: #23     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:5505)
flutter: #24     Element.rebuild (package:flutter/src/widgets/framework.dart:5196)
flutter: #25     ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:5462)
flutter: #26     ComponentElement.mount (package:flutter/src/widgets/framework.dart:5456)
flutter: #27     Element.inflateWidget (package:flutter/src/widgets/framework.dart:4335)
flutter: #28     Element.updateChild (package:flutter/src/widgets/framework.dart:3846)
flutter: #29     _LayoutBuilderElement._layout.layoutCallback (package:flutter/src/widgets/layout_builder.dart:155)
flutter: #30     BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2844)
flutter: #31     _LayoutBuilderElement._layout (package:flutter/src/widgets/layout_builder.dart:173)
flutter: #32     RenderObject.invokeLayoutCallback.<anonymous closure> (package:flutter/src/rendering/object.dart:2686)
flutter: #33     PipelineOwner._enableMutationsToDirtySubtrees (package:flutter/src/rendering/object.dart:1097)
flutter: #34     RenderObject.invokeLayoutCallback (package:flutter/src/rendering/object.dart:2686)
flutter: #35     RenderConstrainedLayoutBuilder.rebuildIfNecessary (package:flutter/src/widgets/layout_builder.dart:248)
flutter: #36     _RenderLayoutBuilder.performLayout (package:flutter/src/widgets/layout_builder.dart:331)
flutter: #37     RenderObject.layout (package:flutter/src/rendering/object.dart:2575)
flutter: #38     RenderBox.layout (package:flutter/src/rendering/box.dart:2389)
flutter: #39     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105)
flutter: #40     RenderObject._layoutWithoutResize (package:flutter/src/rendering/object.dart:2414)
flutter: #41     PipelineOwner.flushLayout (package:flutter/src/rendering/object.dart:1051)
flutter: #42     PipelineOwner.flushLayout (package:flutter/src/rendering/object.dart:1064)
flutter: #43     RendererBinding.drawFrame (package:flutter/src/rendering/binding.dart:582)
flutter: #44     WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:991)
flutter: #45     RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:448)
flutter: #46     SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1386)
flutter: #47     SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1311)
flutter: #48     SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:1169)
flutter: #49     _invoke (dart:ui/hooks.dart:312)
flutter: #50     PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart:399)
flutter: #51     _drawFrame (dart:ui/hooks.dart:283)
Snubletunge commented 6 months ago

OK, so the locale nn (Norwegian nynorsk) that I am using, is crashing this, changed to the locale nb (Norwegian bokmål) and the store works as it should.

Still seems something is off when I run it from Terminal:

$ snap run snap-store Gtk-Message: 19:46:14.151: Not loading module "atk-bridge": The functionality is provided by GTK natively. Please try to not load it. flutter: INFO snap-store: Logging to /home/chello/snap/snap-store/1134/.local/share/snap-store/snap-store.log flutter: INFO appstream: Unsupported locale: nb_NO. Defaulting to "en".

(snap-store:5753): WARNING : 19:46:39.348: atk-bridge: get_device_events_reply: unknown signature

d-loose commented 6 months ago

Thanks for providing those additional details. The issue seems to be that, even though the proper localization delegates for nn_NO and others are provided by ubuntu_localizations, they're only available if the corresponding locale is listed in the supportedLocales for the MaterialApp. With our current setup that requires the existence of the respective .arb file. I'm adding nn_NO through weblate to see if that solves the problem for this specific locale. I'll keep this issue open though, since we should find a proper solution for all cases.

mguinhos commented 5 months ago

Also having this problem.

d-loose commented 5 months ago

Also having this problem.

Which locale are you using? Are you seeing a similar error message when running snap-store from the terminal?

mguinhos commented 2 months ago

@d-loose

flutter: INFO appstream: Unsupported locale: und. Defaulting to "en".

(snap-store:14198): Gdk-CRITICAL **: 15:11:19.710: gdk_device_get_source: assertion 'GDK_IS_DEVICE (device)' failed
flutter: Invalid argument(s): Invalid locale "und"
flutter: #0      _throwLocaleError (package:intl/src/intl_helpers.dart:208)
flutter: #1      verifiedLocale (package:intl/src/intl_helpers.dart:202)
flutter: #2      verifiedLocale (package:intl/src/intl_helpers.dart:182)
flutter: #3      new DateFormat (package:intl/src/intl/date_format.dart:267)
flutter: #4      new DateFormat.yMMMd (package:intl/src/intl/date_format.dart:548)

its saying my locale is und.

d-loose commented 2 months ago

its saying my locale is und.

That means the locale is 'undetermined', so either the flutter framework has problems parsing your locale, or there's already something broken in your system setup. In either case, we should handle this case properly.

Could you post the output of

locale

as well?

mguinhos commented 2 months ago

Sure,

$ locale
LANG=pt_BR.UTF-8
LANGUAGE=pt_BR:
LC_CTYPE="pt_BR.UTF-8"
LC_NUMERIC="pt_BR.UTF-8"
LC_TIME="pt_BR.UTF-8"
LC_COLLATE="pt_BR.UTF-8"
LC_MONETARY="pt_BR.UTF-8"
LC_MESSAGES="pt_BR.UTF-8"
LC_PAPER="pt_BR.UTF-8"
LC_NAME="pt_BR.UTF-8"
LC_ADDRESS="pt_BR.UTF-8"
LC_TELEPHONE="pt_BR.UTF-8"
LC_MEASUREMENT="pt_BR.UTF-8"
LC_IDENTIFICATION="pt_BR.UTF-8"
LC_ALL=
mguinhos commented 2 months ago

@d-loose

d-loose commented 2 months ago

Seems like Flutter doesn't parse LANGUAGE=pt_BR: correctly. The resulting locale is 'und' in this case. Both pt_BR and pt_BR:pt work correctly though.

@robert-ancell I suppose this happens at the level of the engine - do you know more?

robert-ancell commented 1 month ago

We used g_get_language_names in the engine instead of writing our own parser with the hope this would do the right thing... However it seems to make both duplicate and empty locales; parsing LANGUAGE=pt_BR: returns "pt_BR", "pt", "", "C". I suspect the empty string is confusing Flutter and making the "und" locale.

robert-ancell commented 1 month ago

Sigh, and LANGUAGE="pt_BR: :" also returns " " and "".

robert-ancell commented 1 month ago

See https://github.com/flutter/engine/pull/55091, this should hopefully improve things.

d-loose commented 1 month ago

Great, thanks a lot for digging into this!