Feat/i18n crowdin (#752)

* feat: add crowdin and supported languages

* fix: main branch name

* feat: test crowdin integration

* feat: add crowdin config skeleton

* feat: update crowdin.yml

* fix: remove ro translation

* test: en translation

* test: en translation

* New Crowdin translations by Github Action (#735)

Co-authored-by: Crowdin Bot <[email protected]>

* test: en translation

* fix: separate upload/download workflows

* wip

* New Crowdin translations by Github Action (#738)

Co-authored-by: Crowdin Bot <[email protected]>

* wip

* wip

* wip

* wip

* wip

* typo

* wip

* wip

* update crowdin config

* update

* chore: support i18n de,es,fr,it,pt,ru,ro,en

* chore: extract i18n strings

* chore: extract booking components strings for i18n

* wip

* extract more strings

* wip

* fallback to getServerSideProps for now

* New Crowdin translations by Github Action (#874)

Co-authored-by: Crowdin Bot <[email protected]>

* fix: minor fixes on the datepicker

* fix: add dutch lang

* fix: linting issues

* fix: string

* fix: update GHA

* cleanup trpc

* fix linting

Co-authored-by: Peer Richelsen <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Crowdin Bot <[email protected]>
Co-authored-by: Bailey Pumfleet <[email protected]>
This commit is contained in:
authored and GitHub committed 2021-10-08 14:43:48 +03:00
1 parent 33a683d4b0
commit 2c9b301b77
46 files changed
+2805 -1876

No files matched your search

+44 -28
View File
@@ -1,6 +1,7 @@
import { ArrowLeftIcon, PlusIcon, TrashIcon } from "@heroicons/react/outline";
import React, { useEffect, useRef, useState } from "react";
import { useLocale } from "@lib/hooks/useLocale";
import { Member } from "@lib/member";
import { Team } from "@lib/team";
@@ -16,7 +17,11 @@ import ErrorAlert from "@components/ui/alerts/Error";
import MemberList from "./MemberList";
export default function EditTeam(props: { team: Team | undefined | null; onCloseEdit: () => void }) {
export default function EditTeam(props: {
localeProp: string;
team: Team | undefined | null;
onCloseEdit: () => void;
}) {
const [members, setMembers] = useState([]);
const nameRef = useRef<HTMLInputElement>() as React.MutableRefObject<HTMLInputElement>;
@@ -30,6 +35,7 @@ export default function EditTeam(props: { team: Team | undefined | null; onClose
const [inviteModalTeam, setInviteModalTeam] = useState<Team | null | undefined>();
const [errorMessage, setErrorMessage] = useState("");
const [imageSrc, setImageSrc] = useState<string>("");
const { t, locale } = useLocale({ localeProp: props.localeProp });
const loadMembers = () =>
fetch("/api/teams/" + props.team?.id + "/membership")
@@ -132,19 +138,19 @@ export default function EditTeam(props: { team: Team | undefined | null; onClose
size="sm"
StartIcon={ArrowLeftIcon}
onClick={() => props.onCloseEdit()}>
Back
{t("back")}
</Button>
</div>
<div>
<div className="pb-5 pr-4 sm:pb-6">
<h3 className="text-lg font-bold leading-6 text-gray-900">{props.team?.name}</h3>
<div className="max-w-xl mt-2 text-sm text-gray-500">
<p>Manage your team</p>
<p>{t("manage_your_team")}</p>
</div>
</div>
</div>
<hr className="mt-2" />
<h3 className="font-cal font-bold leading-6 text-gray-900 mt-7 text-md">Profile</h3>
<h3 className="font-cal font-bold leading-6 text-gray-900 mt-7 text-md">{t("profile")}</h3>
<form className="divide-y divide-gray-200 lg:col-span-9" onSubmit={updateTeamHandler}>
{hasErrors && <ErrorAlert message={errorMessage} />}
<div className="py-6 lg:pb-8">
@@ -152,18 +158,22 @@ export default function EditTeam(props: { team: Team | undefined | null; onClose
<div className="flex-grow space-y-6">
<div className="block sm:flex">
<div className="w-full mb-6 sm:w-1/2 sm:mr-2">
<UsernameInput ref={teamUrlRef} defaultValue={props.team?.slug} label={"My team URL"} />
<UsernameInput
ref={teamUrlRef}
defaultValue={props.team?.slug}
label={t("my_team_url")}
/>
</div>
<div className="w-full sm:w-1/2 sm:ml-2">
<label htmlFor="name" className="block text-sm font-medium text-gray-700">
Team name
{t("team_name")}
</label>
<input
ref={nameRef}
type="text"
name="name"
id="name"
placeholder="Your team name"
placeholder={t("your_team_name")}
required
className="block w-full px-3 py-2 mt-1 border border-gray-300 rounded-sm shadow-sm focus:outline-none focus:ring-neutral-500 focus:border-neutral-500 sm:text-sm"
defaultValue={props.team?.name}
@@ -172,7 +182,7 @@ export default function EditTeam(props: { team: Team | undefined | null; onClose
</div>
<div>
<label htmlFor="about" className="block text-sm font-medium text-gray-700">
About
{t("about")}
</label>
<div className="mt-1">
<textarea
@@ -182,9 +192,7 @@ export default function EditTeam(props: { team: Team | undefined | null; onClose
rows={3}
defaultValue={props.team?.bio}
className="block w-full mt-1 border-gray-300 rounded-sm shadow-sm focus:ring-neutral-500 focus:border-neutral-500 sm:text-sm"></textarea>
<p className="mt-2 text-sm text-gray-500">
A few sentences about your team. This will appear on your team&apos;s URL page.
</p>
<p className="mt-2 text-sm text-gray-500">{t("team_description")}</p>
</div>
</div>
<div>
@@ -206,7 +214,7 @@ export default function EditTeam(props: { team: Team | undefined | null; onClose
<ImageUploader
target="logo"
id="logo-upload"
buttonMsg={imageSrc !== "" ? "Edit logo" : "Upload a logo"}
buttonMsg={imageSrc !== "" ? t("edit_logo") : t("upload_a_logo")}
handleAvatarChange={handleLogoChange}
imageSrc={imageSrc ?? props.team?.logo}
/>
@@ -214,20 +222,25 @@ export default function EditTeam(props: { team: Team | undefined | null; onClose
<hr className="mt-6" />
</div>
<div className="flex justify-between mt-7">
<h3 className="font-cal font-bold leading-6 text-gray-900 text-md">Members</h3>
<h3 className="font-cal font-bold leading-6 text-gray-900 text-md">{t("members")}</h3>
<div className="relative flex items-center">
<Button
type="button"
color="secondary"
StartIcon={PlusIcon}
onClick={() => onInviteMember(props.team)}>
New Member
{t("new_member")}
</Button>
</div>
</div>
<div>
{!!members.length && (
<MemberList members={members} onRemoveMember={onRemoveMember} onChange={loadMembers} />
<MemberList
localeProp={locale}
members={members}
onRemoveMember={onRemoveMember}
onChange={loadMembers}
/>
)}
<hr className="mt-6" />
</div>
@@ -245,14 +258,14 @@ export default function EditTeam(props: { team: Team | undefined | null; onClose
</div>
<div className="ml-3 text-sm">
<label htmlFor="hide-branding" className="font-medium text-gray-700">
Disable Cal.com branding
{t("disable_cal_branding")}
</label>
<p className="text-gray-500">Hide all Cal.com branding from your public pages.</p>
<p className="text-gray-500">{t("disable_cal_branding_description")}</p>
</div>
</div>
<hr className="mt-6" />
</div>
<h3 className="font-bold leading-6 text-gray-900 mt-7 text-md">Danger Zone</h3>
<h3 className="font-bold leading-6 text-gray-900 mt-7 text-md">{t("danger_zone")}</h3>
<div>
<div className="relative flex items-start">
<Dialog>
@@ -262,16 +275,15 @@ export default function EditTeam(props: { team: Team | undefined | null; onClose
}}
className="btn-sm btn-white">
<TrashIcon className="group-hover:text-red text-gray-700 w-3.5 h-3.5 mr-2 inline-block" />
Disband Team
{t("disband_team")}
</DialogTrigger>
<ConfirmationDialogContent
localeProp={locale}
variety="danger"
title="Disband Team"
confirmBtnText="Yes, disband team"
cancelBtnText="Cancel"
title={t("disband_team")}
confirmBtnText={t("confirm_disband_team")}
onConfirm={() => deleteTeam()}>
Are you sure you want to disband this team? Anyone who you&apos;ve shared this team
link with will no longer be able to book using it.
{t("disband_team_confirmation_message")}
</ConfirmationDialogContent>
</Dialog>
</div>
@@ -281,19 +293,23 @@ export default function EditTeam(props: { team: Team | undefined | null; onClose
<hr className="mt-8" />
<div className="flex justify-end py-4">
<Button type="submit" color="primary">
Save
{t("save")}
</Button>
</div>
</div>
</form>
<Modal
heading="Team updated successfully"
description="Your team has been updated successfully."
heading={t("team_updated_successfully")}
description={t("your_team_updated_successfully")}
open={successModalOpen}
handleClose={closeSuccessModal}
/>
{showMemberInvitationModal && (
<MemberInvitationModal team={inviteModalTeam} onExit={onMemberInvitationModalExit} />
<MemberInvitationModal
localeProp={locale}
team={inviteModalTeam}
onExit={onMemberInvitationModalExit}
/>
)}
</div>
</div>
+16 -10
View File
@@ -1,12 +1,18 @@
import { UsersIcon } from "@heroicons/react/outline";
import { useState } from "react";
import { useLocale } from "@lib/hooks/useLocale";
import { Team } from "@lib/team";
import Button from "@components/ui/Button";
export default function MemberInvitationModal(props: { team: Team | undefined | null; onExit: () => void }) {
export default function MemberInvitationModal(props: {
localeProp: string;
team: Team | undefined | null;
onExit: () => void;
}) {
const [errorMessage, setErrorMessage] = useState("");
const { t } = useLocale({ localeProp: props.localeProp });
const handleError = async (res: Response) => {
const responseData = await res.json();
@@ -64,10 +70,10 @@ export default function MemberInvitationModal(props: { team: Team | undefined |
</div>
<div className="mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left">
<h3 className="text-lg font-medium leading-6 text-gray-900" id="modal-title">
Invite a new member
{t("invite_new_member")}
</h3>
<div>
<p className="text-sm text-gray-400">Invite someone to your team.</p>
<p className="text-sm text-gray-400">{t("invite_new_team_member")}</p>
</div>
</div>
</div>
@@ -75,7 +81,7 @@ export default function MemberInvitationModal(props: { team: Team | undefined |
<div>
<div className="mb-4">
<label htmlFor="inviteUser" className="block text-sm font-medium text-gray-700">
Email or Username
{t("email_or_username")}
</label>
<input
type="text"
@@ -88,13 +94,13 @@ export default function MemberInvitationModal(props: { team: Team | undefined |
</div>
<div className="mb-4">
<label className="block mb-2 text-sm font-medium tracking-wide text-gray-700" htmlFor="role">
Role
{t("role")}
</label>
<select
id="role"
className="block w-full mt-1 border-gray-300 rounded-md shadow-sm focus:ring-black focus:border-black sm:text-sm">
<option value="MEMBER">Member</option>
<option value="OWNER">Owner</option>
<option value="MEMBER">{t("member")}</option>
<option value="OWNER">{t("owner")}</option>
</select>
</div>
<div className="relative flex items-start">
@@ -109,7 +115,7 @@ export default function MemberInvitationModal(props: { team: Team | undefined |
</div>
<div className="ml-2 text-sm">
<label htmlFor="sendInviteEmail" className="font-medium text-gray-700">
Send an invite email
{t("send_invite_email")}
</label>
</div>
</div>
@@ -122,10 +128,10 @@ export default function MemberInvitationModal(props: { team: Team | undefined |
)}
<div className="mt-5 sm:mt-4 sm:flex sm:flex-row-reverse">
<Button type="submit" color="primary" className="ml-2">
Invite
{t("invite")}
</Button>
<Button type="button" color="secondary" onClick={props.onExit}>
Cancel
{t("cancel")}
</Button>
</div>
</form>
+5
View File
@@ -1,12 +1,16 @@
import { useLocale } from "@lib/hooks/useLocale";
import { Member } from "@lib/member";
import MemberListItem from "./MemberListItem";
export default function MemberList(props: {
localeProp: string;
members: Member[];
onRemoveMember: (text: Member) => void;
onChange: (text: string) => void;
}) {
const { locale } = useLocale({ localeProp: props.localeProp });
const selectAction = (action: string, member: Member) => {
switch (action) {
case "remove":
@@ -20,6 +24,7 @@ export default function MemberList(props: {
<ul className="px-4 mb-2 bg-white border divide-y divide-gray-200 rounded">
{props.members.map((member) => (
<MemberListItem
localeProp={locale}
onChange={props.onChange}
key={member.id}
member={member}
+12 -9
View File
@@ -1,6 +1,7 @@
import { DotsHorizontalIcon, UserRemoveIcon } from "@heroicons/react/outline";
import { useState } from "react";
import { useLocale } from "@lib/hooks/useLocale";
import { Member } from "@lib/member";
import { Dialog, DialogTrigger } from "@components/Dialog";
@@ -11,11 +12,13 @@ import Button from "@components/ui/Button";
import Dropdown, { DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "../ui/Dropdown";
export default function MemberListItem(props: {
localeProp: string;
member: Member;
onActionSelect: (text: string) => void;
onChange: (text: string) => void;
}) {
const [member] = useState(props.member);
const { t, locale } = useLocale({ localeProp: props.localeProp });
return (
member && (
@@ -41,21 +44,21 @@ export default function MemberListItem(props: {
{props.member.role === "INVITEE" && (
<>
<span className="self-center h-6 px-3 py-1 mr-2 text-xs text-yellow-700 capitalize rounded-md bg-yellow-50">
Pending
{t("pending")}
</span>
<span className="self-center h-6 px-3 py-1 mr-4 text-xs text-pink-700 capitalize rounded-md bg-pink-50">
Member
{t("member")}
</span>
</>
)}
{props.member.role === "MEMBER" && (
<span className="self-center h-6 px-3 py-1 mr-4 text-xs text-pink-700 capitalize rounded-md bg-pink-50">
Member
{t("member")}
</span>
)}
{props.member.role === "OWNER" && (
<span className="self-center h-6 px-3 py-1 mr-4 text-xs text-blue-700 capitalize rounded-md bg-blue-50">
Owner
{t("owner")}
</span>
)}
<Dropdown>
@@ -73,16 +76,16 @@ export default function MemberListItem(props: {
color="warn"
StartIcon={UserRemoveIcon}
className="w-full">
Remove User
{t("remove_member")}
</Button>
</DialogTrigger>
<ConfirmationDialogContent
localeProp={locale}
variety="danger"
title="Remove member"
confirmBtnText="Yes, remove member"
cancelBtnText="Cancel"
title={t("remove_member")}
confirmBtnText={t("confirm_remove_member")}
onConfirm={() => props.onActionSelect("remove")}>
Are you sure you want to remove this member from the team?
{t("remove_member_confirmation_message")}
</ConfirmationDialogContent>
</Dialog>
</DropdownMenuItem>
+5
View File
@@ -1,12 +1,16 @@
import { useLocale } from "@lib/hooks/useLocale";
import { Team } from "@lib/team";
import TeamListItem from "./TeamListItem";
export default function TeamList(props: {
localeProp: string;
teams: Team[];
onChange: () => void;
onEditTeam: (text: Team) => void;
}) {
const { locale } = useLocale({ localeProp: props.localeProp });
const selectAction = (action: string, team: Team) => {
switch (action) {
case "edit":
@@ -30,6 +34,7 @@ export default function TeamList(props: {
<ul className="px-4 mb-2 bg-white border divide-y divide-gray-200 rounded">
{props.teams.map((team: Team) => (
<TeamListItem
localeProp={locale}
onChange={props.onChange}
key={team.id}
team={team}
+16 -12
View File
@@ -8,6 +8,7 @@ import {
import Link from "next/link";
import { useState } from "react";
import { useLocale } from "@lib/hooks/useLocale";
import showToast from "@lib/notification";
import { Dialog, DialogTrigger } from "@components/Dialog";
@@ -30,12 +31,14 @@ interface Team {
}
export default function TeamListItem(props: {
localeProp: string;
onChange: () => void;
key: number;
team: Team;
onActionSelect: (text: string) => void;
}) {
const [team, setTeam] = useState<Team | null>(props.team);
const { t, locale } = useLocale({ localeProp: props.localeProp });
const acceptInvite = () => invitationResponse(true);
const declineInvite = () => invitationResponse(false);
@@ -79,24 +82,24 @@ export default function TeamListItem(props: {
{props.team.role === "INVITEE" && (
<div>
<Button type="button" color="secondary" onClick={declineInvite}>
Reject
{t("reject")}
</Button>
<Button type="button" color="primary" className="ml-1" onClick={acceptInvite}>
Accept
{t("accept")}
</Button>
</div>
)}
{props.team.role === "MEMBER" && (
<div>
<Button type="button" color="primary" onClick={declineInvite}>
Leave
{t("leave")}
</Button>
</div>
)}
{props.team.role === "OWNER" && (
<div className="flex space-x-4">
<span className="self-center h-6 px-3 py-1 text-xs text-gray-700 capitalize rounded-md bg-gray-50">
Owner
{t("owner")}
</span>
<Tooltip content="Copy link">
<Button
@@ -104,7 +107,7 @@ export default function TeamListItem(props: {
navigator.clipboard.writeText(
process.env.NEXT_PUBLIC_APP_URL + "/team/" + props.team.slug
);
showToast("Link copied!", "success");
showToast(t("link_copied"), "success");
}}
size="icon"
color="minimal"
@@ -124,14 +127,16 @@ export default function TeamListItem(props: {
className="w-full"
onClick={() => props.onActionSelect("edit")}
StartIcon={PencilAltIcon}>
Edit team
{" "}
{t("edit_team")}
</Button>
</DropdownMenuItem>
<DropdownMenuItem>
<Link href={`${process.env.NEXT_PUBLIC_APP_URL}/team/${props.team.slug}`} passHref={true}>
<a target="_blank">
<Button type="button" color="minimal" className="w-full" StartIcon={ExternalLinkIcon}>
Preview team page
{" "}
{t("preview_team")}
</Button>
</a>
</Link>
@@ -146,17 +151,16 @@ export default function TeamListItem(props: {
color="warn"
StartIcon={TrashIcon}
className="w-full">
Disband Team
{t("disband_team")}
</Button>
</DialogTrigger>
<ConfirmationDialogContent
localeProp={locale}
variety="danger"
title="Disband Team"
confirmBtnText="Yes, disband team"
cancelBtnText="Cancel"
confirmBtnText={t("confirm_disband_team")}
onConfirm={() => props.onActionSelect("disband")}>
Are you sure you want to disband this team? Anyone who you&apos;ve shared this team
link with will no longer be able to book using it.
{t("disband_team_confirmation_message")}
</ConfirmationDialogContent>
</Dialog>
</DropdownMenuItem>
+6 -2
View File
@@ -4,11 +4,15 @@ import classnames from "classnames";
import Link from "next/link";
import React from "react";
import { useLocale } from "@lib/hooks/useLocale";
import Avatar from "@components/ui/Avatar";
import Button from "@components/ui/Button";
import Text from "@components/ui/Text";
const Team = ({ team }) => {
const Team = ({ team, localeProp }) => {
const { t } = useLocale({ localeProp: localeProp });
const Member = ({ member }) => {
const classes = classnames(
"group",
@@ -71,7 +75,7 @@ const Team = ({ team }) => {
{team.eventTypes.length > 0 && (
<aside className="text-center dark:text-white mt-8">
<Button color="secondary" href={`/team/${team.slug}`} shallow={true} StartIcon={ArrowLeftIcon}>
Go back
{t("go_back")}
</Button>
</aside>
)}