Allow proper translation of providers

Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com>
This commit is contained in:
Joshua Castle committed 2024-03-03 17:09:29 -08:00
1 parent 201c034da3
commit f0bbb44555
8 files changed
+655 -467

No files matched your search

+4 -4
View File
@@ -19,7 +19,7 @@ const FeatureList: FeatureItem[] = [
image: Crossplatform2Img,
description: (
<>
<Translate>Geyser is a program that allows Minecraft: Bedrock Edition clients to join Minecraft: Java Edition servers, allowing for true crossplay between both editions of the game. The ultimate goal of this project is to allow Minecraft: Bedrock Edition users to join Minecraft: Java Edition servers as seamlessly as possible.</Translate>
<Translate id="homepage.features.1">Geyser is a program that allows Minecraft: Bedrock Edition clients to join Minecraft: Java Edition servers, allowing for true crossplay between both editions of the game. The ultimate goal of this project is to allow Minecraft: Bedrock Edition users to join Minecraft: Java Edition servers as seamlessly as possible.</Translate>
</>
),
},
@@ -28,7 +28,7 @@ const FeatureList: FeatureItem[] = [
image: Crossplatform1Img,
description: (
<>
<Translate>Geyser acts as a translator which sits between the Bedrock client and the Java server. It takes data from the Bedrock client and translates it into a format the Java server understands and vice versa. Geyser works with any modern Minecraft version and can be installed either as a plugin or ran as a standalone program.</Translate>
<Translate id='homepage.features.2'>Geyser acts as a translator which sits between the Bedrock client and the Java server. It takes data from the Bedrock client and translates it into a format the Java server understands and vice versa. Geyser works with any modern Minecraft version and can be installed either as a plugin or ran as a standalone program.</Translate>
</>
),
},
@@ -37,9 +37,9 @@ const FeatureList: FeatureItem[] = [
image: Crossplatform0Img,
description: (
<>
<Translate>Geyser can be joined from Bedrock clients on Windows 10/11, iOS, Android, and even consoles (more info here). Geyser works with a wide array of hosting providers, but can also be used as its own standalone proxy to join any Minecraft server!</Translate>
<Translate id='homepage.features.3'>Geyser can be joined from Bedrock clients on Windows 10/11, iOS, Android, and even consoles (more info here). Geyser works with a wide array of hosting providers, but can also be used as its own standalone proxy to join any Minecraft server!</Translate>
<Translate>If you are a server owner, you can install our Floodgate plugin which allows Xbox Live authenticated Bedrock users to join without a Java Edition account!</Translate>
<Translate id='homepage.features.4'>If you are a server owner, you can install our Floodgate plugin which allows Xbox Live authenticated Bedrock users to join without a Java Edition account!</Translate>
</>
),
},
+8
View File
@@ -0,0 +1,8 @@
import React from 'react';
import ReactMarkdown from 'react-markdown';
const MarkdownRenderer = ({ content }) => {
return <ReactMarkdown>{content}</ReactMarkdown>;
};
export default MarkdownRenderer;
+12 -19
View File
@@ -1,8 +1,10 @@
import type { Providers, HostingProvider, ProviderType } from "@site/src/types/providers";
import type { HostingProvider, ProviderType } from "@site/src/types/providers";
import ReactMarkdown from "react-markdown";
import Admonition from '@theme/Admonition';
import React, { useState } from 'react';
import Translate from "@docusaurus/Translate";
import { providersData } from "../data/providers";
import MarkdownRenderer from "./MarkdownReander";
export const noP = (props: { children: any; }) => {
const { children } = props;
@@ -10,16 +12,15 @@ export const noP = (props: { children: any; }) => {
}
export const Provider = ({ type }) => {
const data: Providers = require('@site/_data/providers.json')
const providers: HostingProvider[] = data[type as ProviderType]
const hostingProviders: HostingProvider[] = providersData[type as ProviderType]
return (
<div>
<ul>{providers.map((provider: HostingProvider) => (
<ul>{hostingProviders.map((provider: HostingProvider) => (
<li>
<a href={provider.url}>{provider.name}</a>
{provider.description != null || provider.description_template != null ? (
<ReactMarkdown children={`&nbsp;&hyphen; ${data.description_templates[provider.description_template] || ''} ${provider.description || ''}`} components={{ p: noP }} />
{provider.description != null ? (
<ReactMarkdown children={`&nbsp;&hyphen; ${provider.description}`} components={{ p: noP }} />
) : (
''
)}
@@ -30,19 +31,11 @@ export const Provider = ({ type }) => {
}
export const ProviderSelector = () => {
const data: Providers = require('@site/_data/providers.json')
const providers: HostingProvider[] = [
...Object.values(data.built_in),
...Object.values(data.support),
...Object.values(data.no_support)
...Object.values(providersData.built_in),
...Object.values(providersData.support),
...Object.values(providersData.no_support)
].flat().sort((a, b) => a.name.localeCompare(b.name));
// update providers if description_template is set
providers.forEach((provider) => {
if (provider.description_template != null) {
provider.description = data.description_templates[provider.description_template]
}
})
const [selectedProvider, setSelectedProvider] = useState(null);
@@ -63,12 +56,12 @@ export const ProviderSelector = () => {
</option>
))}
</select>
<Admonition type="tip" title="Provider Instructions">
<Admonition type="tip" title={<Translate id='providers.instructions'>Provider Instructions</Translate>}>
{selectedProvider ? (
<ReactMarkdown>{selectedProvider.description}</ReactMarkdown>
) : (
<p>
<Translate>Select a provider to see specific installation instructions</Translate>
<Translate id='providers.select'>Select a provider to see specific installation instructions</Translate>
</p>
)}
</Admonition>
+1 -1
View File
@@ -1,4 +1,4 @@
import versions from '../../_data/versions.json';
import versions from '../data/versions.json';
export const Versions = ({ platform }) => {
return versions[platform]