Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 0 additions & 51 deletions .github/workflows/translations-force-pull.yml

This file was deleted.

55 changes: 0 additions & 55 deletions .github/workflows/translations-pull.yml

This file was deleted.

97 changes: 0 additions & 97 deletions .github/workflows/translations-upload.yml

This file was deleted.

64 changes: 1 addition & 63 deletions apps/remix/app/components/general/app-command-menu.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
import { useDebouncedValue } from '@documenso/lib/client-only/hooks/use-debounced-value';
import { useSession } from '@documenso/lib/client-only/providers/session';
import { SUPPORTED_LANGUAGES } from '@documenso/lib/constants/i18n';
import {
DOCUMENTS_PAGE_SHORTCUT,
SETTINGS_PAGE_SHORTCUT,
TEMPLATES_PAGE_SHORTCUT,
} from '@documenso/lib/constants/keyboard-shortcuts';
import { DO_NOT_INVALIDATE_QUERY_ON_MUTATION, SKIP_QUERY_BATCH_META } from '@documenso/lib/constants/trpc';
import { dynamicActivate } from '@documenso/lib/utils/i18n';
import { isPersonalLayout } from '@documenso/lib/utils/organisations';
import { trpc as trpcReact } from '@documenso/trpc/react';
import { cn } from '@documenso/ui/lib/utils';
import {
CommandDialog,
CommandEmpty,
Expand All @@ -20,13 +17,12 @@ import {
CommandList,
CommandShortcut,
} from '@documenso/ui/primitives/command';
import { useToast } from '@documenso/ui/primitives/use-toast';
import type { MessageDescriptor } from '@lingui/core';
import { msg } from '@lingui/core/macro';
import { useLingui } from '@lingui/react';
import { Trans } from '@lingui/react/macro';
import { keepPreviousData } from '@tanstack/react-query';
import { CheckIcon, Loader, Monitor, Moon, Sun } from 'lucide-react';
import { Loader, Monitor, Moon, Sun } from 'lucide-react';
import { useCallback, useMemo, useState } from 'react';
import { useHotkeys } from 'react-hotkeys-hook';
import { useNavigate } from 'react-router';
Expand Down Expand Up @@ -256,9 +252,6 @@ export function AppCommandMenu({ open, onOpenChange }: AppCommandMenuProps) {
</CommandGroup>

<CommandGroup className="mx-2 p-0 pb-2" heading={_(msg`Preferences`)}>
<CommandItem className="-mx-2 -my-1 rounded-lg" onSelect={() => addPage('language')}>
{_(msg`Change language`)}
</CommandItem>
<CommandItem className="-mx-2 -my-1 rounded-lg" onSelect={() => addPage('theme')}>
{_(msg`Change theme`)}
</CommandItem>
Expand Down Expand Up @@ -291,7 +284,6 @@ export function AppCommandMenu({ open, onOpenChange }: AppCommandMenuProps) {
)}

{currentPage === 'theme' && <ThemeCommands />}
{currentPage === 'language' && <LanguageCommands />}
</CommandList>
</CommandDialog>
);
Expand Down Expand Up @@ -341,57 +333,3 @@ const ThemeCommands = () => {
</CommandItem>
));
};

const LanguageCommands = () => {
const { i18n, _ } = useLingui();
const { toast } = useToast();

const [isLoading, setIsLoading] = useState(false);

const setLanguage = async (lang: string) => {
if (isLoading || lang === i18n.locale) {
return;
}

setIsLoading(true);

try {
await dynamicActivate(lang);

const formData = new FormData();

formData.append('lang', lang);

const response = await fetch('/api/locale', {
method: 'post',
body: formData,
});

if (!response.ok) {
throw new Error(response.statusText);
}
} catch (e) {
console.error(`Failed to set language: ${e}`);

toast({
title: _(msg`An unknown error occurred`),
variant: 'destructive',
description: _(msg`Unable to change the language at this time. Please try again later.`),
});
}

setIsLoading(false);
};

return Object.values(SUPPORTED_LANGUAGES).map((language) => (
<CommandItem
disabled={isLoading}
key={language.short}
onSelect={async () => setLanguage(language.short)}
className="mx-2 -my-1 rounded-lg first:mt-2 last:mb-2"
>
<CheckIcon className={cn('mr-2 h-4 w-4', i18n.locale === language.short ? 'opacity-100' : 'opacity-0')} />
{_(language.full)}
</CommandItem>
));
};
10 changes: 0 additions & 10 deletions apps/remix/app/components/general/menu-switcher.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { useSession } from '@documenso/lib/client-only/providers/session';
import { formatAvatarUrl } from '@documenso/lib/utils/avatars';
import { isAdmin } from '@documenso/lib/utils/is-admin';
import { extractInitials } from '@documenso/lib/utils/recipient-formatter';
import { LanguageSwitcherDialog } from '@documenso/ui/components/common/language-switcher-dialog';
import { cn } from '@documenso/ui/lib/utils';
import { AvatarWithText } from '@documenso/ui/primitives/avatar';
import { Button } from '@documenso/ui/primitives/button';
Expand All @@ -18,16 +17,13 @@ import { msg } from '@lingui/core/macro';
import { useLingui } from '@lingui/react';
import { Trans } from '@lingui/react/macro';
import { ChevronsUpDown, Plus } from 'lucide-react';
import { useState } from 'react';
import { Link } from 'react-router';

export const MenuSwitcher = () => {
const { _ } = useLingui();

const { user } = useSession();

const [languageSwitcherOpen, setLanguageSwitcherOpen] = useState(false);

const isUserAdmin = isAdmin(user);

const formatAvatarFallback = (name?: string) => {
Expand Down Expand Up @@ -86,19 +82,13 @@ export const MenuSwitcher = () => {
</Link>
</DropdownMenuItem>

<DropdownMenuItem className="px-4 py-2 text-muted-foreground" onClick={() => setLanguageSwitcherOpen(true)}>
<Trans>Language</Trans>
</DropdownMenuItem>

<DropdownMenuItem
className="hover:!text-destructive px-4 py-2 text-destructive/90"
onSelect={async () => authClient.signOut()}
>
<Trans>Sign Out</Trans>
</DropdownMenuItem>
</DropdownMenuContent>

<LanguageSwitcherDialog open={languageSwitcherOpen} setOpen={setLanguageSwitcherOpen} />
</DropdownMenu>
);
};
11 changes: 0 additions & 11 deletions apps/remix/app/components/general/org-menu-switcher.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { canExecuteOrganisationAction } from '@documenso/lib/utils/organisations
import { extractInitials } from '@documenso/lib/utils/recipient-formatter';
import { canExecuteTeamAction } from '@documenso/lib/utils/teams';
import { AnimateGenericFadeInOut } from '@documenso/ui/components/animate/animate-generic-fade-in-out';
import { LanguageSwitcherDialog } from '@documenso/ui/components/common/language-switcher-dialog';
import { cn } from '@documenso/ui/lib/utils';
import { AvatarWithText } from '@documenso/ui/primitives/avatar';
import { Button } from '@documenso/ui/primitives/button';
Expand All @@ -36,7 +35,6 @@ export const OrgMenuSwitcher = () => {
const { pathname } = useLocation();

const [isOpen, setIsOpen] = useState(false);
const [languageSwitcherOpen, setLanguageSwitcherOpen] = useState(false);
const [hoveredOrgId, setHoveredOrgId] = useState<string | null>(null);

const isUserAdmin = isAdmin(user);
Expand Down Expand Up @@ -287,13 +285,6 @@ export const OrgMenuSwitcher = () => {
</Link>
</DropdownMenuItem>

<DropdownMenuItem
className="px-4 py-2 text-muted-foreground"
onClick={() => setLanguageSwitcherOpen(true)}
>
<Trans>Language</Trans>
</DropdownMenuItem>

{currentOrganisation && (
<DropdownMenuItem className="px-4 py-2 text-muted-foreground" asChild>
<Link
Expand All @@ -317,8 +308,6 @@ export const OrgMenuSwitcher = () => {
</div>
</div>
</DropdownMenuContent>

<LanguageSwitcherDialog open={languageSwitcherOpen} setOpen={setLanguageSwitcherOpen} />
</DropdownMenu>
);
};
Loading
Loading