Skip to content

Commit 2ca7cf0

Browse files
authored
Merge branch 'master' into PS-927-rendition-ph
2 parents 7bc8e91 + b87373e commit 2ca7cf0

File tree

14 files changed

+784
-151
lines changed

14 files changed

+784
-151
lines changed

databox/api/src/Integration/Aws/Translate/TranslateAction.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,11 @@ public function doHandle(RunContext $context): void
9797

9898
foreach ($attributesSources as $attribute) {
9999
$text = $attribute->getValue();
100+
101+
if (empty($text)) {
102+
continue;
103+
}
104+
100105
$toTranslates[] = [
101106
'text' => $text,
102107
'sourceLanguage' => $sourceLanguage,
Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,23 @@
11
field_type:
2-
types:
3-
text: Text
4-
textarea: Textarea
5-
json: JSON
6-
ip: IP
7-
code: Code
8-
html: HTML
9-
boolean: Boolean
10-
color: Color
11-
keyword: Keyword
12-
number: Number
13-
date: Date
14-
date_time: Date & Time
15-
geo_point: Geo point
16-
entity: Entity
17-
2+
types:
3+
text: Text
4+
textarea: Textarea
5+
json: JSON
6+
ip: IP
7+
code: Code
8+
html: HTML
9+
boolean: Boolean
10+
color: Color
11+
keyword: Keyword
12+
number: Number
13+
date: Date
14+
date_time: 'Date & Time'
15+
geo_point: 'Geo point'
16+
entity: Entity
1817
privacy:
1918
secret: Secret
20-
private_in_workspace: Private in workspace
21-
public_in_workspace: Public in workspace
19+
private_in_workspace: 'Private in workspace'
20+
public_in_workspace: 'Public in workspace'
2221
private: Private
23-
public_for_users: Public for users
22+
public_for_users: 'Public for users'
2423
public: Public

databox/api/translations/messages.fr.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
field_type:
22
types:
3-
text: Text
4-
textarea: Textarea
3+
text: Texte
4+
textarea: Zone de texte
55
json: JSON
66
ip: IP
77
code: Code
88
html: HTML
9-
boolean: Boolean
10-
color: Color
11-
keyword: Keyword
12-
number: Number
9+
boolean: Booléen
10+
color: Couleur
11+
keyword: Mot-clé
12+
number: Nombre
1313
date: Date
14-
date_time: Date & Time
14+
date_time: Date et Heure
1515
geo_point: Geo point
1616

1717
entity: Entité
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import {useTranslation} from 'react-i18next';
2+
import {AclPermission} from './acl';
3+
4+
export default function useAclPermissionLabels(): Record<string, string> {
5+
const {t} = useTranslation();
6+
7+
return {
8+
[AclPermission.VIEW]: t('acl.permission.view', 'VIEW'),
9+
[AclPermission.SHARE]: t('acl.permission.share', 'SHARE'),
10+
[AclPermission.CREATE]: t('acl.permission.create', 'CREATE'),
11+
[AclPermission.EDIT]: t('acl.permission.edit', 'EDIT'),
12+
[AclPermission.DELETE]: t('acl.permission.delete', 'DELETE'),
13+
[AclPermission.UNDELETE]: t('acl.permission.undelete', 'UNDELETE'),
14+
[AclPermission.OPERATOR]: t('acl.permission.operator', 'OPERATOR'),
15+
[AclPermission.MASTER]: t('acl.permission.master', 'MASTER'),
16+
[AclPermission.OWNER]: t('acl.permission.owner', 'OWNER'),
17+
[AclPermission.ALL]: t('acl.permission.all', 'ALL'),
18+
};
19+
}

databox/client/src/components/AttributeEntity/AttributeEntityFields.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ export default function AttributeEntityFields({
6969
) : null}
7070
<FormRow>
7171
<InputLabel>
72-
{t('form.attribute_entity.synonym.label', 'Synonyms')}
72+
{t('form.attribute_entity.synonyms.label', 'Synonyms')}
7373
</InputLabel>
7474
<KeyTranslationsWidget
7575
renderLocale={l => {

databox/client/src/components/Form/AssetDataTemplateSelect.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
AsyncRSelectProps,
88
SelectOption,
99
} from '@alchemy/react-form';
10+
import {useTranslation} from 'react-i18next';
1011

1112
const Option = (props: OptionProps<SelectOption>) => {
1213
return (
@@ -48,6 +49,8 @@ export default function AssetDataTemplateSelect<
4849
);
4950
};
5051

52+
const {t} = useTranslation();
53+
5154
return (
5255
<AsyncRSelectWidget<TFieldValues, true>
5356
key={`${workspaceId}-${collectionId ?? ''}`}
@@ -58,6 +61,9 @@ export default function AssetDataTemplateSelect<
5861
isMulti={true as any}
5962
closeMenuOnSelect={false}
6063
hideSelectedOptions={false}
64+
noOptionsMessage={() =>
65+
t('form.asset.templates.no_options', `No template available`)
66+
}
6167
/>
6268
);
6369
}

databox/client/src/components/Form/PrivacyWidget.tsx

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,27 @@ const choices: {[key: string]: {label: string; helper?: string}} = {
1818
public: {label: 'Public'},
1919
};
2020

21+
function getChoicesTranslated(
22+
t: (...args: any) => any,
23+
key: string
24+
): {label: string; helper?: string} {
25+
switch (key) {
26+
default:
27+
case 'secret':
28+
return {label: t('form.privacy.choices.secret', 'Secret')};
29+
case 'private':
30+
return {
31+
label: t('form.privacy.choices.private', 'Private'),
32+
helper: t(
33+
'form.privacy.choices.helpers.private',
34+
'Users can request access'
35+
),
36+
};
37+
case 'public':
38+
return {label: t('form.privacy.choices.public', 'Public')};
39+
}
40+
}
41+
2142
function getValue(value: string, workspace: boolean, auth: boolean): number {
2243
switch (value) {
2344
default:
@@ -150,6 +171,10 @@ export default function PrivacyWidget({
150171
onChange={handlePChange}
151172
>
152173
{Object.keys(choices).map(k => {
174+
const choice = getChoicesTranslated(t, k);
175+
const label = choice.label;
176+
const helper = choice.helper;
177+
153178
return (
154179
<MenuItem
155180
key={k}
@@ -161,8 +186,8 @@ export default function PrivacyWidget({
161186
}
162187
>
163188
<ListItemText
164-
primary={choices[k].label}
165-
secondary={choices[k].helper}
189+
primary={label}
190+
secondary={helper}
166191
/>
167192
</MenuItem>
168193
);

databox/client/src/components/Media/Asset/AssetInfoList.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ export default function AssetInfoList({data}: Props) {
7575
label={t('asset.info.collection', `Collection`)}
7676
value={
7777
data.referenceCollection?.absoluteTitleTranslated ??
78-
t('asset.info.collection.none', 'None')
78+
t('asset.info.collections.none', 'None')
7979
}
8080
copyValue={data.referenceCollection?.id}
8181
onClick={

databox/client/src/components/Media/TagFilterRule/FilterRule.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ export default function FilterRule({
161161
<FormRow>
162162
<FormGroup>
163163
<FormLabel>
164-
<Trans key={'filter_rule.include.label'}>
164+
<Trans i18nKey="filter_rule.include.label">
165165
Tags to <b>include</b>
166166
</Trans>
167167
</FormLabel>
@@ -191,7 +191,9 @@ export default function FilterRule({
191191
<FormRow>
192192
<FormGroup>
193193
<FormLabel>
194-
<Trans key={'filter_rule.exclude.label'}>
194+
<Trans
195+
i18nKey={'filter_rule.exclude.label'}
196+
>
195197
Tags to <b>exclude</b>
196198
</Trans>
197199
</FormLabel>

databox/client/src/components/Permissions/PermissionTable.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
import {Ace, UserType} from '../../types';
77
import {useTranslation} from 'react-i18next';
88
import {AclPermission, aclPermissions} from '../Acl/acl';
9+
import useAclPermissionLabels from '../Acl/AclPermissionLabel';
910
import {Box} from '@mui/material';
1011
import PermissionRow from './PermissionRow';
1112
import type {TFunction} from '@alchemy/i18n';
@@ -23,17 +24,16 @@ type Props = {
2324
onMaskChange: OnMaskChange;
2425
onDelete: OnPermissionDelete;
2526
displayedPermissions?: DisplayedPermissions;
26-
permissionHelper?: PermissionHelpers;
2727
};
2828

2929
export default function PermissionTable({
3030
permissions,
3131
onMaskChange,
3232
onDelete,
3333
displayedPermissions,
34-
permissionHelper,
3534
}: Props) {
3635
const {t} = useTranslation();
36+
const permissionLabels = useAclPermissionLabels();
3737

3838
const columns = displayedPermissions
3939
? Object.keys(aclPermissions).filter(c =>
@@ -100,7 +100,7 @@ export default function PermissionTable({
100100
{allColumns.map(k => {
101101
return (
102102
<th key={k} className={'p'}>
103-
<span>{permissionHelper?.[k]?.label ?? k}</span>
103+
<span>{permissionLabels[k]}</span>
104104
</th>
105105
);
106106
})}

0 commit comments

Comments
 (0)