Using correct docs language. Fixes #42

This commit is contained in:
Dessalines 2021-03-31 15:23:58 -04:00
parent 09a9174a22
commit 48d6c08eaa
5 changed files with 39 additions and 7 deletions

View file

@ -32,6 +32,7 @@ COPY tsconfig.json \
./
COPY joinlemmy-translations joinlemmy-translations
COPY lemmy-translations lemmy-translations
COPY src src
# Copy the docs and API

@ -1 +1 @@
Subproject commit 4b82eeaaf4762e7a282548b675f40352c1f5ef33
Subproject commit 4df9e58c57a5104fad7d0f2872042327f54d2a55

View file

@ -1,5 +1,6 @@
import { Component } from "inferno";
import { Link } from "inferno-router";
import { getDocsLanguage } from "../utils";
import { i18n } from "../i18next";
export class LinkLine extends Component<any, any> {
@ -12,9 +13,11 @@ export class LinkLine extends Component<any, any> {
<Link to="/instances">{i18n.t("join")}</Link>
<Link to="/apps">{i18n.t("apps")}</Link>
<Link to="/support">{i18n.t("support")}</Link>
<a href="/docs/en/index.html">{i18n.t("docs")}</a>
<a href={`/docs/${getDocsLanguage(i18n.language)}/index.html`}>
{i18n.t("docs")}
</a>
<a
href="/docs/en/code_of_conduct.html"
href={`/docs/${getDocsLanguage(i18n.language)}/code_of_conduct.html`}
title={i18n.t("code_of_conduct")}
>
{i18n.t("coc")}

View file

@ -4,6 +4,7 @@ import { Helmet } from "inferno-helmet";
import { DonateLines } from "./donate-lines";
import { i18n } from "../i18next";
import { T } from "inferno-i18next";
import { getDocsLanguage } from "../utils";
const title = i18n.t("lemmy_title");
@ -24,7 +25,9 @@ export class Main extends Component<any, any> {
return (
<a
class="button primary"
href="/docs/en/administration/administration.html"
href={`/docs/${getDocsLanguage(
i18n.language
)}/administration/administration.html`}
>
{i18n.t("run_a_server")}
</a>
@ -139,7 +142,14 @@ export class Main extends Component<any, any> {
<h2>{i18n.t("create_discussion_platform")}</h2>
<p>
<T i18nKey="create_discussion_platform_desc">
#<a href="/docs/en/administration/administration.html">#</a>
#
<a
href={`/docs/${getDocsLanguage(
i18n.language
)}/administration/administration.html`}
>
#
</a>
<i>#</i>
<a href="https://en.wikipedia.org/wiki/Fediverse">#</a>
</T>
@ -179,8 +189,21 @@ export class Main extends Component<any, any> {
<ul class="is-marginless">
<li>
<T i18nKey="self_hostable">
#<a href="/docs/en/administration/install_docker.html">#</a>
<a href="/docs/en/administration/install_ansible.html">#</a>
#
<a
href={`/docs/${getDocsLanguage(
i18n.language
)}/administration/install_docker.html`}
>
#
</a>
<a
href={`/docs/${getDocsLanguage(
i18n.language
)}/administration/install_ansible.html`}
>
#
</a>
</T>
</li>
<li>{i18n.t("clean_interface")}</li>

5
src/shared/utils.ts Normal file
View file

@ -0,0 +1,5 @@
let DOCS_LANGUAGES = ["en", "es"];
export function getDocsLanguage(lang: string): string {
return DOCS_LANGUAGES.includes(lang) ? lang : "en";
}