mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2026-04-19 21:09:46 +01:00
add text localization
This commit is contained in:
@@ -67,16 +67,19 @@ export const ThroughputBucketsComponent: FC<ThroughputBucketsComponentProps> = (
|
|||||||
const getThroughputBucketOptions = (): IDropdownOption[] => {
|
const getThroughputBucketOptions = (): IDropdownOption[] => {
|
||||||
const noDefaultThroughputBucketSelected: IDropdownOption = {
|
const noDefaultThroughputBucketSelected: IDropdownOption = {
|
||||||
key: NoDefaultThroughputSelectedKey,
|
key: NoDefaultThroughputSelectedKey,
|
||||||
text: "No Default Throughput Bucket Selected",
|
text: t(Keys.controls.settings.throughputBuckets.noDefaultBucketSelected),
|
||||||
};
|
};
|
||||||
|
|
||||||
const throughputBucketOptions: IDropdownOption[] = throughputBuckets.map((bucket) => ({
|
const throughputBucketOptions: IDropdownOption[] = throughputBuckets.map((bucket) => ({
|
||||||
key: bucket.id,
|
key: bucket.id,
|
||||||
text: `Bucket ${bucket.id} - ${bucket.maxThroughputPercentage}%`,
|
text: t(Keys.controls.settings.throughputBuckets.bucketOptionLabel, {
|
||||||
|
id: String(bucket.id),
|
||||||
|
percentage: String(bucket.maxThroughputPercentage),
|
||||||
|
}),
|
||||||
disabled: bucket.maxThroughputPercentage === 100,
|
disabled: bucket.maxThroughputPercentage === 100,
|
||||||
...(bucket.maxThroughputPercentage === 100 && {
|
...(bucket.maxThroughputPercentage === 100 && {
|
||||||
data: {
|
data: {
|
||||||
tooltip: `Bucket ${bucket.id} is not active.`,
|
tooltip: t(Keys.controls.settings.throughputBuckets.bucketNotActive, { id: String(bucket.id) }),
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
}));
|
}));
|
||||||
@@ -127,16 +130,19 @@ export const ThroughputBucketsComponent: FC<ThroughputBucketsComponentProps> = (
|
|||||||
const onRenderDefaultThroughputBucketLabel = (): JSX.Element => {
|
const onRenderDefaultThroughputBucketLabel = (): JSX.Element => {
|
||||||
const tooltipContent = (): JSX.Element => (
|
const tooltipContent = (): JSX.Element => (
|
||||||
<Text>
|
<Text>
|
||||||
The default throughput bucket is used for operations that do not specify a particular bucket.{" "}
|
{t(Keys.controls.settings.throughputBuckets.defaultBucketTooltip)}{" "}
|
||||||
<Link href="https://learn.microsoft.com/azure/cosmos-db/throughput-buckets?tabs=dotnet#configuring-default-throughput-bucket" target="_blank">
|
<Link
|
||||||
Learn more.
|
href="https://learn.microsoft.com/azure/cosmos-db/throughput-buckets?tabs=dotnet#configuring-default-throughput-bucket"
|
||||||
|
target="_blank"
|
||||||
|
>
|
||||||
|
{t(Keys.controls.settings.throughputBuckets.defaultBucketTooltipLearnMore)}
|
||||||
</Link>
|
</Link>
|
||||||
</Text>
|
</Text>
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Stack horizontal verticalAlign="center">
|
<Stack horizontal verticalAlign="center">
|
||||||
<Label>Default Throughput Bucket</Label>
|
<Label>{t(Keys.controls.settings.throughputBuckets.defaultBucketLabel)}</Label>
|
||||||
<TooltipHost content={tooltipContent()}>
|
<TooltipHost content={tooltipContent()}>
|
||||||
<Icon iconName="Info" styles={{ root: { marginLeft: 4, marginTop: 5 } }} />
|
<Icon iconName="Info" styles={{ root: { marginLeft: 4, marginTop: 5 } }} />
|
||||||
</TooltipHost>
|
</TooltipHost>
|
||||||
@@ -210,8 +216,8 @@ export const ThroughputBucketsComponent: FC<ThroughputBucketsComponentProps> = (
|
|||||||
))}
|
))}
|
||||||
</Stack>
|
</Stack>
|
||||||
<Dropdown
|
<Dropdown
|
||||||
placeholder="Select a default throughput bucket"
|
placeholder={t(Keys.controls.settings.throughputBuckets.defaultBucketPlaceholder)}
|
||||||
label="Default Throughput Bucket"
|
label={t(Keys.controls.settings.throughputBuckets.defaultBucketLabel)}
|
||||||
options={getThroughputBucketOptions()}
|
options={getThroughputBucketOptions()}
|
||||||
selectedKey={
|
selectedKey={
|
||||||
throughputBuckets?.find((throughputbucket: ThroughputBucket) => throughputbucket.isDefaultBucket)?.id ||
|
throughputBuckets?.find((throughputbucket: ThroughputBucket) => throughputbucket.isDefaultBucket)?.id ||
|
||||||
|
|||||||
@@ -961,7 +961,14 @@
|
|||||||
"bucketLabel": "Bucket {{id}}",
|
"bucketLabel": "Bucket {{id}}",
|
||||||
"dataExplorerQueryBucket": " (Data Explorer Query Bucket)",
|
"dataExplorerQueryBucket": " (Data Explorer Query Bucket)",
|
||||||
"active": "Active",
|
"active": "Active",
|
||||||
"inactive": "Inactive"
|
"inactive": "Inactive",
|
||||||
|
"defaultBucketLabel": "Default Throughput Bucket",
|
||||||
|
"defaultBucketPlaceholder": "Select a default throughput bucket",
|
||||||
|
"defaultBucketTooltip": "The default throughput bucket is used for operations that do not specify a particular bucket.",
|
||||||
|
"defaultBucketTooltipLearnMore": "Learn more.",
|
||||||
|
"noDefaultBucketSelected": "No Default Throughput Bucket Selected",
|
||||||
|
"bucketOptionLabel": "Bucket {{id}} - {{percentage}}%",
|
||||||
|
"bucketNotActive": "Bucket {{id}} is not active."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user