1
Fork 0
mirror of https://github.com/pds-nest/nest.git synced 2024-11-21 20:44:18 +00:00

🌍 Translated UI

This commit is contained in:
@uni-chiara 2021-05-20 18:28:08 +02:00
parent 75c6ba0833
commit f72382412f
7 changed files with 85 additions and 27 deletions

View file

@ -5,7 +5,7 @@
<option name="PARENT_ENVS" value="true" /> <option name="PARENT_ENVS" value="true" />
<envs> <envs>
<env name="PYTHONUNBUFFERED" value="1" /> <env name="PYTHONUNBUFFERED" value="1" />
<env name="FLASK_CONFIG" value="../config.py" /> <env name="FLASK_CONFIG" value="config.py" />
</envs> </envs>
<option name="SDK_HOME" value="$USER_HOME$/.cache/pypoetry/virtualenvs/nest--u3GVeLy-py3.9/bin/python" /> <option name="SDK_HOME" value="$USER_HOME$/.cache/pypoetry/virtualenvs/nest--u3GVeLy-py3.9/bin/python" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" /> <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />

View file

@ -80,6 +80,25 @@ export default {
type: "Tipo", type: "Tipo",
admin: "Amministratore", admin: "Amministratore",
user: "Utente", user: "Utente",
repoDeleted: "Questa repository è stata eliminata.",
hourlyGraph: "Grafico orario",
visualMap: "Mappa",
tweets: "Tweet",
stats: "Statistiche",
totTweets: "Tweet totali",
dispTweets: "Tweet mostrati",
dispTweetsPerc: "% di tweet mostrati",
locTweets: "Tweet con posizione",
locTweetsPerc: "% di tweet con posizione",
contTweets: "Tweet con contenuto",
contTweetsPerc: "% di tweet con contenuto",
wordCount: "Totale parole",
wordPop: "Parola più utilizzata",
imgTweets: "Tweet con immagine",
imgTweetsPerc: "% di tweet con immagine",
postUniq: "Totale utenti che hanno postato",
postPop: "Utente più attivo",
}, },
// 🇬🇧 // 🇬🇧
en: { en: {
@ -151,6 +170,25 @@ export default {
type: "Type", type: "Type",
admin: "Admin", admin: "Admin",
user: "User", user: "User",
repoDeleted: "This repository was deleted.",
hourlyGraph: "Hourly graph",
visualMap: "Map",
tweets: "Tweets",
stats: "Stats",
totTweets: "Total tweets",
dispTweets: "Displayed tweets",
dispTweetsPerc: "% of displayed tweets",
locTweets: "Tweets with location",
locTweetsPerc: "% of tweets with location",
contTweets: "Tweets with content",
contTweetsPerc: "% of tweets with content",
wordCount: "Word count",
wordPop: "Most popular word",
imgTweets: "Tweets with image",
imgTweetsPerc: "% of tweets with image",
postUniq: "Unique posters",
postPop: "Most active poster",
}, },
// 🇫🇮 // 🇫🇮
fi: { fi: {
@ -222,5 +260,24 @@ export default {
type: "Tyyppi", type: "Tyyppi",
admin: "Ylläpitäjä", admin: "Ylläpitäjä",
user: "Käyttäjä", user: "Käyttäjä",
repoDeleted: "Tämä arkisto on poistettu.",
tweets: "Twiitit",
hourlyGraph: "Tuntikohtainen kaavio",
visualMap: "Kartta",
stats: "Tilastot",
totTweets: "Twiitit yhteensä",
dispTweets: "Näytetyt twiitit",
dispTweetsPerc: "% näytetyistä twiiteistä",
locTweets: "Twiitit, joissa on sijainti",
locTweetsPerc: "% twiiteistä, joissa on sijainti",
contTweets: "Sisältöä sisältävät twiitit",
contTweetsPerc: "% sisältöä sisältävistä twiiteistä",
wordCount: "Sanojen määrä",
wordPop: "Suosituin sana",
imgTweets: "Twiitit, joissa on kuva",
imgTweetsPerc: "% twiiteistä, joissa on kuva",
postUniq: "Ainutkertaiset käyttäjät",
postPop: "Aktiivisimmat käyttäjät",
}, },
} }

View file

@ -1,11 +1,12 @@
import React from "react" import React, { useContext } from "react"
import BoxFullScrollable from "../base/BoxFullScrollable" import BoxFullScrollable from "../base/BoxFullScrollable"
import SummaryTweet from "./SummaryTweet" import SummaryTweet from "./SummaryTweet"
import ContextLanguage from "../../contexts/ContextLanguage"
import Empty from "./Empty" import Empty from "./Empty"
export default function BoxRepositoryTweets({ tweets, ...props }) { export default function BoxRepositoryTweets({ tweets, ...props }) {
// TODO: Translate this const { strings } = useContext(ContextLanguage)
let content let content
if(tweets.length === 0) { if(tweets.length === 0) {
@ -16,7 +17,7 @@ export default function BoxRepositoryTweets({ tweets, ...props }) {
} }
return ( return (
<BoxFullScrollable header={"Tweets"} {...props}> <BoxFullScrollable header={strings.tweets} {...props}>
{content} {content}
</BoxFullScrollable> </BoxFullScrollable>
) )

View file

@ -1,11 +1,12 @@
import React from "react" import React, { useContext } from "react"
import BoxFull from "../base/BoxFull" import BoxFull from "../base/BoxFull"
import BoxChart from "../base/BoxChart" import BoxChart from "../base/BoxChart"
import Empty from "./Empty" import Empty from "./Empty"
import ContextLanguage from "../../contexts/ContextLanguage"
export default function BoxVisualizationChart({ tweets, ...props }) { export default function BoxVisualizationChart({ tweets, ...props }) {
// TODO: translate this const { strings } = useContext(ContextLanguage)
const hours = [...Array(24).keys()].map(hour => hour.toString()) const hours = [...Array(24).keys()].map(hour => hour.toString())
const hourlyTweetCount = Array(24).fill(0) const hourlyTweetCount = Array(24).fill(0)
@ -25,7 +26,7 @@ export default function BoxVisualizationChart({ tweets, ...props }) {
return ( return (
<BoxChart <BoxChart
header={"Hourly graph"} header={strings.hourlyGraph}
chartProps={{ chartProps={{
type: "bar", type: "bar",
data: { data: {

View file

@ -7,7 +7,6 @@ import { Marker, Popup } from "react-leaflet"
const locationRegex = /[{](?<lat>[0-9.]+),(?<lng>[0-9.]+)[}]/ const locationRegex = /[{](?<lat>[0-9.]+),(?<lng>[0-9.]+)[}]/
export default function BoxVisualizationMap({ tweets, ...props }) { export default function BoxVisualizationMap({ tweets, ...props }) {
// TODO: translate this
const { strings } = useContext(ContextLanguage) const { strings } = useContext(ContextLanguage)
console.debug(tweets) console.debug(tweets)
@ -33,7 +32,7 @@ export default function BoxVisualizationMap({ tweets, ...props }) {
}) })
return ( return (
<BoxMap header={"Map"} {...props}> <BoxMap header={strings.visualMap} {...props}>
{markers} {markers}
</BoxMap> </BoxMap>
) )

View file

@ -1,10 +1,12 @@
import React, { useMemo } from "react" import React, { useContext, useMemo } from "react"
import FormLabelled from "../base/FormLabelled" import FormLabelled from "../base/FormLabelled"
import FormLabel from "../base/formparts/FormLabel" import FormLabel from "../base/formparts/FormLabel"
import ContextLanguage from "../../contexts/ContextLanguage"
import BoxFullScrollable from "../base/BoxFullScrollable" import BoxFullScrollable from "../base/BoxFullScrollable"
export default function BoxVisualizationStats({ tweets, words, totalTweetCount, ...props }) { export default function BoxVisualizationStats({ tweets, words, totalTweetCount, ...props }) {
const { strings } = useContext(ContextLanguage)
const tweetCount = useMemo( const tweetCount = useMemo(
() => tweets.length, () => tweets.length,
[tweets], [tweets],
@ -104,47 +106,46 @@ export default function BoxVisualizationStats({ tweets, words, totalTweetCount,
// TODO: missing stats // TODO: missing stats
// TODO: translate this
return ( return (
<BoxFullScrollable header={"Stats"} {...props}> <BoxFullScrollable header={strings.stats} {...props}>
<FormLabelled> <FormLabelled>
<FormLabel text={"Total tweets"}> <FormLabel text={strings.totTweets}>
<b>{totalTweetCount}</b> <b>{totalTweetCount}</b>
</FormLabel> </FormLabel>
<FormLabel text={"Displayed tweets"}> <FormLabel text={strings.dispTweets}>
<b>{tweetCount}</b> <b>{tweetCount}</b>
</FormLabel> </FormLabel>
<FormLabel text={"% of displayed tweets"}> <FormLabel text={strings.dispTweetsPerc}>
<b>{tweetPct.toFixed(2)}%</b> <b>{tweetPct.toFixed(2)}%</b>
</FormLabel> </FormLabel>
<FormLabel text={"Tweets with location"}> <FormLabel text={strings.locTweets}>
<b>{tweetLocationCount}</b> <b>{tweetLocationCount}</b>
</FormLabel> </FormLabel>
<FormLabel text={"% of tweets with location"}> <FormLabel text={strings.locTweetsPerc}>
<b>{tweetLocationPct.toFixed(2)}%</b> <b>{tweetLocationPct.toFixed(2)}%</b>
</FormLabel> </FormLabel>
<FormLabel text={"Tweets with content"}> <FormLabel text={strings.contTweets}>
<b>{tweetContentCount}</b> <b>{tweetContentCount}</b>
</FormLabel> </FormLabel>
<FormLabel text={"% of tweets with content"}> <FormLabel text={strings.conTweetsPerc}>
<b>{tweetContentPct.toFixed(2)}%</b> <b>{tweetContentPct.toFixed(2)}%</b>
</FormLabel> </FormLabel>
<FormLabel text={"Word count"}> <FormLabel text={strings.wordCount}>
<b>{wordCount}</b> <b>{wordCount}</b>
</FormLabel> </FormLabel>
<FormLabel text={"Most popular word"}> <FormLabel text={strings.wordPop}>
<b>{mostPopularWord}</b> <b>{mostPopularWord}</b>
</FormLabel> </FormLabel>
<FormLabel text={"Tweets with image"}> <FormLabel text={strings.imgTweets}>
<b>🚧</b> <b>🚧</b>
</FormLabel> </FormLabel>
<FormLabel text={"% of tweets with image"}> <FormLabel text={strings.imgTweetsPerc}>
<b>🚧</b> <b>🚧</b>
</FormLabel> </FormLabel>
<FormLabel text={"Unique posters"}> <FormLabel text={strings.postUniq}>
<b>{uniqueUsersCount}</b> <b>{uniqueUsersCount}</b>
</FormLabel> </FormLabel>
<FormLabel text={"Most active poster"}> <FormLabel text={strings.postPop}>
<b>{mostActiveUser ? `${mostActiveUser.user} (${mostActiveUser.count} tweet${mostActiveUser.count === 1 ? "" : "s"})` : "❌"}</b> <b>{mostActiveUser ? `${mostActiveUser.user} (${mostActiveUser.count} tweet${mostActiveUser.count === 1 ? "" : "s"})` : "❌"}</b>
</FormLabel> </FormLabel>
</FormLabelled> </FormLabelled>

View file

@ -68,10 +68,9 @@ export default function PageRepository({ className, ...props }) {
</> </>
} }
else if(repository === null) { else if(repository === null) {
// TODO: Translate this!
contents = <> contents = <>
<BoxHeader className={Style.Header}> <BoxHeader className={Style.Header}>
<FontAwesomeIcon icon={faTrash}/> <i>This repository was deleted.</i> <FontAwesomeIcon icon={faTrash}/> <i>{strings.repoDeleted}</i>
</BoxHeader> </BoxHeader>
</> </>
} }