Skip to content

Commit

Permalink
make i18n keys that dont match the config keys are clearly distinct f…
Browse files Browse the repository at this point in the history
…rom config and update snapshot
  • Loading branch information
fiskus committed Jan 10, 2025
1 parent e2a4a62 commit 3014295
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,6 @@ const I18N = {
'ui.actions.revisePackage': '"REVISE PACKAGE" on the package page',
'ui.actions.writeFile': 'Buttons to create or edit files',

'ui.qurator': 'Qurator',

'ui.athena': 'Athena',
'ui.athena.defaultWorkgroup': 'Default workgroup for Athena queries',

Expand All @@ -196,10 +194,6 @@ const I18N = {
'ui.blocks.meta': '"METADATA"',
'ui.blocks.qurator': 'Qurator assistance',

'ui.blocks.meta.*.expanded': {
title: 'Metadata on the package page',
description: 'Auto-expand JSON blocks in Metadata section',
},
'ui.blocks.meta.user_meta.expanded': 'User metadata',
'ui.blocks.meta.workflows.expanded': 'Workflow',

Expand All @@ -226,8 +220,17 @@ const I18N = {
title: 'Package List: selective display settings',
description: 'Selectively apply display settings to matching packages',
},
'ui.package_description.all': 'Package List: common display settings',
'ui.package_description.multiline': 'Display `user_meta` fields on separate lines',

// NOTE: Combine all meta.*.expanded keys into one group
'custom_group.expanded_meta': {
title: 'Metadata on the package page',
description: 'Auto-expand JSON blocks in Metadata section',
},

// NOTE: Additional group keys that not in the original config
'custom_group.qurator': 'Qurator',
'custom_group.common_package_description': 'Package List: common display settings',
}

function i18n(key: string): string | { title: string; description: string } {
Expand Down Expand Up @@ -330,7 +333,7 @@ function Group({ className, config, disabled, id, onChange, values }: GroupProps
const description = typeof groupI18n !== 'string' && groupI18n.description
const layout = React.useMemo(() => {
switch (id) {
case 'ui.blocks.meta.*.expanded':
case 'custom_group.expanded_meta':
case 'ui.nav':
case 'ui.package_description':
return 1
Expand Down Expand Up @@ -387,15 +390,21 @@ const useStyles = M.makeStyles((t) => ({
},
}))

// Group keys so 'a.b.c', and 'a.b.d' are in the same 'a.b' group
// Also, move some config keys into standalone groups
// or combine some keys into a new group
function parseGroupKey(key: keyof Config): keyof typeof I18N {
if (key === 'ui.package_description.multiline') {
return 'ui.package_description.all'
}
if (key === 'ui.blocks.qurator') {
return 'ui.qurator'
// NOTE: Move 'ui.blocks.qurator' into a standalone group with 'ui.qurator' title
return 'custom_group.qurator'
}
if (key === 'ui.package_description.multiline') {
// NOTE: Move into a standalone group
return 'custom_group.common_package_description'
}
if (key.match(/ui\.blocks\.meta\..*\.expanded/)) {
return 'ui.blocks.meta.*.expanded'
// NOTE: Combine into a group
return 'custom_group.expanded_meta'
}
const keyParts = key.split('.')
if (keyParts.length > 2) {
Expand Down Expand Up @@ -425,7 +434,7 @@ export default function BucketPreferences({
[groupKey]: [...(memo[groupKey] || []), value],
}
},
{} as Record<string, KeyedValue[]>,
{} as Record<keyof typeof I18N, KeyedValue[]>,
),
[config],
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ exports[`components/FileEditor/QuiltConfigEditor/BucketPreferences/BucketPrefere
<p
className="MuiTypography-root helperText MuiTypography-body2"
>
Configuration for Catalog UI: show and hide features, set default values. See
Per-bucket Catalog UI configuration: show and hide features, set default values.
<a
className="root"
href="https://docs.quiltdata.com/quilt-platform-administrator/preferences"
target="_blank"
>
the docs
Learn more
</a>
</p>
<div
Expand All @@ -27,7 +27,7 @@ exports[`components/FileEditor/QuiltConfigEditor/BucketPreferences/BucketPrefere
<p
className="MuiTypography-root description MuiTypography-body2"
>
Show or hide buttons in the UI
Show buttons and menu items
</p>
</h6>
<div
Expand Down Expand Up @@ -93,7 +93,7 @@ exports[`components/FileEditor/QuiltConfigEditor/BucketPreferences/BucketPrefere
<span
className="MuiTypography-root MuiFormControlLabel-label MuiTypography-body1"
>
Download buttons for files in a "BUCKET" tab
Download buttons under the "BUCKET" tab
</span>
</label>
</div>
Expand All @@ -109,7 +109,7 @@ exports[`components/FileEditor/QuiltConfigEditor/BucketPreferences/BucketPrefere
<span
className="MuiTypography-root MuiFormControlLabel-label MuiTypography-body1"
>
Download buttons for files in a "PACKAGE" tab
Download buttons under the "PACKAGES" tab
</span>
</label>
</div>
Expand Down Expand Up @@ -157,7 +157,7 @@ exports[`components/FileEditor/QuiltConfigEditor/BucketPreferences/BucketPrefere
<p
className="MuiTypography-root description MuiTypography-body2"
>
Show or hide sections in the UI
Show UI sections
</p>
</h6>
<div
Expand Down Expand Up @@ -235,7 +235,7 @@ exports[`components/FileEditor/QuiltConfigEditor/BucketPreferences/BucketPrefere
<h6
className="MuiTypography-root title MuiTypography-h6"
>
Metadata in the package list
Metadata on the package page
<p
className="MuiTypography-root description MuiTypography-body2"
>
Expand Down Expand Up @@ -285,11 +285,11 @@ exports[`components/FileEditor/QuiltConfigEditor/BucketPreferences/BucketPrefere
<h6
className="MuiTypography-root title MuiTypography-h6"
>
Gallery
Galleries
<p
className="MuiTypography-root description MuiTypography-body2"
>
Show or hide image galleries
Show image galleries
</p>
</h6>
<div
Expand Down Expand Up @@ -384,7 +384,7 @@ exports[`components/FileEditor/QuiltConfigEditor/BucketPreferences/BucketPrefere
<span
className="MuiTypography-root MuiFormControlLabel-label MuiTypography-body1"
>
Enable Qurator assistance
Qurator assistance
</span>
</label>
</div>
Expand All @@ -400,7 +400,7 @@ exports[`components/FileEditor/QuiltConfigEditor/BucketPreferences/BucketPrefere
<p
className="MuiTypography-root description MuiTypography-body2"
>
Show or hide tabs at the top of the bucket pages
Show tabs at the top of the bucket pages
</p>
</h6>
<div
Expand Down Expand Up @@ -466,7 +466,7 @@ exports[`components/FileEditor/QuiltConfigEditor/BucketPreferences/BucketPrefere
<p
className="MuiTypography-root description MuiTypography-body2"
>
List of these buckets will be offered when users click on "ADD FILES FROM BUCKET" in Revise Package dialog
Buckets available in package creation and revision dialogs under "ADD FILES FROM BUCKET"
</p>
</h6>
<div
Expand Down Expand Up @@ -504,11 +504,11 @@ exports[`components/FileEditor/QuiltConfigEditor/BucketPreferences/BucketPrefere
<h6
className="MuiTypography-root title MuiTypography-h6"
>
Package list appearance (per package settings)
Package List: selective display settings
<p
className="MuiTypography-root description MuiTypography-body2"
>
Match packages with RegExp or implicitly use package names
Selectively apply display settings to matching packages
</p>
</h6>
<div
Expand Down Expand Up @@ -590,7 +590,7 @@ exports[`components/FileEditor/QuiltConfigEditor/BucketPreferences/BucketPrefere
<h6
className="MuiTypography-root title MuiTypography-h6"
>
Package list appearance (all packages)
Package List: common display settings
</h6>
<div
className="layout"
Expand All @@ -607,7 +607,7 @@ exports[`components/FileEditor/QuiltConfigEditor/BucketPreferences/BucketPrefere
<span
className="MuiTypography-root MuiFormControlLabel-label MuiTypography-body1"
>
Display \`user_meta\` on multiple lines
Display \`user_meta\` fields on separate lines
</span>
</label>
</div>
Expand Down

0 comments on commit 3014295

Please sign in to comment.