1
Fork 0

Translate settings page to danish

This commit is contained in:
viktorstrate 2021-04-05 11:21:58 +02:00
parent 84cb8c3c09
commit 12df24f366
No known key found for this signature in database
GPG Key ID: 3F855605109C1E8A
9 changed files with 190 additions and 46 deletions

View File

@ -2,6 +2,14 @@
"albums_page": {
"title": "Album"
},
"general": {
"action": {
"add": "Tilføj",
"cancel": "Annuller",
"remove": "Slet",
"save": "Gem"
}
},
"loading": {
"paginate": {
"media": "Loader flere medier"
@ -15,12 +23,12 @@
},
"initial_setup": {
"field": {
"photo_path": "Billedesti"
"photo_path": {
"label": "Billedesti",
"placeholder": "/sti/til/billeder"
},
"submit": "Opsæt Photoview"
},
"field-photo_path": {
"placeholder": "/sti/til/billeder"
},
"field-submit": "Opsæt Photoview",
"title": "Førstegangsopsætning"
},
"welcome": "Velkommen til Photoview"
@ -49,10 +57,47 @@
"description": "Vil scanne alle brugere for nye eller opdaterede medier",
"scan_all_users": "Scan alle brugere",
"title": "Scanner"
},
"users": {
"add_user": {
"submit": "Tilføj bruger"
},
"confirm_delete_user": {
"action": "Slet {user}",
"description": "<0>Er du sikker på at du vil slette <1></1>?</0><p>Denne handling kan ikke fortrydes</p>",
"title": "Slet bruger"
},
"password_reset": {
"description": "Ændre adgangskode for <1></1>",
"form": {
"label": "Ny adgangskode",
"placeholder": "adgangskode",
"submit": "Ændre adgangskode"
},
"title": "Ændre adgangskode"
},
"table": {
"column_names": {
"action": "Handling",
"admin": "Admin",
"photo_path": "Billedesti",
"username": "Brugernavn"
},
"new_user": "Ny bruger",
"row": {
"action": {
"change_password": "Ændre adgangskode",
"delete": "Slet",
"edit": "Rediger",
"scan": "Scan"
}
}
},
"title": "Brugere"
}
},
"sidemenu": {
"albums": null,
"albums": "Albums",
"logout": "Log af",
"people": "Personer",
"photos": "Billeder",

View File

@ -2,6 +2,14 @@
"albums_page": {
"title": "Albums"
},
"general": {
"action": {
"add": "Add",
"cancel": "Cancel",
"remove": "Remove",
"save": "Save"
}
},
"loading": {
"paginate": {
"media": "Loading more media"
@ -15,12 +23,12 @@
},
"initial_setup": {
"field": {
"photo_path": "Photo path"
"photo_path": {
"label": "Photo path",
"placeholder": "/path/to/photos"
},
"submit": "Setup Photoview"
},
"field-photo_path": {
"placeholder": "/path/to/photos"
},
"field-submit": "Setup Photoview",
"title": "Initial Setup"
},
"welcome": "Welcome to Photoview"
@ -49,6 +57,43 @@
"description": "Will scan all users for new or updated media",
"scan_all_users": "Scan all users",
"title": "Scanner"
},
"users": {
"add_user": {
"submit": "Add user"
},
"confirm_delete_user": {
"action": "Delete {user}",
"description": "<0>Are you sure, you want to delete <1></1>?</0><p>This action cannot be undone</p>",
"title": "Delete user"
},
"password_reset": {
"description": "Change password for <1></1>",
"form": {
"label": "New password",
"placeholder": "password",
"submit": "Change password"
},
"title": "Change password"
},
"table": {
"column_names": {
"action": "Action",
"admin": "Admin",
"photo_path": "Photo path",
"username": "Username"
},
"new_user": "New user",
"row": {
"action": {
"change_password": "Change password",
"delete": "Delete",
"edit": "Edit",
"scan": "Scan"
}
}
},
"title": "Users"
}
},
"sidemenu": {

View File

@ -111,11 +111,14 @@ const InitialSetupPage = () => {
</Form.Field>
<Form.Field>
<label>
{t('login_page.initial_setup.field.photo_path', 'Photo path')}
{t(
'login_page.initial_setup.field.photo_path.label',
'Photo path'
)}
</label>
<input
placeholder={t(
'login_page.initial_setup.field-photo_path.placeholder',
'login_page.initial_setup.field.photo_path.placeholder',
'/path/to/photos'
)}
type="text"
@ -124,7 +127,7 @@ const InitialSetupPage = () => {
</Form.Field>
<Message error content={errorMessage} />
<Button type="submit">
{t('login_page.initial_setup.field-submit', 'Setup Photoview')}
{t('login_page.initial_setup.field.submit', 'Setup Photoview')}
</Button>
</Form>
</Container>

View File

@ -1,6 +1,7 @@
import { gql, useMutation } from '@apollo/client'
import PropTypes from 'prop-types'
import React, { useState } from 'react'
import { useTranslation } from 'react-i18next'
import { Button, Checkbox, Input, Table } from 'semantic-ui-react'
const createUserMutation = gql`
@ -30,6 +31,7 @@ const initialState = {
}
const AddUserRow = ({ setShow, show, onUserAdded }) => {
const { t } = useTranslation()
const [state, setState] = useState(initialState)
const [addRootPath, { loading: addRootPathLoading }] = useMutation(
@ -81,14 +83,17 @@ const AddUserRow = ({ setShow, show, onUserAdded }) => {
<Table.Row>
<Table.Cell>
<Input
placeholder="Username"
placeholder={t('login_page.field.username', 'Username')}
value={state.username}
onChange={e => updateInput(e, 'username')}
/>
</Table.Cell>
<Table.Cell>
<Input
placeholder="/path/to/photos"
placeholder={t(
'login_page.initial_setup.field.photo_path.placeholder',
'/path/to/photos'
)}
value={state.rootPath}
onChange={e => updateInput(e, 'rootPath')}
/>
@ -108,7 +113,7 @@ const AddUserRow = ({ setShow, show, onUserAdded }) => {
<Table.Cell>
<Button.Group>
<Button negative onClick={() => setShow(false)}>
Cancel
{t('general.action.cancel', 'Cancel')}
</Button>
<Button
type="submit"
@ -124,7 +129,7 @@ const AddUserRow = ({ setShow, show, onUserAdded }) => {
})
}}
>
Add User
{t('settings.users.add_user.submit', 'Add user')}
</Button>
</Button.Group>
</Table.Cell>

View File

@ -1,4 +1,5 @@
import React from 'react'
import { useTranslation } from 'react-i18next'
import { Button, Checkbox, Input, Table } from 'semantic-ui-react'
import { EditRootPaths } from './EditUserRowRootPaths'
import { UserRowProps } from './UserRow'
@ -10,6 +11,7 @@ const EditUserRow = ({
updateUser,
updateUserLoading,
}) => {
const { t } = useTranslation()
function updateInput(event, key) {
setState(state => ({
...state,
@ -52,7 +54,7 @@ const EditUserRow = ({
}))
}
>
Cancel
{t('general.action.cancel', 'Cancel')}
</Button>
<Button
loading={updateUserLoading}
@ -68,7 +70,7 @@ const EditUserRow = ({
})
}
>
Save
{t('general.action.save', 'Save')}
</Button>
</Button.Group>
</Table.Cell>

View File

@ -4,6 +4,7 @@ import { gql, useMutation } from '@apollo/client'
import { Button, Icon, Input } from 'semantic-ui-react'
import styled from 'styled-components'
import { USERS_QUERY } from './UsersTable'
import { useTranslation } from 'react-i18next'
const userAddRootPathMutation = gql`
mutation userAddRootPath($id: ID!, $rootPath: String!) {
@ -28,6 +29,7 @@ const RootPathListItem = styled.li`
`
const EditRootPath = ({ album, user }) => {
const { t } = useTranslation()
const [removeAlbumPath, { loading }] = useMutation(
userRemoveAlbumPathMutation,
{
@ -55,7 +57,7 @@ const EditRootPath = ({ album, user }) => {
}
>
<Icon name="remove" />
Remove
{t('general.action.remove', 'Remove')}
</Button>
</RootPathListItem>
)
@ -72,6 +74,7 @@ const NewRootPathInput = styled(Input)`
`
const EditNewRootPath = ({ userID }) => {
const { t } = useTranslation()
const [value, setValue] = useState('')
const [addRootPath, { loading }] = useMutation(userAddRootPathMutation, {
refetchQueries: [
@ -91,7 +94,7 @@ const EditNewRootPath = ({ userID }) => {
action={{
positive: true,
icon: 'add',
content: 'Add',
content: t('general.action.add', 'Add'),
onClick: () => {
setValue('')
addRootPath({

View File

@ -2,6 +2,7 @@ import React, { useState } from 'react'
import PropTypes from 'prop-types'
import { gql, useMutation } from '@apollo/client'
import { Button, Form, Input, Modal } from 'semantic-ui-react'
import { Trans, useTranslation } from 'react-i18next'
const changeUserPasswordMutation = gql`
mutation changeUserPassword($userId: ID!, $password: String!) {
@ -12,6 +13,7 @@ const changeUserPasswordMutation = gql`
`
const ChangePasswordModal = ({ onClose, user, ...props }) => {
const { t } = useTranslation()
const [passwordInput, setPasswordInput] = useState('')
const [changePassword] = useMutation(changeUserPasswordMutation, {
@ -22,16 +24,25 @@ const ChangePasswordModal = ({ onClose, user, ...props }) => {
return (
<Modal {...props}>
<Modal.Header>Change password</Modal.Header>
<Modal.Header>
{t('settings.users.password_reset.title', 'Change password')}
</Modal.Header>
<Modal.Content>
<p>
Change password for <b>{user.username}</b>
<Trans t={t} i18nKey="settings.users.password_reset.description">
Change password for <b>{user.username}</b>
</Trans>
</p>
<Form>
<Form.Field>
<label>New password</label>
<label>
{t('settings.users.password_reset.form.label', 'New password')}
</label>
<Input
placeholder="password"
placeholder={t(
'settings.users.password_reset.form.placeholder',
'password'
)}
onChange={e => setPasswordInput(e.target.value)}
type="password"
/>
@ -39,7 +50,9 @@ const ChangePasswordModal = ({ onClose, user, ...props }) => {
</Form>
</Modal.Content>
<Modal.Actions>
<Button onClick={() => onClose && onClose()}>Cancel</Button>
<Button onClick={() => onClose && onClose()}>
{t('general.action.cancel', 'Cancel')}
</Button>
<Button
positive
onClick={() => {
@ -51,7 +64,7 @@ const ChangePasswordModal = ({ onClose, user, ...props }) => {
})
}}
>
Change password
{t('settings.users.password_reset.form.submit', 'Change password')}
</Button>
</Modal.Actions>
</Modal>

View File

@ -5,6 +5,7 @@ import { useQuery, gql } from '@apollo/client'
import UserRow from './UserRow'
import AddUserRow from './AddUserRow'
import { SectionTitle } from '../SettingsPage'
import { useTranslation } from 'react-i18next'
export const USERS_QUERY = gql`
query settingsUsersQuery {
@ -22,6 +23,7 @@ export const USERS_QUERY = gql`
`
const UsersTable = () => {
const { t } = useTranslation()
const [showAddUser, setShowAddUser] = useState(false)
const { loading, error, data, refetch } = useQuery(USERS_QUERY)
@ -39,15 +41,23 @@ const UsersTable = () => {
return (
<div>
<SectionTitle>Users</SectionTitle>
<SectionTitle>{t('settings.users.title', 'Users')}</SectionTitle>
<Loader active={loading} />
<Table celled>
<Table.Header>
<Table.Row>
<Table.HeaderCell>Username</Table.HeaderCell>
<Table.HeaderCell>Photo path</Table.HeaderCell>
<Table.HeaderCell>Admin</Table.HeaderCell>
<Table.HeaderCell>Action</Table.HeaderCell>
<Table.HeaderCell>
{t('settings.users.table.column_names.username', 'Username')}
</Table.HeaderCell>
<Table.HeaderCell>
{t('settings.users.table.column_names.photo_path', 'Photo path')}
</Table.HeaderCell>
<Table.HeaderCell>
{t('settings.users.table.column_names.admin', 'Admin')}
</Table.HeaderCell>
<Table.HeaderCell>
{t('settings.users.table.column_names.action', 'Action')}
</Table.HeaderCell>
</Table.Row>
</Table.Header>
@ -73,7 +83,7 @@ const UsersTable = () => {
onClick={() => setShowAddUser(true)}
>
<Icon name="add" />
New user
{t('settings.users.table.new_user', 'New user')}
</Button>
</Table.HeaderCell>
</Table.Row>

View File

@ -1,4 +1,5 @@
import React from 'react'
import { Trans, useTranslation } from 'react-i18next'
import { Button, Icon, Table, Modal } from 'semantic-ui-react'
import styled from 'styled-components'
import ChangePasswordModal from './UserChangePassword'
@ -22,6 +23,7 @@ const ViewUserRow = ({
showChangePassword,
showConfirmDelete,
}) => {
const { t } = useTranslation()
const paths = (
<PathList>
{user.rootAlbums.map(album => (
@ -45,18 +47,21 @@ const ViewUserRow = ({
}}
>
<Icon name="edit" />
Edit
{t('settings.users.table.row.action.edit', 'Edit')}
</Button>
<Button
disabled={scanUserCalled}
onClick={() => scanUser({ variables: { userId: user.id } })}
>
<Icon name="sync" />
Scan
{t('settings.users.table.row.action.scan', 'Scan')}
</Button>
<Button onClick={() => setChangePassword(true)}>
<Icon name="key" />
Change password
{t(
'settings.users.table.row.action.change_password',
'Change password'
)}
</Button>
<ChangePasswordModal
user={user}
@ -70,19 +75,28 @@ const ViewUserRow = ({
}}
>
<Icon name="delete" />
Delete
{t('settings.users.table.row.action.delete', 'Delete')}
</Button>
<Modal open={showConfirmDelete}>
<Modal.Header>Delete user</Modal.Header>
<Modal.Header>
{t('settings.users.confirm_delete_user.title', 'Delete user')}
</Modal.Header>
<Modal.Content>
<p>
{`Are you sure, you want to delete `}
<b>{user.username}</b>?
</p>
<p>{`This action cannot be undone`}</p>
<Trans
t={t}
i18nKey="settings.users.confirm_delete_user.description"
>
<p>
{`Are you sure, you want to delete `}
<b>{user.username}</b>?
</p>
<p>{`This action cannot be undone`}</p>
</Trans>
</Modal.Content>
<Modal.Actions>
<Button onClick={() => setConfirmDelete(false)}>Cancel</Button>
<Button onClick={() => setConfirmDelete(false)}>
{t('general.action.cancel', 'Cancel')}
</Button>
<Button
negative
onClick={() => {
@ -94,7 +108,11 @@ const ViewUserRow = ({
})
}}
>
Delete {user.username}
{t(
'settings.users.confirm_delete_user.action',
'Delete {{user}}',
{ user: user.username }
)}
</Button>
</Modal.Actions>
</Modal>