mirror of
https://github.com/stashapp/stash.git
synced 2025-12-15 04:44:28 +01:00
Add basic i18n implementation (#879)
To be used as a reference point for any future i18n additions for either new languages or more translatable content.
This commit is contained in:
parent
47468fe122
commit
cfbffb3b96
5 changed files with 29 additions and 6 deletions
|
|
@ -40,8 +40,8 @@ const intlFormats = {
|
|||
|
||||
export const App: React.FC = () => {
|
||||
const config = useConfiguration();
|
||||
const language = config.data?.configuration?.interface?.language ?? "en-US";
|
||||
const messageLanguage = language.slice(0, 2);
|
||||
const language = config.data?.configuration?.interface?.language ?? "en-GB";
|
||||
const messageLanguage = language.replace(/-/, "");
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const messages = flattenMessages((locales as any)[messageLanguage]);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import React from "react";
|
||||
import { Card } from "react-bootstrap";
|
||||
import { Link } from "react-router-dom";
|
||||
import { FormattedNumber, FormattedPlural } from "react-intl";
|
||||
import { FormattedNumber, FormattedPlural, FormattedMessage } from "react-intl";
|
||||
import * as GQL from "src/core/generated-graphql";
|
||||
import { NavUtils, TextUtils } from "src/utils";
|
||||
import { CountryFlag } from "src/components/Shared";
|
||||
|
|
@ -22,7 +22,11 @@ export const PerformerCard: React.FC<IPerformerCardProps> = ({
|
|||
if (performer.favorite === false) {
|
||||
return;
|
||||
}
|
||||
return <div className="rating-banner rating-5">FAVORITE</div>;
|
||||
return (
|
||||
<div className="rating-banner rating-5">
|
||||
<FormattedMessage id="favourite" defaultMessage="Favourite" />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
|
|
|
|||
16
ui/v2.5/src/locale/en-GB.json
Normal file
16
ui/v2.5/src/locale/en-GB.json
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
"developmentVersion": "Development Version",
|
||||
"images": "Images",
|
||||
"galleries": "Galleries",
|
||||
"library-size": "Library size",
|
||||
"markers": "Markers",
|
||||
"movies": "Movies",
|
||||
"new": "New",
|
||||
"performers": "Performers",
|
||||
"scenes": "Scenes",
|
||||
"studios": "Studios",
|
||||
"tags": "Tags",
|
||||
"up-dir": "Up a directory",
|
||||
"favourite": "FAVOURITE",
|
||||
"sceneTagger": "Scene Tagger"
|
||||
}
|
||||
|
|
@ -11,5 +11,6 @@
|
|||
"studios": "Studios",
|
||||
"tags": "Tags",
|
||||
"up-dir": "Up a directory",
|
||||
"favourite": "FAVORITE",
|
||||
"sceneTagger": "Scene Tagger"
|
||||
}
|
||||
|
|
@ -1,5 +1,7 @@
|
|||
import en from "./en.json";
|
||||
import enGB from "./en-GB.json";
|
||||
import enUS from "./en-US.json";
|
||||
|
||||
export default {
|
||||
en,
|
||||
enGB,
|
||||
enUS,
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue