Translate App, LoginButton

This commit is contained in:
Paul Bienkowski 2022-07-24 17:18:23 +02:00
parent 5f3ac69f60
commit 31fac13f8a
4 changed files with 78 additions and 17 deletions

View file

@ -85,30 +85,30 @@ const App = connect((state) => ({login: state.login}))(function App({login}) {
{hasMap && ( {hasMap && (
<Link component={MenuItemForLink} to="/map" as="a"> <Link component={MenuItemForLink} to="/map" as="a">
Map {t('App.menu.map')}
</Link> </Link>
)} )}
<Link component={MenuItemForLink} to="/tracks" as="a"> <Link component={MenuItemForLink} to="/tracks" as="a">
Tracks {t('App.menu.tracks')}
</Link> </Link>
<Link component={MenuItemForLink} to="/export" as="a"> <Link component={MenuItemForLink} to="/export" as="a">
Export {t('App.menu.export')}
</Link> </Link>
<Menu.Menu position="right"> <Menu.Menu position="right">
{login ? ( {login ? (
<> <>
<Link component={MenuItemForLink} to="/my/tracks" as="a"> <Link component={MenuItemForLink} to="/my/tracks" as="a">
My Tracks {t('App.menu.myTracks')}
</Link> </Link>
<Dropdown item trigger={<Avatar user={login} className={styles.avatar} />}> <Dropdown item trigger={<Avatar user={login} className={styles.avatar} />}>
<Dropdown.Menu> <Dropdown.Menu>
<Link to="/upload" component={DropdownItemForLink} icon="cloud upload" text="Upload tracks" /> <Link to="/upload" component={DropdownItemForLink} icon="cloud upload" text={t('App.menu.uploadTracks')} />
<Link to="/settings" component={DropdownItemForLink} icon="cog" text="Settings" /> <Link to="/settings" component={DropdownItemForLink} icon="cog" text={t('App.menu.settings')}/>
<Dropdown.Divider /> <Dropdown.Divider />
<Link to="/logout" component={DropdownItemForLink} icon="sign-out" text="Logout" /> <Link to="/logout" component={DropdownItemForLink} icon="sign-out" text={t('App.menu.logout')} />
</Dropdown.Menu> </Dropdown.Menu>
</Dropdown> </Dropdown>
</> </>
@ -169,7 +169,9 @@ const App = connect((state) => ({login: state.login}))(function App({login}) {
<Grid columns={4} stackable> <Grid columns={4} stackable>
<Grid.Row> <Grid.Row>
<Grid.Column> <Grid.Column>
<Header as="h5">About the project</Header> <Header as="h5">
{t('App.footer.aboutTheProject')}
</Header>
<List> <List>
<List.Item> <List.Item>
<a href="https://openbikesensor.org/" target="_blank" rel="noreferrer"> <a href="https://openbikesensor.org/" target="_blank" rel="noreferrer">
@ -180,36 +182,43 @@ const App = connect((state) => ({login: state.login}))(function App({login}) {
</Grid.Column> </Grid.Column>
<Grid.Column> <Grid.Column>
<Header as="h5">Get involved</Header> <Header as="h5">
{t('App.footer.getInvolved')}
</Header>
<List> <List>
<List.Item> <List.Item>
<a href="https://forum.openbikesensor.org/" target="_blank" rel="noreferrer"> <a href="https://forum.openbikesensor.org/" target="_blank" rel="noreferrer">
Get help in forum {t('App.footer.getHelpInForum')}
</a> </a>
</List.Item> </List.Item>
<List.Item> <List.Item>
<a href="https://github.com/openbikesensor/portal/issues/new" target="_blank" rel="noreferrer"> <a href="https://github.com/openbikesensor/portal/issues/new" target="_blank" rel="noreferrer">
Report an issue {t('App.footer.reportAnIssue')}
</a> </a>
</List.Item> </List.Item>
<List.Item> <List.Item>
<a href="https://github.com/openbikesensor/portal" target="_blank" rel="noreferrer"> <a href="https://github.com/openbikesensor/portal" target="_blank" rel="noreferrer">
Development {t('App.footer.development')}
</a> </a>
</List.Item> </List.Item>
</List> </List>
</Grid.Column> </Grid.Column>
<Grid.Column> <Grid.Column>
<Header as="h5">This installation</Header> <Header as="h5">
{t('App.footer.thisInstallation')}
This installation
</Header>
<List> <List>
<List.Item> <List.Item>
<a href={config?.privacyPolicyUrl} target="_blank" rel="noreferrer"> <a href={config?.privacyPolicyUrl} target="_blank" rel="noreferrer">
{t('App.footer.privacyPolicy')}
Privacy policy Privacy policy
</a> </a>
</List.Item> </List.Item>
<List.Item> <List.Item>
<a href={config?.imprintUrl} target="_blank" rel="noreferrer"> <a href={config?.imprintUrl} target="_blank" rel="noreferrer">
{t('App.footer.imprint')}
Imprint Imprint
</a> </a>
</List.Item> </List.Item>
@ -221,7 +230,7 @@ const App = connect((state) => ({login: state.login}))(function App({login}) {
target="_blank" target="_blank"
rel="noreferrer" rel="noreferrer"
> >
Version {apiVersion ? `v${apiVersion}` : 'Fetching version...'} {apiVersion ? t('App.footer.version', {apiVersion}) : t('App.footer.versionLoading')}
</a> </a>
</List.Item> </List.Item>
</List> </List>

View file

@ -1,9 +1,11 @@
import React from 'react' import React from 'react'
import {Button} from 'semantic-ui-react' import {Button} from 'semantic-ui-react'
import {useTranslation} from 'react-i18next'
import api from 'api' import api from 'api'
export default function LoginButton(props) { export default function LoginButton(props) {
const {t} = useTranslation()
const [busy, setBusy] = React.useState(false) const [busy, setBusy] = React.useState(false)
const onClick = React.useCallback( const onClick = React.useCallback(
@ -19,7 +21,7 @@ export default function LoginButton(props) {
return ( return (
<Button onClick={busy ? null : onClick} loading={busy} {...props}> <Button onClick={busy ? null : onClick} loading={busy} {...props}>
Login {t('LoginButton.login')}
</Button> </Button>
) )
} }

View file

@ -3,4 +3,29 @@ HomePage:
App: App:
footer: footer:
aboutTheProject: Über das Projekt
getInvolved: Mitmachen
getHelpInForum: Hilfe im Forum finden
reportAnIssue: Ein Problem melden
development: Entwicklung
thisInstallation: Diese Installation
privacyPolicy: Datenschutz
imprint: Impressum
version: Version v{apiVersion}
versionLoading: Version lädt...
changeLanguage: Sprache wechseln changeLanguage: Sprache wechseln
menu:
map: Karte
tracks: Fahrten
export: Export
myTracks: Meine Fahrten
uploadTracks: Fahrten hochladen
settings: Einstellungen
logout: Abmelden
LoginButton:
login: Anmelden

View file

@ -7,4 +7,29 @@ locales:
App: App:
footer: footer:
aboutTheProject: About the project
getInvolved: Get involved
getHelpInForum: Get help in forum
reportAnIssue: Report an issue
development: Development
thisInstallation: This installation
privacyPolicy: Privacy policy
imprint: Imprint
version: Version v{apiVersion}
versionLoading: Fetching version...
changeLanguage: Change language changeLanguage: Change language
menu:
map: Map
tracks: Tracks
export: Export
myTracks: My tracks
uploadTracks: Upload tracks
settings: Settings
logout: Logout
LoginButton:
login: Login