Skip to content

Commit

Permalink
Merge pull request openshift#8279 from zherman0/con-a-d
Browse files Browse the repository at this point in the history
CONSOLE-2772: Consolidate A-D i18n namespaces
  • Loading branch information
openshift-merge-robot authored Apr 29, 2021
2 parents 2a62cfb + 16f8978 commit 3f1db37
Show file tree
Hide file tree
Showing 70 changed files with 677 additions and 858 deletions.
4 changes: 2 additions & 2 deletions frontend/__tests__/components/cluster-settings.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jest.mock('react-redux', () => {
};
});

const i18nNS = 'cluster-settings';
const i18nNS = 'public';

describe('Cluster Settings page', () => {
let wrapper: ShallowWrapper<any>;
Expand Down Expand Up @@ -327,7 +327,7 @@ describe('Updates Graph', () => {
.find(ChannelName)
.at(1)
.text(),
).toBe('cluster-settings~{{newerChannel}} channel');
).toBe('public~{{newerChannel}} channel');
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export class CreateOBCHandler {
}

deploymentReady(deploymentName: string) {
cy.byLegacyTestID('horizontal-link-details-page~Details').click();
cy.byLegacyTestID('horizontal-link-public~Details').click();
cy.contains(DEPLOYMENT_REPLICAS_STATUS);
cy.byTestSelector('details-item-value__Name')
.should('be.visible')
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"Not available": "Not available"
}
40 changes: 39 additions & 1 deletion frontend/packages/console-shared/locales/en/console-shared.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,49 @@
{
"An error occurred": "An error occurred",
"No resources found": "No resources found",
"Started": "Started",
"There are no recent events.": "There are no recent events.",
"View all events": "View all events",
"Resume": "Resume",
"Pause": "Pause",
"Recent events": "Recent events",
"There are no ongoing activities.": "There are no ongoing activities.",
"Ongoing": "Ongoing",
"Not available": "Not available",
"1 hour": "1 hour",
"6 hours": "6 hours",
"24 hours": "24 hours",
"No resource quotas": "No resource quotas",
"View details": "View details",
"Alerts could not be loaded.": "Alerts could not be loaded.",
"({{operatorStatusLength}} installed)": "({{operatorStatusLength}} installed)",
"Status": "Status",
"Not available": "Not available",
"View all": "View all",
"All {{status}}": "All {{status}}",
"Unknown": "Unknown",
"Pending": "Pending",
"Updating": "Updating",
"Degraded": "Degraded",
"Loading": "Loading",
"{{title}} breakdown": "{{title}} breakdown",
"Total capacity": "Total capacity",
"Total limit": "Total limit",
"Current utilization": "Current utilization",
"Current available capacity": "Current available capacity",
"Total requested": "Total requested",
"By {{label}}": "By {{label}}",
"Top consumer by {{label}}": "Top consumer by {{label}}",
"View more": "View more",
"Top {{label}} consumers": "Top {{label}} consumers",
"Top consumers": "Top consumers",
"Select consumer type": "Select consumer type",
"time axis": "time axis",
"Resource": "Resource",
"Usage": "Usage",
"View {{title}} metrics in query browser": "View {{title}} metrics in query browser",
"{{humanAvailable}} available of {{humanLimit}} total limit": "{{humanAvailable}} available of {{humanLimit}} total limit",
"{{humanAvailable}} available of {{humanMax}}": "{{humanAvailable}} available of {{humanMax}}",
"{{humanAvailable}} available": "{{humanAvailable}} available",
"Error loading - {{placeholder}}": "Error loading - {{placeholder}}",
"Value": "Value",
"Resource requirements": "Resource requirements",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const Activity: React.FC<ActivityProps> = ({ timestamp, children }) => {
<div className="co-activity-item__ongoing" data-test="activity">
{timestamp && (
<span className="text-secondary">
{t('dashboard~Started')}{' '}
{t('console-shared~Started')}{' '}
<span data-test="timestamp">
<Timestamp simple timestamp={timestamp.toString()} />
</span>
Expand Down Expand Up @@ -91,7 +91,7 @@ export const RecentEventsBodyContent: React.FC<RecentEventsBodyContentProps> = (
if (sortedEvents.length === 0) {
return (
<Activity>
<div className="text-secondary">{t('dashboard~There are no recent events.')}</div>
<div className="text-secondary">{t('console-shared~There are no recent events.')}</div>
</Activity>
);
}
Expand All @@ -112,7 +112,7 @@ export const RecentEventsBodyContent: React.FC<RecentEventsBodyContentProps> = (
to={moreLink}
data-test="events-view-all-link"
>
{t('dashboard~View all events')}
{t('console-shared~View all events')}
</Link>
)}
</>
Expand All @@ -129,7 +129,7 @@ export const PauseButton: React.FC<PauseButtonProps> = ({ paused, togglePause })
data-test-id="events-pause-button"
data-test="events-pause-button"
>
{paused ? t('public~Resume') : t('public~Pause')}
{paused ? t('console-shared~Resume') : t('console-shared~Pause')}
</DashboardCardButtonLink>
);
};
Expand All @@ -141,7 +141,7 @@ export const RecentEventsBody: React.FC<RecentEventsBodyProps> = (props) => {
return (
<>
<div className="co-activity-card__recent-title" data-test="activity-recent-title">
{t('dashboard~Recent events')}
{t('console-shared~Recent events')}
<PauseButton paused={paused} togglePause={togglePause} />
</div>
<RecentEventsBodyContent {...props} paused={paused} setPaused={setPaused} />
Expand Down Expand Up @@ -184,14 +184,14 @@ export const OngoingActivityBody: React.FC<OngoingActivityBodyProps> = ({
allActivities
) : (
<Activity>
<div className="text-secondary">{t('dashboard~There are no ongoing activities.')}</div>
<div className="text-secondary">{t('console-shared~There are no ongoing activities.')}</div>
</Activity>
);
}
return (
<>
<div className="co-activity-card__ongoing-title" data-test="ongoing-title">
{t('dashboard~Ongoing')}
{t('console-shared~Ongoing')}
</div>
<div className="co-activity-card__ongoing-body">{body}</div>
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const DetailItem: React.FC<DetailItemProps> = React.memo(

if (error) {
status = (
<span className="text-secondary">{errorMessage || t('dashboard~Not available')}</span>
<span className="text-secondary">{errorMessage || t('console-shared~Not available')}</span>
);
} else if (isLoading) {
status = <div className="skeleton-text" />;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@ import { TFunction } from 'i18next';

export const Duration = (t: TFunction) => {
return {
ONE_HR: t('public~1 hour'),
SIX_HR: t('public~6 hours'),
TWENTY_FOUR_HR: t('public~24 hours'),
ONE_HR: t('console-shared~1 hour'),
SIX_HR: t('console-shared~6 hours'),
TWENTY_FOUR_HR: t('console-shared~24 hours'),
};
};

export const TranslatedDuration = (duration, t: TFunction): string => {
switch (duration) {
case 'ONE_HR':
return t('public~1 hour');
return t('console-shared~1 hour');
case 'SIX_HR':
return t('public~6 hours');
return t('console-shared~6 hours');
default:
return t('public~24 hours');
return t('console-shared~24 hours');
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export const InventoryItem: React.FC<InventoryItemProps> = React.memo(
<div className="co-inventory-card__item-status">
{error ? (
<div className="co-dashboard-text--small text-secondary">
{t('dashboard~Not available')}
{t('console-shared~Not available')}
</div>
) : (
children
Expand All @@ -124,7 +124,7 @@ export const InventoryItem: React.FC<InventoryItemProps> = React.memo(
<div className="co-inventory-card__item-status">
{error ? (
<div className="co-dashboard-text--small text-secondary">
{t('dashboard~Not available')}
{t('console-shared~Not available')}
</div>
) : (
children
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ const ResourceQuotaBody: React.FC<ResourceQuotaBodyProps> = ({ error, isLoading,
let body: React.ReactNode;
const { t } = useTranslation();
if (error) {
body = <div className="text-secondary">{t('dashboard~Not available')}</div>;
body = <div className="text-secondary">{t('console-shared~Not available')}</div>;
} else if (isLoading) {
body = <div className="skeleton-quota" />;
} else if (!React.Children.count(children)) {
body = <div className="text-secondary">{t('dashboard~No resource quotas')}</div>;
body = <div className="text-secondary">{t('console-shared~No resource quotas')}</div>;
}

return <div className="co-dashboard-card__body--top-margin">{body || children}</div>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const AlertItem: React.FC<AlertItemProps> = ({ alert }) => {
{text}
</Button>
) : (
<Link to={alertURL(alert, alert.rule.id)}>{t('dashboard~View details')}</Link>
<Link to={alertURL(alert, alert.rule.id)}>{t('console-shared~View details')}</Link>
)}
</StatusItem>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const AlertsBody: React.FC<AlertsBodyProps> = ({ error = false, children }) => {
{error ? (
<EmptyState variant={EmptyStateVariant.full} className="co-status-card__alerts-msg">
<EmptyStateIcon className="co-status-card__alerts-icon" icon={UnknownIcon} />
<EmptyStateBody>{t('dashboard~Alerts could not be loaded.')}</EmptyStateBody>
<EmptyStateBody>{t('console-shared~Alerts could not be loaded.')}</EmptyStateBody>
</EmptyState>
) : (
children
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,21 @@ export const healthStateMessage = (state: keyof typeof HealthState, t: TFunction
case HealthState.OK:
return '';
case HealthState.UNKNOWN:
return t('dashboard~Unknown');
return t('console-shared~Unknown');
case HealthState.PROGRESS:
return t('dashboard~Pending');
return t('console-shared~Pending');
case HealthState.UPDATING:
return t('dashboard~Updating');
return t('console-shared~Updating');
case HealthState.WARNING:
return t('dashboard~Degraded');
return t('console-shared~Degraded');
case HealthState.ERROR:
return t('dashboard~Degraded');
return t('console-shared~Degraded');
case HealthState.LOADING:
return t('dashboard~Loading');
return t('console-shared~Loading');
case HealthState.NOT_AVAILABLE:
return t('dashboard~Not available');
return t('console-shared~Not available');
default:
return t('dashboard~Unknown');
return t('console-shared~Unknown');
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const ConsumerPopover: React.FC<ConsumerPopoverProps> = React.memo(
const [isOpen, setOpen] = React.useState(false);
return (
<DashboardCardPopupLink
popupTitle={t('dashboard~{{title}} breakdown', { title })}
popupTitle={t('console-shared~{{title}} breakdown', { title })}
linkTitle={current}
onHide={React.useCallback(() => setOpen(false), [])}
onShow={React.useCallback(() => setOpen(true), [])}
Expand Down Expand Up @@ -88,14 +88,14 @@ export const LimitsBody: React.FC<LimitsBodyProps> = ({
((!!limitState && limitState !== LIMIT_STATE.OK) ||
(!!requestedState && requestedState !== LIMIT_STATE.OK)) && (
<ul className="co-utilization-card-popover__consumer-list">
<Status value={total}>{t('dashboard~Total capacity')}</Status>
<Status value={total}>{t('console-shared~Total capacity')}</Status>
<Status value={limit} icon={getLimitIcon(limitState)}>
{t('dashboard~Total limit')}
{t('console-shared~Total limit')}
</Status>
<Status value={current}>{t('dashboard~Current utilization')}</Status>
<Status value={available}>{t('dashboard~Current available capacity')}</Status>
<Status value={current}>{t('console-shared~Current utilization')}</Status>
<Status value={available}>{t('console-shared~Current available capacity')}</Status>
<Status value={requested} icon={getLimitIcon(requestedState)}>
{t('dashboard~Total requested')}
{t('console-shared~Total requested')}
</Status>
</ul>
)
Expand Down Expand Up @@ -171,7 +171,7 @@ export const PopoverBody = withDashboardResources<DashboardItemProps & PopoverBo
const dropdownItems = React.useMemo(
() =>
consumers.reduce((items, curr) => {
items[referenceForModel(curr.model)] = t('dashboard~By {{label}}', {
items[referenceForModel(curr.model)] = t('console-shared~By {{label}}', {
label: curr.model.label,
});
return items;
Expand All @@ -191,7 +191,7 @@ export const PopoverBody = withDashboardResources<DashboardItemProps & PopoverBo

let body: React.ReactNode;
if (error || consumersLoadError) {
body = <div className="text-secondary">{t('public~Not available')}</div>;
body = <div className="text-secondary">{t('console-shared~Not available')}</div>;
} else if (!consumerLoaded || !data) {
body = (
<ul className="co-utilization-card-popover__consumer-list">
Expand All @@ -207,7 +207,7 @@ export const PopoverBody = withDashboardResources<DashboardItemProps & PopoverBo
<>
<ul
className="co-utilization-card-popover__consumer-list"
aria-label={t('dashboard~Top consumer by {{label}}', { label: model.label })}
aria-label={t('console-shared~Top consumer by {{label}}', { label: model.label })}
>
{top5Data &&
top5Data.map((item) => {
Expand All @@ -224,7 +224,7 @@ export const PopoverBody = withDashboardResources<DashboardItemProps & PopoverBo
);
})}
</ul>
<Link to={monitoringURL}>{t('dashboard~View more')}</Link>
<Link to={monitoringURL}>{t('console-shared~View more')}</Link>
</>
);
}
Expand All @@ -237,17 +237,17 @@ export const PopoverBody = withDashboardResources<DashboardItemProps & PopoverBo
{children}
<div className="co-utilization-card-popover__title">
{consumers.length === 1
? t('dashboard~Top {{label}} consumers', {
? t('console-shared~Top {{label}} consumers', {
label: currentConsumer.model.label.toLowerCase(),
})
: t('dashboard~Top consumers')}
: t('console-shared~Top consumers')}
</div>
{consumers.length > 1 && (
<Dropdown
className="co-utilization-card-popover__dropdown"
id="consumer-select"
name="selectConsumerType"
aria-label={t('dashboard~Select consumer type')}
aria-label={t('console-shared~Select consumer type')}
items={dropdownItems}
onChange={onDropdownChange}
selectedKey={referenceForModel(model)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const UtilizationAxis: React.FC<UtilizationAxisProps> = ({ timestamps = [] }) =>
<div ref={containerRef}>
{!!timestamps.length && (
<ChartAxis
containerComponent={<ChartContainer title={t('dashboard~time axis')} />}
containerComponent={<ChartContainer title={t('console-shared~time axis')} />}
scale={{ x: 'time' }}
domain={{ x: [timestamps[0], timestamps[timestamps.length - 1]] }}
tickFormat={timeFormatter.format}
Expand All @@ -38,10 +38,10 @@ export const UtilizationBody: React.FC<UtilizationBodyProps> = ({ timestamps, ch
<div className="co-utilization-card__item">
<div className="co-utilization-card__item-section co-u-hidden co-u-visible-on-xl">
<span className="co-utilization-card__item-text" data-test="utilization-card-item-text">
{t('public~Resource')}
{t('console-shared~Resource')}
</span>
<span className="co-utilization-card__item-text" data-test="utilization-card-item-text">
{t('dashboard~Usage')}
{t('console-shared~Usage')}
</span>
</div>
<div className="co-utilization-card__item-chart co-utilization-card__item-chart--times">
Expand Down
Loading

0 comments on commit 3f1db37

Please sign in to comment.