Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open room view failed when starting cinny on linux with env LANG=C.UTF-8 #216

Closed
lindsayzhou opened this issue Oct 24, 2023 · 1 comment
Closed

Comments

@lindsayzhou
Copy link

Describe the bug

My LANG environment variable value is C.UTF-8 (It's the default value for alpine linux).

When I start cinny and enter room view, nothing is displayed on the page.
There is a Uncaught RangeError: invalid language tag: "C" error log in the console.

Reproduction

For Desktop:

  1. Use the command env LANG=C.UTF-8 cinny to open cinny
  2. Log in to a account and enter room view.

For WebUI (FireFox):

  1. Open about:config, change the intl.accept_languages value to C
  2. Log in to a account and enter room view.

Expected behavior

No response

Platform and versions

1. OS: Alpine linux edge
2. Cinny version: v3.0.0
3. Matrix homeserver: envs.net
4. Downloaded from: Compiled by myself

Additional context

It's work for me to set the empty locates array.

diff --git a/src/app/organisms/room/MembersDrawer.tsx b/src/app/organisms/room/MembersDrawer.tsx
index 365dc62..76d5a13 100644
--- a/src/app/organisms/room/MembersDrawer.tsx
+++ b/src/app/organisms/room/MembersDrawer.tsx
@@ -265,13 +265,19 @@ export function MembersDrawer({ room }: MembersDrawerProps) {
     openProfileViewer(userId, room.roomId);
   };

+  let locales;
+  try {
+    locales = Intl.getCanonicalLocales(Array.from(navigator.languages));
+  } catch (e) {
+    locales = [];
+  }
   return (
     <Box className={css.MembersDrawer} direction="Column">
       <Header className={css.MembersDrawerHeader} variant="Background" size="600">
         <Box grow="Yes" alignItems="Center" gap="200">
           <Box grow="Yes" alignItems="Center" gap="200">
             <Text size="H5" truncate>
-              {`${millify(room.getJoinedMemberCount(), { precision: 1 })} Members`}
+              {`${millify(room.getJoinedMemberCount(), { precision: 1, locales: locales })} Members`}
             </Text>
           </Box>
           <Box shrink="No" alignItems="Center">
@kfiven
Copy link
Collaborator

kfiven commented Oct 28, 2023

Fixed in cinnyapp/cinny#1504 and now live in v3.1.0

@kfiven kfiven closed this as completed Oct 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants