Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(renovate): Upgrade i18next #406

Merged
merged 3 commits into from
May 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions hivemq-edge/src/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"elkjs": "^0.9.1",
"form-data": "^4.0.0",
"framer-motion": "^10.12.21",
"i18next": "^22.4.15",
"i18next": "^23.11.3",
"luxon": "^3.3.0",
"mermaid": "^10.8.0",
"monaco-editor": "^0.47.0",
Expand All @@ -77,7 +77,7 @@
"react-dom": "^18.2.0",
"react-hook-form": "^7.43.9",
"react-hotkeys-hook": "^4.5.0",
"react-i18next": "^12.3.0",
"react-i18next": "^14.1.1",
"react-icons": "^5.0.1",
"react-router-dom": "^6.11.2",
"reactflow": "^11.10.2",
Expand Down
24 changes: 13 additions & 11 deletions hivemq-edge/src/frontend/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const ColorPicker = forwardRef<ColorPickerProps, 'div'>(
isDisabled={isDisabled}
data-testid="colorPicker-trigger"
data-color-scheme={selectedColorScheme}
aria-label={t('ColorPicker.trigger', { scheme: selectedColorScheme }) as string}
aria-label={t('ColorPicker.trigger', { scheme: selectedColorScheme })}
bg={`${selectedColorScheme}.500`}
_hover={{ bg: `${selectedColorScheme}.500` }}
_active={{ bg: `${selectedColorScheme}.700` }}
Expand Down Expand Up @@ -85,7 +85,7 @@ export const ColorPicker = forwardRef<ColorPickerProps, 'div'>(
key={`color-picker-${color}-${index}`}
data-testid={`colorPicker-selector-${index}`}
data-color-scheme={color}
aria-label={t('ColorPicker.option', { scheme: color }) as string}
aria-label={t('ColorPicker.option', { scheme: color })}
onClick={() => {
setSelectedColorScheme(color)
onChange(color)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ const DateTimeRangeSelector: FC<DateTimeRangeSelectorProps> = ({ min, max, setFi
noOptionsMessage={() => t('DateTimeRangeSelector.noOptionsMessage')}
placeholder={t('DateTimeRangeSelector.placeholder')}
formatCreateLabel={(e) => t('DateTimeRangeSelector.formatCreateLabel', { date: e })}
aria-label={t('DateTimeRangeSelector.ariaLabel') as string}
aria-label={t('DateTimeRangeSelector.ariaLabel')}
isClearable={true}
isMulti={false}
components={{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { useTranslation } from 'react-i18next'
const TopicIcon: FC<IconProps> = (props) => {
const { t } = useTranslation('components')

return <Icon as={SiMqtt} boxSize={4} aria-label={t('topic.iconLabel') as string} {...props} />
return <Icon as={SiMqtt} boxSize={4} aria-label={t('topic.iconLabel')} {...props} />
}

export default TopicIcon
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ const AbstractTopicCreatableSelect = <T extends boolean>({

return (
<CreatableSelect<TopicOption, T, GroupBase<TopicOption>>
aria-label={t('topicCreate.label') as string}
placeholder={t('topicCreate.placeholder') as string}
aria-label={t('topicCreate.label')}
placeholder={t('topicCreate.placeholder')}
noOptionsMessage={() => t('topicCreate.options.noOptionsMessage')}
formatCreateLabel={(e) => t('topicCreate.options.createLabel', { topic: e })}
isLoading={isLoading}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ export const Filter = <T,>({
// value={{ value: columnFilterValue, label: columnFilterValue }}
onChange={(item) => setFilterValue(item?.value)}
options={sortedUniqueValues.map((value: string) => ({ value: value, label: value, group: 'DDD' }))}
placeholder={t('components:pagination.filter.placeholder', { size: getFacetedUniqueValues().size }) as string}
placeholder={t('components:pagination.filter.placeholder', { size: getFacetedUniqueValues().size })}
noOptionsMessage={() => t('components:pagination.filter.noOptions')}
formatCreateLabel={(e) => t('components:pagination.filter.create', { topic: e })}
aria-label={t('components:pagination.filter.label') as string}
aria-label={t('components:pagination.filter.label')}
isClearable={true}
isMulti={false}
components={{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const PaginationButton: FC<IconButtonProps> = (props) => (
const PaginationBar = <T,>({ table, pageSizes }: PaginationProps<T>) => {
const { t } = useTranslation()
return (
<HStack as="nav" aria-label={t('components:pagination.ariaLabel') as string} gap={8} mt={4}>
<HStack as="nav" aria-label={t('components:pagination.ariaLabel')} gap={8} mt={4}>
<ButtonGroup isAttached variant="ghost">
<PaginationButton
icon={<LuSkipBack />}
Expand Down
2 changes: 1 addition & 1 deletion hivemq-edge/src/frontend/src/components/PasswordInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const PasswordInput: FC<InputProps> = ({ register, options, ...rest }) => {
h="1.75rem"
size="sm"
onClick={handleClick}
aria-label={show ? (t('login.password.hide') as string) : (t('login.password.show') as string)}
aria-label={show ? t('login.password.hide') : t('login.password.show')}
>
{show ? <BiHide /> : <BiShow />}
</Button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ const DataHubPage: FC = () => {

return (
<PageContainer
title={t('page.title') as string}
subtitle={t('page.description') as string}
title={t('page.title')}
subtitle={t('page.description')}
cta={
isMainPage &&
hasDataHub && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,14 @@ const CanvasControls: FC<ControlProps> = ({ onInteractiveChange }) => {

return (
<Panel position="bottom-left">
<ButtonGroup variant="outline" isAttached size="sm" aria-label={t('workspace.controls.aria-label') as string}>
<IconButton icon={<FaPlus />} onClick={() => zoomIn()} aria-label={t('workspace.controls.zoomIn') as string} />
<IconButton
icon={<FaMinus />}
onClick={() => zoomOut()}
aria-label={t('workspace.controls.zoomIOut') as string}
/>
<IconButton
icon={<LuBoxSelect />}
onClick={() => fitView()}
aria-label={t('workspace.controls.fitView') as string}
/>
<ButtonGroup variant="outline" isAttached size="sm" aria-label={t('workspace.controls.aria-label')}>
<IconButton icon={<FaPlus />} onClick={() => zoomIn()} aria-label={t('workspace.controls.zoomIn')} />
<IconButton icon={<FaMinus />} onClick={() => zoomOut()} aria-label={t('workspace.controls.zoomIOut')} />
<IconButton icon={<LuBoxSelect />} onClick={() => fitView()} aria-label={t('workspace.controls.fitView')} />
<IconButton
icon={isInteractive ? <FaLock /> : <FaLockOpen />}
onClick={onToggleInteractivity}
aria-label={t('workspace.controls.toggleInteractivity') as string}
aria-label={t('workspace.controls.toggleInteractivity')}
/>
<DesignerCheatSheet />
</ButtonGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const DesignerCheatSheet: FC = () => {
<IconButton
icon={<LuBadgeHelp />}
onClick={onOpen}
aria-label={t('workspace.controls.shortcuts') as string}
aria-label={t('workspace.controls.shortcuts')}
data-testid="canvas-control-help"
/>
<Modal isOpen={isOpen} onClose={onClose} size="2xl" isCentered motionPreset="scale" scrollBehavior="inside">
Expand All @@ -67,7 +67,7 @@ const DesignerCheatSheet: FC = () => {
<ListItem key={`${group}-${item.key}`}>
<ShortcutRenderer
hotkeys={item.key}
description={t(`shortcuts.keys.${item.key}`, { context: item.category }) as string}
description={t(`shortcuts.keys.${item.key}`, { context: item.category })}
/>
</ListItem>
))}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const ToolboxNodes: FC<DesignerToolBoxProps> = () => {
pb={2}
gap={5}
role="group"
aria-label={t('workspace.toolbox.aria-label') as string}
aria-label={t('workspace.toolbox.aria-label')}
backgroundColor="var(--chakra-colors-chakra-body-bg)"
>
<ButtonGroup variant="outline" size="sm" aria-labelledby="group-integrations">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const MessageInterpolationTextArea = (props: WidgetProps) => {
id={props.id}
labelId={`${props.id}-label`}
isRequired={props.required}
placeholder={t('workspace.function.message.placeholder') as string}
placeholder={t('workspace.function.message.placeholder')}
value={props.value}
onChange={onChange}
isInvalid={props.rawErrors && props.rawErrors.length > 0}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const PrefixInput = (prefix: string, placeholder: string, props: WidgetProps) =>
<Input
id={props.id}
isRequired={props.required}
placeholder={t(placeholder) as string}
placeholder={t(placeholder)}
value={props.value}
onBlur={onBlur}
onFocus={onFocus}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const LicenseWarning: FC = () => {
return (
<Flex flexDirection="column" alignItems="center" gap={4} textAlign="center">
<Circle size="335" bg="gray.100">
<Image objectFit="cover" src={AdapterEmptyLogo} alt={t('brand.extension') as string} />
<Image objectFit="cover" src={AdapterEmptyLogo} alt={t('brand.extension')} />
</Circle>

<Heading as="h2" size="md" color="gray.500">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const NodeIcon: FC<NodeIconProps> = ({ type }) => {
const { t } = useTranslation('datahub')

if (!type || !iconMapping[type]) {
return <Icon as={GrStatusUnknown} boxSize="24px" aria-label={t('workspace.nodes.type') as string} />
return <Icon as={GrStatusUnknown} boxSize="24px" aria-label={t('workspace.nodes.type')} />
}
return iconMapping[type](t('workspace.nodes.type', { context: type }))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const PolicySummaryReport: FC<PolicySummaryReportProps> = ({ status, onOpenPubli
<ConditionalWrapper
condition={status === PolicyDryRunStatus.SUCCESS}
wrapper={(children) => (
<Link aria-label={t('workspace.toolbox.navigation.goPublish') as string} onClick={onOpenPublish}>
<Link aria-label={t('workspace.toolbox.navigation.goPublish')} onClick={onOpenPublish}>
{children}
</Link>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ const PolicyEditor: FC = () => {

// onError={(id: string, message: string) => console.log('XXXXXX e', id, message)}
>
<Box role="toolbar" aria-label={t('workspace.aria-label') as string} aria-controls="edge-workspace-canvas">
<Box role="toolbar" aria-label={t('workspace.aria-label')} aria-controls="edge-workspace-canvas">
<ToolboxSelectionListener />
<CopyPasteListener render={(copiedNodes) => <CopyPasteStatus nbCopied={copiedNodes.length} />} />
<DesignerToolbox />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ export const DataPolicyLoader: FC<PolicyLoaderProps> = ({ policyId }) => {
}, [dataPolicy, schemas, scripts, t, toast])

if (isDataPolicyLoading || isScriptLoading || isSchemaLoading) return <Spinner />
if (isDataPolicyError) return <ErrorMessage type={t('error.notDefined.title') as string} message={error?.message} />
if (isScriptError) return <ErrorMessage type={t('error.notDefined.title') as string} message={scriptError?.message} />
if (isSchemaError) return <ErrorMessage type={t('error.notDefined.title') as string} message={schemaError?.message} />
if (isDataPolicyError) return <ErrorMessage type={t('error.notDefined.title')} message={error?.message} />
if (isScriptError) return <ErrorMessage type={t('error.notDefined.title')} message={scriptError?.message} />
if (isSchemaError) return <ErrorMessage type={t('error.notDefined.title')} message={schemaError?.message} />

return <PolicyEditor />
}
Expand Down Expand Up @@ -154,9 +154,9 @@ export const BehaviorPolicyLoader: FC<PolicyLoaderProps> = ({ policyId }) => {
}, [behaviorPolicy, schemas, scripts, t, toast])

if (isPolicyLoading || isScriptLoading || isSchemaLoading) return <Spinner />
if (isPolicyError) return <ErrorMessage type={t('error.notDefined.title') as string} message={error?.message} />
if (isScriptError) return <ErrorMessage type={t('error.notDefined.title') as string} message={scriptError?.message} />
if (isSchemaError) return <ErrorMessage type={t('error.notDefined.title') as string} message={schemaError?.message} />
if (isPolicyError) return <ErrorMessage type={t('error.notDefined.title')} message={error?.message} />
if (isScriptError) return <ErrorMessage type={t('error.notDefined.title')} message={scriptError?.message} />
if (isSchemaError) return <ErrorMessage type={t('error.notDefined.title')} message={schemaError?.message} />
return <PolicyEditor />
}

Expand All @@ -165,23 +165,13 @@ const PolicyEditorLoader: FC = () => {
const { policyType, policyId } = useParams()

if (!policyType || !(policyType in PolicyType))
return (
<ErrorMessage
type={t('error.notDefined.title') as string}
message={t('error.notDefined.description') as string}
/>
)
return <ErrorMessage type={t('error.notDefined.title')} message={t('error.notDefined.description')} />

if (policyId) {
if (policyType === PolicyType.DATA_POLICY) return <DataPolicyLoader policyId={policyId} />
if (policyType === PolicyType.BEHAVIOR_POLICY) return <BehaviorPolicyLoader policyId={policyId} />

return (
<ErrorMessage
type={t('error.notDefined.title') as string}
message={t('error.notDefined.description') as string}
/>
)
return <ErrorMessage type={t('error.notDefined.title')} message={t('error.notDefined.description')} />
}

return <PolicyEditor />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ const PolicyTable: FC<DataHubTableProps> = ({ onDeleteItem }) => {
</Skeleton>
)
},
header: t('Listings.policy.header.type') as string,
header: t('Listings.policy.header.type'),
},
{
accessorKey: 'matching',
Expand All @@ -111,7 +111,7 @@ const PolicyTable: FC<DataHubTableProps> = ({ onDeleteItem }) => {
</Skeleton>
)
},
header: t('Listings.policy.header.matching') as string,
header: t('Listings.policy.header.matching'),
},
{
accessorKey: 'createdAt',
Expand All @@ -122,11 +122,11 @@ const PolicyTable: FC<DataHubTableProps> = ({ onDeleteItem }) => {
<DateTimeRenderer date={DateTime.fromMillis(info.getValue() as number)} isApprox />
</Skeleton>
),
header: t('Listings.policy.header.created') as string,
header: t('Listings.policy.header.created'),
},
{
id: 'actions',
header: t('Listings.policy.header.actions') as string,
header: t('Listings.policy.header.actions'),
sortingFn: undefined,
cell: (info) => {
return (
Expand Down
Loading
Loading