Skip to content

Commit

Permalink
add more translations
Browse files Browse the repository at this point in the history
  • Loading branch information
eduardozgz committed Aug 2, 2024
1 parent 283b605 commit e8f5173
Show file tree
Hide file tree
Showing 8 changed files with 165 additions and 53 deletions.
30 changes: 30 additions & 0 deletions apps/website/src/@types/resources.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,22 @@ interface Resources {
channelsUnderACategory: "Channels under a category";
};
};
clock: {
name: "Clock";
description: "Display a clock adjusted to your preferred timezone.";
keywords: "clock,timezone";
display: {
syntax: "Clock ({{timezone}})";
};
};
countdown: {
name: "Countdown";
description: "Create a countdown timer with a format tailored to your needs.";
keywords: "countdown,timer";
display: {
syntax: "Countdown to {{datetime}}";
};
};
game: {
name: "Game";
description: "Retrieve the current number of online players in your game server, compatible with more than 320 games.";
Expand Down Expand Up @@ -588,6 +604,20 @@ interface Resources {
};
};
};
nitroboosters: {
name: "Nitro Boosters";
description: "Retrieve the count of Nitro boosters for the server.";
keywords: "nitro,boosters,server";
};
number: {
name: "Nitro Boosters";
description: "Apply number formatting to the given number.";
display: {
raw: "Number ({{number}})";
dataSource: "{{dataSourceDisplayName}} as number";
};
keywords: "number,formatting";
};
roles: {
name: "Roles";
description: "Count all roles present in the server.";
Expand Down
6 changes: 3 additions & 3 deletions apps/website/src/app/components/LanguageSelector.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Globe2Icon } from "lucide-react";
import { LanguagesIcon } from "lucide-react";

import { Button } from "@mc/ui/button";
import {
Expand All @@ -16,8 +16,8 @@ export function LanguageSelector() {
return (
<DropdownMenu>
<DropdownMenuTrigger asChild>
<Button variant="outline" size="icon">
<Globe2Icon className="h-4 w-4" />
<Button variant="ghost" size="icon">
<LanguagesIcon className="h-4 w-4" />
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import type { i18n } from "i18next";
import { HourglassIcon } from "lucide-react";

import { DataSourceId } from "@mc/common/DataSource";

import { createDataSourceMetadata } from "./createDataSourceMetadata";

export const createDataSourceMetadataClock = (i18n: i18n) =>
createDataSourceMetadata({
dataSourceId: DataSourceId.CLOCK,
tKeyName: "clock",
icon: HourglassIcon,
i18n,
displayName(dataSource, t) {
if (
!dataSource.options ||
typeof dataSource.options.timezone !== "string"
)
return t("name");

return t("display.syntax", { timezone: dataSource.options.timezone });
},
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import type { i18n } from "i18next";
import { HourglassIcon } from "lucide-react";

import { DataSourceId } from "@mc/common/DataSource";

import { createDataSourceMetadata } from "./createDataSourceMetadata";

export const createDataSourceMetadataCountdown = (i18n: i18n) =>
createDataSourceMetadata({
dataSourceId: DataSourceId.COUNTDOWN,
tKeyName: "countdown",
icon: HourglassIcon,
i18n,
displayName(dataSource, t) {
if (!dataSource.options || typeof dataSource.options.date !== "number")
return t("name");

return t("display.syntax", {
datetime: new Date(dataSource.options.date).toLocaleString(),
});
},
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import type { i18n } from "i18next";
import { PartyPopperIcon } from "lucide-react";

import { DataSourceId } from "@mc/common/DataSource";

import { createDataSourceMetadata } from "./createDataSourceMetadata";

export const createDataSourceMetadataNitroboosters = (i18n: i18n) =>
createDataSourceMetadata({
dataSourceId: DataSourceId.NITRO_BOOSTERS,
tKeyName: "nitroboosters",
icon: PartyPopperIcon,
i18n,
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import type { i18n } from "i18next";
import { Tally5Icon } from "lucide-react";

import { DataSourceId } from "@mc/common/DataSource";

import { createDataSourceMetadata } from "./createDataSourceMetadata";
import { getDataSourceMetadata } from ".";

export const createDataSourceMetadataNumber = (i18n: i18n) =>
createDataSourceMetadata({
dataSourceId: DataSourceId.NUMBER,
tKeyName: "number",
icon: Tally5Icon,
i18n,
displayName(dataSource, t) {
if (!dataSource.options) {
return t("name");
} else if (
typeof dataSource.options.number === "object" &&
"id" in dataSource.options.number
) {
const nestedMetadata = getDataSourceMetadata(
dataSource.options.number.id, i18n,
)

return t("display.dataSource", {
dataSourceDisplayName: nestedMetadata.displayName(
dataSource.options.number,
),
});
} else {
return t("display.raw", { number: dataSource.options.number });
}
},
});
Original file line number Diff line number Diff line change
Expand Up @@ -9,65 +9,19 @@ import type { DataSourceMetadata } from "./createDataSourceMetadata";
import type { Searchable } from "~/app/components/Combobox";
import { createDataSourceMetadataBotStats } from "./DataSourceMetadataBotStats";
import { createDataSourceMetadataChannels } from "./DataSourceMetadataChannels";

import { createDataSourceMetadataClock } from "./DataSourceMetadataClock";
import { createDataSourceMetadataCountdown } from "./DataSourceMetadataCountdown";
import { createDataSourceMetadataGame } from "./DataSourceMetadataGame";
import { createDataSourceMetadataMath } from "./DataSourceMetadataMath";
import { createDataSourceMetadataMembers } from "./DataSourceMetadataMembers";
import { createDataSourceMetadataMemerator } from "./DataSourceMetadataMemerator";
import { createDataSourceMetadataNitroboosters } from "./DataSourceMetadataNitroboosters";
import { createDataSourceMetadataRoles } from "./DataSourceMetadataRoles";
import { createDataSourceMetadataTwitch } from "./DataSourceMetadataTwitch";
import { createDataSourceMetadataUnknown } from "./DataSourceMetadataUnknown";
import { createDataSourceMetadataYoutube } from "./DataSourceMetadataYoutube";
import { createDataSourceMetadataNumber } from "./DataSourceMetadataNumber";

// const countdownDataSourceMetadata: DataSourceMetadata<DataSourceCountdown> = {
// icon: HourglassIcon,
// description: "Create a countdown timer with a format tailored to your needs.",
// displayName: (dataSource: DataSourceCountdown) => {
// if (!dataSource.options || typeof dataSource.options.date !== "number")
// return "Countdown";
// return "Countdown to " + new Date(dataSource.options.date).toLocaleString();
// },
// dataSource: { id: DataSourceId.COUNTDOWN },
// keywords: ["countdown", "timer", "format"],
// };
// const clockDataSourceMetadata: DataSourceMetadata<DataSourceClock> = {
// icon: ClockIcon,
// description: "Display a clock adjusted to your preferred timezone.",
// displayName: (dataSource: DataSourceClock) => {
// if (!dataSource.options || typeof dataSource.options.timezone !== "string")
// return "Clock";
// return "Clock (" + dataSource.options.timezone + ")";
// },
// dataSource: { id: DataSourceId.CLOCK },
// keywords: ["clock", "timezone"],
// };
// const nitroBoostersDataSourceMetadata: DataSourceMetadata<DataSourceNitroBoosters> =
// {
// icon: PartyPopperIcon,
// description: "Retrieve the count of Nitro boosters for the server.",
// displayName: () => "Nitro Boosters",
// dataSource: { id: DataSourceId.NITRO_BOOSTERS },
// keywords: ["Nitro", "boosters", "server"],
// };
// const numberDataSourceMetadata: DataSourceMetadata<DataSourceNumber> = {
// icon: Tally5Icon,
// description: "Apply number formatting to the given number.",
// displayName: (dataSource: DataSourceNumber) => {
// if (!dataSource.options) return "Number";
// else if (
// typeof dataSource.options.number === "object" &&
// "id" in dataSource.options.number
// )
// return (
// getDataSourceMetadata(dataSource.options.number.id).displayName(
// dataSource.options.number,
// ) + " as number"
// );
// else return "Number (" + dataSource.options.number + ")";
// },
// dataSource: { id: DataSourceId.NUMBER },
// keywords: ["number", "formatting"],
// };
// const redditDataSourceMetadata: DataSourceMetadata<DataSourceReddit> = {
// icon: CakeSliceIcon,
// description:
Expand Down Expand Up @@ -157,6 +111,10 @@ export function dataSourcesMetadataFactory(
[
createDataSourceMetadataBotStats(i18n),
createDataSourceMetadataChannels(i18n),
createDataSourceMetadataCountdown(i18n),
createDataSourceMetadataClock(i18n),
createDataSourceMetadataNitroboosters(i18n),
createDataSourceMetadataNumber(i18n),
createDataSourceMetadataGame(i18n),
createDataSourceMetadataMath(i18n),
createDataSourceMetadataMembers(i18n),
Expand Down
30 changes: 30 additions & 0 deletions apps/website/src/i18n/locales/en-US/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,22 @@
"channelsUnderACategory": "Channels under a category"
}
},
"clock": {
"name": "Clock",
"description": "Display a clock adjusted to your preferred timezone.",
"keywords": "clock,timezone",
"display": {
"syntax": "Clock ({{timezone}})"
}
},
"countdown": {
"name": "Countdown",
"description": "Create a countdown timer with a format tailored to your needs.",
"keywords": "countdown,timer",
"display": {
"syntax": "Countdown to {{datetime}}"
}
},
"game": {
"name": "Game",
"description": "Retrieve the current number of online players in your game server, compatible with more than 320 games.",
Expand Down Expand Up @@ -587,6 +603,20 @@
}
}
},
"nitroboosters": {
"name": "Nitro Boosters",
"description": "Retrieve the count of Nitro boosters for the server.",
"keywords": "nitro,boosters,server"
},
"number": {
"name": "Nitro Boosters",
"description": "Apply number formatting to the given number.",
"display": {
"raw": "Number ({{number}})",
"dataSource": "{{dataSourceDisplayName}} as number"
},
"keywords": "number,formatting"
},
"roles": {
"name": "Roles",
"description": "Count all roles present in the server.",
Expand Down

0 comments on commit e8f5173

Please sign in to comment.