1
Fork 0
mirror of https://github.com/pds-nest/nest.git synced 2024-11-22 04:54: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" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
<env name="FLASK_CONFIG" value="../config.py" />
<env name="FLASK_CONFIG" value="config.py" />
</envs>
<option name="SDK_HOME" value="$USER_HOME$/.cache/pypoetry/virtualenvs/nest--u3GVeLy-py3.9/bin/python" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />

View file

@ -80,6 +80,25 @@ export default {
type: "Tipo",
admin: "Amministratore",
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: {
@ -151,6 +170,25 @@ export default {
type: "Type",
admin: "Admin",
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: {
@ -222,5 +260,24 @@ export default {
type: "Tyyppi",
admin: "Ylläpitä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 SummaryTweet from "./SummaryTweet"
import ContextLanguage from "../../contexts/ContextLanguage"
import Empty from "./Empty"
export default function BoxRepositoryTweets({ tweets, ...props }) {
// TODO: Translate this
const { strings } = useContext(ContextLanguage)
let content
if(tweets.length === 0) {
@ -16,7 +17,7 @@ export default function BoxRepositoryTweets({ tweets, ...props }) {
}
return (
<BoxFullScrollable header={"Tweets"} {...props}>
<BoxFullScrollable header={strings.tweets} {...props}>
{content}
</BoxFullScrollable>
)

View file

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

View file

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

View file

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

View file

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