Commit 76801b86 authored by Ragnar-H's avatar Ragnar-H

Expose StorageInlineAlert strings to i18n

parent 36b475ac
<script>
import { GlAlert } from '@gitlab/ui';
import { n__, __ } from '~/locale';
import { n__, s__, sprintf } from '~/locale';
import { formatUsageSize, usageRatioToThresholdLevel } from '../utils';
import { ALERT_THRESHOLD, ERROR_THRESHOLD, WARNING_THRESHOLD } from '../constants';
export default {
i18n: {
lockedWithNoPurchasedStorageTitle: s__('UsageQuota|This namespace contains locked projects'),
lockedWithNoPurchasedStorageText: s__(
'UsageQuota|You have reached the free storage limit of %{actualRepositorySizeLimit} on %{projectsLockedText}. To unlock them, please purchase additional storage.',
),
storageUsage: s__('UsageQuota|%{percentageLeft} of purchased storage is available'),
lockedWithPurchaseText: s__(
'UsageQuota|You have consumed all of your additional storage, please purchase more to unlock your projects over the free %{actualRepositorySizeLimit} limit.',
),
warningWithPurchaseText: s__(
'UsageQuota|Your purchased storage is running low. To avoid locked projects, please purchase more storage.',
),
infoWithPurchaseText: s__(
'UsageQuota|When you purchase additional storage, we automatically unlock projects that were locked when you reached the %{actualRepositorySizeLimit} limit.',
),
},
components: {
GlAlert,
},
......@@ -45,9 +61,11 @@ export default {
},
alertTitle() {
if (!this.hasPurchasedStorage() && this.containsLockedProjects) {
return __('UsageQuota|This namespace contains locked projects');
return this.$options.i18n.lockedWithNoPurchasedStorageTitle;
}
return `${this.excessStoragePercentageLeft}% of purchased storage is available`;
return sprintf(this.$options.i18n.storageUsage, {
percentageLeft: `${this.excessStoragePercentageLeft}%`,
});
},
excessStorageRatio() {
return this.totalRepositorySizeExcess / this.additionalPurchasedStorageSize;
......@@ -89,32 +107,25 @@ export default {
},
hasPurchasedStorageText() {
if (this.thresholdLevel === ERROR_THRESHOLD) {
return __(
`You have consumed all of your additional storage, please purchase more to unlock your projects over the free ${this.formatSize(
this.actualRepositorySizeLimit,
)} limit`,
);
return sprintf(this.$options.i18n.lockedWithPurchaseText, {
actualRepositorySizeLimit: this.formatSize(this.actualRepositorySizeLimit),
});
} else if (
this.thresholdLevel === WARNING_THRESHOLD ||
this.thresholdLevel === ALERT_THRESHOLD
) {
__(
`Your purchased storage is running low. To avoid locked projects, please purchase more storage.`,
);
return this.$options.i18n.warningWithPurchaseText;
}
return __(
`When you purchase additional storage, we automatically unlock projects that were locked when you reached the ${this.formatSize(
this.actualRepositorySizeLimit,
)} limit.`,
);
return sprintf(this.$options.i18n.infoWithPurchaseText, {
actualRepositorySizeLimit: this.formatSize(this.actualRepositorySizeLimit),
});
},
hasNotPurchasedStorageText() {
if (this.thresholdLevel === ERROR_THRESHOLD) {
return __(
`You have reached the free storage limit of ${this.formatSize(
this.actualRepositorySizeLimit,
)} on ${this.projectsLockedText}. To unlock them, please purchase additional storage.`,
);
return sprintf(this.$options.i18n.lockedWithNoPurchasedStorageText, {
actualRepositorySizeLimit: this.formatSize(this.actualRepositorySizeLimit),
projectsLockedText: this.projectsLockedText,
});
}
return '';
},
......
......@@ -28380,6 +28380,9 @@ msgstr ""
msgid "UsageQuota|%{help_link_start}Shared runners%{help_link_end} are disabled, so there are no limits set on pipeline usage"
msgstr ""
msgid "UsageQuota|%{percentageLeft} of purchased storage is available"
msgstr ""
msgid "UsageQuota|Artifacts"
msgstr ""
......@@ -28470,15 +28473,27 @@ msgstr ""
msgid "UsageQuota|Usage since"
msgstr ""
msgid "UsageQuota|When you purchase additional storage, we automatically unlock projects that were locked when you reached the %{actualRepositorySizeLimit} limit."
msgstr ""
msgid "UsageQuota|Wiki"
msgstr ""
msgid "UsageQuota|Wikis"
msgstr ""
msgid "UsageQuota|You have consumed all of your additional storage, please purchase more to unlock your projects over the free %{actualRepositorySizeLimit} limit."
msgstr ""
msgid "UsageQuota|You have reached the free storage limit of %{actualRepositorySizeLimit} on %{projectsLockedText}. To unlock them, please purchase additional storage."
msgstr ""
msgid "UsageQuota|You used: %{usage} %{limit}"
msgstr ""
msgid "UsageQuota|Your purchased storage is running low. To avoid locked projects, please purchase more storage."
msgstr ""
msgid "UsageQuota|out of %{formattedLimit} of your namespace storage"
msgstr ""
......@@ -30525,9 +30540,6 @@ msgstr ""
msgid "Your projects"
msgstr ""
msgid "Your purchased storage is running low. To avoid locked projects, please purchase more storage."
msgstr ""
msgid "Your request for access could not be processed: %{error_meesage}"
msgstr ""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment