mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-06-07 09:55:43 -04:00
New locale format (#94)
* Add new format for translation files Co-authored-by: Philip Molares <philip.molares@udo.edu> Signed-off-by: Tilman Vatteroth <tilman.vatteroth@tu-dortmund.de>
This commit is contained in:
parent
afb2ea85b1
commit
1f347fb653
57 changed files with 5287 additions and 3386 deletions
|
@ -4,12 +4,10 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
|
|||
import { PinButton } from '../common/pin-button'
|
||||
import { CloseButton } from '../common/close-button'
|
||||
import moment from 'moment'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { HistoryEntryProps } from '../history-content/history-content'
|
||||
import { formatHistoryDate } from '../../../../../utils/historyUtils'
|
||||
|
||||
export const HistoryCard: React.FC<HistoryEntryProps> = ({ entry, onPinClick }) => {
|
||||
useTranslation()
|
||||
return (
|
||||
<div className="p-2 col-xs-12 col-sm-6 col-md-6 col-lg-4">
|
||||
<Card className="p-0" text={'dark'} bg={'light'}>
|
||||
|
|
|
@ -2,7 +2,7 @@ import React, { Fragment, useState } from 'react'
|
|||
import { HistoryEntry, pinClick } from '../history'
|
||||
import { HistoryTable } from '../history-table/history-table'
|
||||
import { Alert, Row } from 'react-bootstrap'
|
||||
import { Trans } from 'react-i18next'
|
||||
import { Trans, useTranslation } from 'react-i18next'
|
||||
import { HistoryCardList } from '../history-card/history-card-list'
|
||||
import { ViewStateEnum } from '../history-toolbar/history-toolbar'
|
||||
import { PagerPagination } from '../../../../pagination/pager-pagination'
|
||||
|
@ -26,6 +26,7 @@ export interface HistoryEntriesProps {
|
|||
}
|
||||
|
||||
export const HistoryContent: React.FC<HistoryContentProps> = ({ viewState, entries, onPinClick }) => {
|
||||
useTranslation()
|
||||
const [pageIndex, setPageIndex] = useState(0)
|
||||
const [lastPageIndex, setLastPageIndex] = useState(0)
|
||||
|
||||
|
@ -33,7 +34,7 @@ export const HistoryContent: React.FC<HistoryContentProps> = ({ viewState, entri
|
|||
return (
|
||||
<Row className={'justify-content-center'}>
|
||||
<Alert variant={'secondary'}>
|
||||
<Trans i18nKey={'noHistory'}/>
|
||||
<Trans i18nKey={'landing.history.noHistory'}/>
|
||||
</Alert>
|
||||
</Row>
|
||||
)
|
||||
|
|
|
@ -1,13 +1,11 @@
|
|||
import React from 'react'
|
||||
import { PinButton } from '../common/pin-button'
|
||||
import { CloseButton } from '../common/close-button'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { HistoryEntryProps } from '../history-content/history-content'
|
||||
import { formatHistoryDate } from '../../../../../utils/historyUtils'
|
||||
import { Badge } from 'react-bootstrap'
|
||||
|
||||
export const HistoryTableRow: React.FC<HistoryEntryProps> = ({ entry, onPinClick }) => {
|
||||
useTranslation()
|
||||
return (
|
||||
<tr>
|
||||
<td>{entry.title}</td>
|
||||
|
|
|
@ -2,18 +2,19 @@ import React from 'react'
|
|||
import { Table } from 'react-bootstrap'
|
||||
import { HistoryTableRow } from './history-table-row'
|
||||
import { HistoryEntriesProps } from '../history-content/history-content'
|
||||
import { Trans } from 'react-i18next'
|
||||
import { Trans, useTranslation } from 'react-i18next'
|
||||
import { Pager } from '../../../../pagination/pager'
|
||||
|
||||
export const HistoryTable: React.FC<HistoryEntriesProps> = ({ entries, onPinClick, pageIndex, onLastPageIndexChange }) => {
|
||||
useTranslation()
|
||||
return (
|
||||
<Table striped bordered hover size="sm" variant="dark">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><Trans i18nKey={'title'}/></th>
|
||||
<th><Trans i18nKey={'lastVisit'}/></th>
|
||||
<th><Trans i18nKey={'tags'}/></th>
|
||||
<th><Trans i18nKey={'actions'}/></th>
|
||||
<th><Trans i18nKey={'landing.history.tableHeader.title'}/></th>
|
||||
<th><Trans i18nKey={'landing.history.tableHeader.lastVisit'}/></th>
|
||||
<th><Trans i18nKey={'landing.history.tableHeader.tags'}/></th>
|
||||
<th><Trans i18nKey={'landing.history.tableHeader.actions'}/></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
|
|
@ -16,20 +16,22 @@ export const ClearHistoryButton: React.FC<ClearHistoryButtonProps> = ({ onClearH
|
|||
|
||||
return (
|
||||
<Fragment>
|
||||
<Button variant={'light'} title={t('clearHistory')} onClick={handleShow}>
|
||||
<Button variant={'light'} title={t('landing.history.toolbar.clear')} onClick={handleShow}>
|
||||
<FontAwesomeIcon icon={'trash'}/>
|
||||
</Button>
|
||||
<Modal show={show} onHide={handleClose} animation={true} size="sm">
|
||||
<Modal show={show} onHide={handleClose} animation={true} className="text-dark">
|
||||
<Modal.Header closeButton>
|
||||
<Modal.Title>
|
||||
<Trans i18nKey={'landing.history.modal.clearHistory.title'}/>
|
||||
</Modal.Title>
|
||||
</Modal.Header>
|
||||
<Modal.Body className="text-dark">
|
||||
<h5><Trans i18nKey={'clearHistoryQuestion'}/></h5>
|
||||
<h6><Trans i18nKey={'clearHistoryDisclaimer'}/></h6>
|
||||
<h5><Trans i18nKey={'landing.history.modal.clearHistory.question'}/></h5>
|
||||
<h6><Trans i18nKey={'landing.history.modal.clearHistory.disclaimer'}/></h6>
|
||||
</Modal.Body>
|
||||
<Modal.Footer>
|
||||
<Button variant="secondary" onClick={handleClose}>
|
||||
<Trans i18nKey={'close'}/>
|
||||
</Button>
|
||||
<Button variant="danger" onClick={onClearHistory}>
|
||||
<Trans i18nKey={'clearHistory'}/>
|
||||
<Trans i18nKey={'landing.history.toolbar.clear'}/>
|
||||
</Button>
|
||||
</Modal.Footer>
|
||||
</Modal>
|
||||
|
|
|
@ -74,52 +74,52 @@ export const HistoryToolbar: React.FC<HistoryToolbarProps> = ({ onSettingsChange
|
|||
|
||||
return (
|
||||
<Form inline={true}>
|
||||
<InputGroup className={'mr-1'}>
|
||||
<Typeahead id={'tagsSelection'} options={tags} multiple={true} placeholder={t('selectTags')}
|
||||
<InputGroup className={'mr-1 mb-1'}>
|
||||
<Typeahead id={'tagsSelection'} options={tags} multiple={true} placeholder={t('landing.history.toolbar.selectTags')}
|
||||
onChange={selectedTagsChanged}/>
|
||||
</InputGroup>
|
||||
<InputGroup className={'mr-1'}>
|
||||
<InputGroup className={'mr-1 mb-1'}>
|
||||
<FormControl
|
||||
placeholder={t('searchKeywords')}
|
||||
aria-label={t('searchKeywords')}
|
||||
placeholder={t('landing.history.toolbar.searchKeywords')}
|
||||
aria-label={t('landing.history.toolbar.searchKeywords')}
|
||||
onChange={keywordSearchChanged}
|
||||
/>
|
||||
</InputGroup>
|
||||
<InputGroup className={'mr-1'}>
|
||||
<InputGroup className={'mr-1 mb-1'}>
|
||||
<SortButton onChange={titleSortChanged} direction={state.titleSortDirection} variant={'light'}><Trans
|
||||
i18nKey={'sortByTitle'}/></SortButton>
|
||||
i18nKey={'landing.history.toolbar.sortByTitle'}/></SortButton>
|
||||
</InputGroup>
|
||||
<InputGroup className={'mr-1'}>
|
||||
<InputGroup className={'mr-1 mb-1'}>
|
||||
<SortButton onChange={lastVisitedSortChanged} direction={state.lastVisitedSortDirection}
|
||||
variant={'light'}><Trans i18nKey={'sortByLastVisited'}/></SortButton>
|
||||
variant={'light'}><Trans i18nKey={'landing.history.toolbar.sortByLastVisited'}/></SortButton>
|
||||
</InputGroup>
|
||||
<InputGroup className={'mr-1'}>
|
||||
<Button variant={'light'} title={t('exportHistory')}>
|
||||
<InputGroup className={'mr-1 mb-1'}>
|
||||
<Button variant={'light'} title={t('landing.history.toolbar.export')}>
|
||||
<FontAwesomeIcon icon={'download'}/>
|
||||
</Button>
|
||||
</InputGroup>
|
||||
<InputGroup className={'mr-1'}>
|
||||
<Button variant={'light'} title={t('importHistory')}>
|
||||
<InputGroup className={'mr-1 mb-1'}>
|
||||
<Button variant={'light'} title={t('landing.history.toolbar.import')}>
|
||||
<FontAwesomeIcon icon={'upload'}/>
|
||||
</Button>
|
||||
</InputGroup>
|
||||
<InputGroup className={'mr-1'}>
|
||||
<InputGroup className={'mr-1 mb-1'}>
|
||||
<ClearHistoryButton onClearHistory={onClearHistory}/>
|
||||
</InputGroup>
|
||||
<InputGroup className={'mr-1'}>
|
||||
<Button variant={'light'} title={t('refreshHistory')}>
|
||||
<InputGroup className={'mr-1 mb-1'}>
|
||||
<Button variant={'light'} title={t('landing.history.toolbar.refresh')}>
|
||||
<FontAwesomeIcon icon={'sync'}/>
|
||||
</Button>
|
||||
</InputGroup>
|
||||
<InputGroup className={'mr-1'}>
|
||||
<InputGroup className={'mr-1 mb-1'}>
|
||||
<ToggleButtonGroup type="radio" name="options" value={state.viewState}
|
||||
onChange={(newViewState: ViewStateEnum) => {
|
||||
toggleViewChanged(newViewState)
|
||||
}}>
|
||||
<ToggleButton className={'btn-light'} value={ViewStateEnum.CARD}><Trans
|
||||
i18nKey={'cards'}/></ToggleButton>
|
||||
i18nKey={'landing.history.toolbar.cards'}/></ToggleButton>
|
||||
<ToggleButton className={'btn-light'} value={ViewStateEnum.TABLE}><Trans
|
||||
i18nKey={'table'}/></ToggleButton>
|
||||
i18nKey={'landing.history.toolbar.table'}/></ToggleButton>
|
||||
</ToggleButtonGroup>
|
||||
</InputGroup>
|
||||
</Form>
|
||||
|
|
|
@ -60,8 +60,8 @@ export const History: React.FC = () => {
|
|||
|
||||
return (
|
||||
<Fragment>
|
||||
<h1 className="mb-4"><Trans i18nKey="history"/></h1>
|
||||
<Row className={'justify-content-center mb-3'}>
|
||||
<h1 className="mb-4"><Trans i18nKey="landing.navigation.history"/></h1>
|
||||
<Row className={'justify-content-center mt-5 mb-3'}>
|
||||
<HistoryToolbar
|
||||
onSettingsChange={setViewState}
|
||||
tags={tags}
|
||||
|
|
|
@ -23,12 +23,12 @@ export const CoverButtons: React.FC = () => {
|
|||
variant="success"
|
||||
size="lg"
|
||||
>
|
||||
<Trans i18nKey="signIn"/>
|
||||
<Trans i18nKey="login.signIn"/>
|
||||
</Button>
|
||||
</Link>
|
||||
|
||||
<span className="m-2">
|
||||
<Trans i18nKey="or"/>
|
||||
<Trans i18nKey="common.or"/>
|
||||
</span>
|
||||
|
||||
<Link to="/features">
|
||||
|
@ -37,7 +37,7 @@ export const CoverButtons: React.FC = () => {
|
|||
variant="primary"
|
||||
size="lg"
|
||||
>
|
||||
<Trans i18nKey="exploreFeatures"/>
|
||||
<Trans i18nKey="landing.intro.exploreFeatures"/>
|
||||
</Button>
|
||||
</Link>
|
||||
</div>
|
||||
|
|
|
@ -12,7 +12,7 @@ export const FeatureLinks: React.FC = () => {
|
|||
<Link to={'/features#Share-Notes'} className="text-light">
|
||||
<FontAwesomeIcon icon="bolt" size="3x"/>
|
||||
<h5>
|
||||
<Trans i18nKey="featureCollaboration"/>
|
||||
<Trans i18nKey="landing.intro.features.collaboration"/>
|
||||
</h5>
|
||||
</Link>
|
||||
</Col>
|
||||
|
@ -20,7 +20,7 @@ export const FeatureLinks: React.FC = () => {
|
|||
<Link to={'/features#MathJax'} className="text-light">
|
||||
<FontAwesomeIcon icon="chart-bar" size="3x"/>
|
||||
<h5>
|
||||
<Trans i18nKey="featureMathJax"/>
|
||||
<Trans i18nKey="landing.intro.features.mathJax"/>
|
||||
</h5>
|
||||
</Link>
|
||||
</Col>
|
||||
|
@ -28,7 +28,7 @@ export const FeatureLinks: React.FC = () => {
|
|||
<Link to={'/features#Slide-Mode'} className="text-light">
|
||||
<FontAwesomeIcon icon="tv" size="3x"/>
|
||||
<h5>
|
||||
<Trans i18nKey="featureSlides"/>
|
||||
<Trans i18nKey="landing.intro.features.slides"/>
|
||||
</h5>
|
||||
</Link>
|
||||
</Col>
|
||||
|
|
|
@ -6,7 +6,7 @@ import { FeatureLinks } from './feature-links'
|
|||
import { CoverButtons } from './cover-buttons/cover-buttons'
|
||||
|
||||
const Intro: React.FC = () => {
|
||||
useTranslation()
|
||||
const { t } = useTranslation()
|
||||
|
||||
return (
|
||||
<div>
|
||||
|
@ -14,12 +14,12 @@ const Intro: React.FC = () => {
|
|||
<FontAwesomeIcon icon="file-alt"/> CodiMD
|
||||
</h1>
|
||||
<p className="lead mb-5">
|
||||
<Trans i18nKey="coverSlogan"/>
|
||||
<Trans i18nKey="app.slogan"/>
|
||||
</p>
|
||||
|
||||
<CoverButtons/>
|
||||
|
||||
<img alt="CodiMD Screenshot" src={screenshot} className="img-fluid mb-5"/>
|
||||
<img alt={t("landing.intro.screenShotAltText")} src={screenshot} className="img-fluid mb-5"/>
|
||||
<FeatureLinks/>
|
||||
</div>
|
||||
)
|
||||
|
|
|
@ -24,7 +24,7 @@ export const ViaEMail: React.FC = () => {
|
|||
<Card className="bg-dark mb-4">
|
||||
<Card.Body>
|
||||
<Card.Title>
|
||||
<Trans i18nKey="signInVia" values={{ service: 'E-Mail' }}/>
|
||||
<Trans i18nKey="login.signInVia" values={{ service: 'E-Mail' }}/>
|
||||
</Card.Title>
|
||||
<Form onSubmit={onFormSubmit}>
|
||||
<Form.Group controlId="email">
|
||||
|
@ -32,7 +32,7 @@ export const ViaEMail: React.FC = () => {
|
|||
isInvalid={error}
|
||||
type="email"
|
||||
size="sm"
|
||||
placeholder={t('email')}
|
||||
placeholder={t('login.auth.email')}
|
||||
onChange={(event) => setEmail(event.currentTarget.value)} className="bg-dark text-white"
|
||||
/>
|
||||
</Form.Group>
|
||||
|
@ -42,20 +42,20 @@ export const ViaEMail: React.FC = () => {
|
|||
isInvalid={error}
|
||||
type="password"
|
||||
size="sm"
|
||||
placeholder={t('password')}
|
||||
placeholder={t('login.auth.password')}
|
||||
onChange={(event) => setPassword(event.currentTarget.value)}
|
||||
className="bg-dark text-white"/>
|
||||
</Form.Group>
|
||||
|
||||
<Alert className="small" show={error} variant="danger">
|
||||
<Trans i18nKey="errorEmailLogin"/>
|
||||
<Trans i18nKey="login.auth.error.emailLogin"/>
|
||||
</Alert>
|
||||
|
||||
<Button
|
||||
type="submit"
|
||||
|
||||
variant="primary">
|
||||
<Trans i18nKey="signIn"/>
|
||||
<Trans i18nKey="login.signIn"/>
|
||||
</Button>
|
||||
</Form>
|
||||
</Card.Body>
|
||||
|
|
|
@ -35,7 +35,7 @@ export const ViaLdap: React.FC = () => {
|
|||
<Card className="bg-dark mb-4">
|
||||
<Card.Body>
|
||||
<Card.Title>
|
||||
<Trans i18nKey="signInVia" values={{ service: name }}/>
|
||||
<Trans i18nKey="login.signInVia" values={{ service: name }}/>
|
||||
</Card.Title>
|
||||
<Form onSubmit={onFormSubmit}>
|
||||
<Form.Group controlId="username">
|
||||
|
@ -43,7 +43,7 @@ export const ViaLdap: React.FC = () => {
|
|||
isInvalid={error}
|
||||
type="text"
|
||||
size="sm"
|
||||
placeholder={t('username')}
|
||||
placeholder={t('login.auth.username')}
|
||||
onChange={(event) => setUsername(event.currentTarget.value)} className="bg-dark text-white"
|
||||
/>
|
||||
</Form.Group>
|
||||
|
@ -53,19 +53,19 @@ export const ViaLdap: React.FC = () => {
|
|||
isInvalid={error}
|
||||
type="password"
|
||||
size="sm"
|
||||
placeholder={t('password')}
|
||||
placeholder={t('login.auth.password')}
|
||||
onChange={(event) => setPassword(event.currentTarget.value)}
|
||||
className="bg-dark text-white"/>
|
||||
</Form.Group>
|
||||
|
||||
<Alert className="small" show={error} variant="danger">
|
||||
<Trans i18nKey="errorLdapLogin"/>
|
||||
<Trans i18nKey="login.auth.error.ldapLogin"/>
|
||||
</Alert>
|
||||
|
||||
<Button
|
||||
type="submit"
|
||||
variant="primary">
|
||||
<Trans i18nKey="signIn"/>
|
||||
<Trans i18nKey="login.signIn"/>
|
||||
</Button>
|
||||
</Form>
|
||||
</Card.Body>
|
||||
|
|
|
@ -22,7 +22,7 @@ export const ViaOpenId: React.FC = () => {
|
|||
<Card className="bg-dark mb-4">
|
||||
<Card.Body>
|
||||
<Card.Title>
|
||||
<Trans i18nKey="signInVia" values={{ service: 'OpenID' }}/>
|
||||
<Trans i18nKey="login.signInVia" values={{ service: 'OpenID' }}/>
|
||||
</Card.Title>
|
||||
|
||||
<Form onSubmit={onFormSubmit}>
|
||||
|
@ -38,13 +38,13 @@ export const ViaOpenId: React.FC = () => {
|
|||
</Form.Group>
|
||||
|
||||
<Alert className="small" show={error} variant="danger">
|
||||
<Trans i18nKey="errorOpenIdLogin"/>
|
||||
<Trans i18nKey="login.auth.error.openIdLogin"/>
|
||||
</Alert>
|
||||
|
||||
<Button
|
||||
type="submit"
|
||||
variant="primary">
|
||||
<Trans i18nKey="signIn"/>
|
||||
<Trans i18nKey="login.signIn"/>
|
||||
</Button>
|
||||
</Form>
|
||||
</Card.Body>
|
||||
|
|
|
@ -53,7 +53,7 @@ export const Login: React.FC = () => {
|
|||
<Card className="bg-dark mb-4">
|
||||
<Card.Body>
|
||||
<Card.Title>
|
||||
<Trans i18nKey="signInVia" values={{ service: '' }}/>
|
||||
<Trans i18nKey="login.signInVia" values={{ service: '' }}/>
|
||||
</Card.Title>
|
||||
{
|
||||
Object.values(OneClickType)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue