Commit 2e1cb42a authored by Jose Ivan Vargas's avatar Jose Ivan Vargas

Merge branch 'fix-namespaced-translation-in-inline-alert' into 'master'

Fix namespaced translation in inline alert

See merge request gitlab-org/gitlab!45062
parents efc7239c 5e69fdbf
<script> <script>
import { GlAlert } from '@gitlab/ui'; import { GlAlert } from '@gitlab/ui';
import { n__, __ } from '~/locale'; import { n__, s__, sprintf } from '~/locale';
import { formatUsageSize, usageRatioToThresholdLevel } from '../utils'; import { formatUsageSize, usageRatioToThresholdLevel } from '../utils';
import { ALERT_THRESHOLD, ERROR_THRESHOLD, WARNING_THRESHOLD } from '../constants'; import { ALERT_THRESHOLD, ERROR_THRESHOLD, WARNING_THRESHOLD } from '../constants';
export default { 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.',
),
storageUsageText: 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: { components: {
GlAlert, GlAlert,
}, },
...@@ -45,9 +61,11 @@ export default { ...@@ -45,9 +61,11 @@ export default {
}, },
alertTitle() { alertTitle() {
if (!this.hasPurchasedStorage() && this.containsLockedProjects) { 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.storageUsageText, {
percentageLeft: `${this.excessStoragePercentageLeft}%`,
});
}, },
excessStorageRatio() { excessStorageRatio() {
return this.totalRepositorySizeExcess / this.additionalPurchasedStorageSize; return this.totalRepositorySizeExcess / this.additionalPurchasedStorageSize;
...@@ -89,32 +107,25 @@ export default { ...@@ -89,32 +107,25 @@ export default {
}, },
hasPurchasedStorageText() { hasPurchasedStorageText() {
if (this.thresholdLevel === ERROR_THRESHOLD) { if (this.thresholdLevel === ERROR_THRESHOLD) {
return __( return sprintf(this.$options.i18n.lockedWithPurchaseText, {
`You have consumed all of your additional storage, please purchase more to unlock your projects over the free ${this.formatSize( actualRepositorySizeLimit: this.formatSize(this.actualRepositorySizeLimit),
this.actualRepositorySizeLimit, });
)} limit`,
);
} else if ( } else if (
this.thresholdLevel === WARNING_THRESHOLD || this.thresholdLevel === WARNING_THRESHOLD ||
this.thresholdLevel === ALERT_THRESHOLD this.thresholdLevel === ALERT_THRESHOLD
) { ) {
__( return this.$options.i18n.warningWithPurchaseText;
`Your purchased storage is running low. To avoid locked projects, please purchase more storage.`,
);
} }
return __( return sprintf(this.$options.i18n.infoWithPurchaseText, {
`When you purchase additional storage, we automatically unlock projects that were locked when you reached the ${this.formatSize( actualRepositorySizeLimit: this.formatSize(this.actualRepositorySizeLimit),
this.actualRepositorySizeLimit, });
)} limit.`,
);
}, },
hasNotPurchasedStorageText() { hasNotPurchasedStorageText() {
if (this.thresholdLevel === ERROR_THRESHOLD) { if (this.thresholdLevel === ERROR_THRESHOLD) {
return __( return sprintf(this.$options.i18n.lockedWithNoPurchasedStorageText, {
`You have reached the free storage limit of ${this.formatSize( actualRepositorySizeLimit: this.formatSize(this.actualRepositorySizeLimit),
this.actualRepositorySizeLimit, projectsLockedText: this.projectsLockedText,
)} on ${this.projectsLockedText}. To unlock them, please purchase additional storage.`, });
);
} }
return ''; return '';
}, },
......
...@@ -28440,6 +28440,9 @@ msgstr "" ...@@ -28440,6 +28440,9 @@ msgstr ""
msgid "UsageQuota|%{help_link_start}Shared runners%{help_link_end} are disabled, so there are no limits set on pipeline usage" msgid "UsageQuota|%{help_link_start}Shared runners%{help_link_end} are disabled, so there are no limits set on pipeline usage"
msgstr "" msgstr ""
msgid "UsageQuota|%{percentageLeft} of purchased storage is available"
msgstr ""
msgid "UsageQuota|Artifacts" msgid "UsageQuota|Artifacts"
msgstr "" msgstr ""
...@@ -28530,15 +28533,27 @@ msgstr "" ...@@ -28530,15 +28533,27 @@ msgstr ""
msgid "UsageQuota|Usage since" msgid "UsageQuota|Usage since"
msgstr "" 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" msgid "UsageQuota|Wiki"
msgstr "" msgstr ""
msgid "UsageQuota|Wikis" msgid "UsageQuota|Wikis"
msgstr "" 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}" msgid "UsageQuota|You used: %{usage} %{limit}"
msgstr "" 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" msgid "UsageQuota|out of %{formattedLimit} of your namespace storage"
msgstr "" msgstr ""
...@@ -30585,9 +30600,6 @@ msgstr "" ...@@ -30585,9 +30600,6 @@ msgstr ""
msgid "Your projects" msgid "Your projects"
msgstr "" 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}" msgid "Your request for access could not be processed: %{error_meesage}"
msgstr "" 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