Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

Say "5 progów", not "5 progi"

Damian Legawiec3ab5d3d3384c
diff --git a/packages/dashboard/src/components/spree/bulk-price-editor/bulk-price-editor.tsx b/packages/dashboard/src/components/spree/bulk-price-editor/bulk-price-editor.tsx
index 0f016c87f0..453c8e5749 100644
--- a/packages/dashboard/src/components/spree/bulk-price-editor/bulk-price-editor.tsx
+++ b/packages/dashboard/src/components/spree/bulk-price-editor/bulk-price-editor.tsx
@@ -11,12 +11,15 @@ import { useCallback, useDeferredValue, useEffect, useMemo, useState } from 'rea
import { useTranslation } from 'react-i18next'
import { useCurrencyLocale } from '../../../hooks/use-currency-locale'
import { useBulkUpsertPrices } from '../../../hooks/use-prices'
+import { MAXIMUM_QUANTITY_TIERS } from '../../../schemas/price-list'
import { VariantTierDialog } from './variant-tier-dialog'
const PAGE_SIZE = 50
// The API caps a page at 100 rows, so the break sweep asks for exactly that
-// and pages until it has them all.
+// and pages until it has them all — at most one page per ten variants on
+// screen, since a variant carries at most ten breaks.
const BREAK_PAGE_SIZE = 100
+const MAX_BREAK_PAGES = Math.ceil((PAGE_SIZE * MAXIMUM_QUANTITY_TIERS) / BREAK_PAGE_SIZE)
interface PriceListRowFromServer {
id: string
@@ -198,7 +201,7 @@ export function BulkPriceEditor({
queryFn: async () => {
const collected: PriceListRowFromServer[] = []
let breakPage = 1
- let lastPage = 1
+ let lastPage: number
do {
const response = await adminClient.prices.list({
@@ -213,7 +216,10 @@ export function BulkPriceEditor({
collected.push(...(response.data as unknown as PriceListRowFromServer[]))
lastPage = response.meta?.pages ?? 1
breakPage += 1
- } while (breakPage <= lastPage)
+ // Bounded: a page of variants can hold at most PAGE_SIZE ladders of
+ // MAXIMUM_QUANTITY_TIERS rungs, so anything beyond that is a server
+ // answering something this loop should not chase.
+ } while (breakPage <= lastPage && breakPage <= MAX_BREAK_PAGES)
return collected
},
diff --git a/packages/dashboard/src/locales/ar.json b/packages/dashboard/src/locales/ar.json
index 709887951e..1f01c3462f 100644
--- a/packages/dashboard/src/locales/ar.json
+++ b/packages/dashboard/src/locales/ar.json
@@ -3428,8 +3428,8 @@
"tiers": {
"add": "إضافة مستوى كمية",
"add_short": "إضافة",
- "count_badge": "{{count}} مستويات",
"count_badge_one": "مستوى {{count}}",
+ "count_badge_other": "{{count}} مستويات",
"duplicate_quantity": "لا يمكن أن يبدأ مستويان من الكمية نفسها.",
"empty": "لا توجد مستويات — يُحتسب هذا المتغير بسعر واحد مهما كان حجم الطلب.",
"help": "من كل كمية فصاعدًا يُحتسب السطر بسعر الوحدة هذا. المتغير الذي له مستويات يُسعَّر بها وحدها — ولا تنطبق عليه نسبة القائمة.",
diff --git a/packages/dashboard/src/locales/de.json b/packages/dashboard/src/locales/de.json
index bb649568e6..4d7f014053 100644
--- a/packages/dashboard/src/locales/de.json
+++ b/packages/dashboard/src/locales/de.json
@@ -3411,8 +3411,8 @@
"tiers": {
"add": "Mengenstaffel hinzufügen",
"add_short": "Hinzufügen",
- "count_badge": "{{count}} Staffeln",
"count_badge_one": "{{count}} Staffel",
+ "count_badge_other": "{{count}} Staffeln",
"duplicate_quantity": "Zwei Staffeln können nicht bei derselben Menge beginnen.",
"empty": "Keine Staffeln — diese Variante kostet unabhängig von der Bestellmenge dasselbe.",
"help": "Ab der jeweiligen Menge gilt dieser Stückpreis. Eine Variante mit Staffeln wird ausschließlich danach berechnet — der Prozentsatz der Liste gilt für sie nicht.",
diff --git a/packages/dashboard/src/locales/en.json b/packages/dashboard/src/locales/en.json
index ef659259e6..90da211515 100644
--- a/packages/dashboard/src/locales/en.json
+++ b/packages/dashboard/src/locales/en.json
@@ -3411,8 +3411,8 @@
"tiers": {
"add": "Add quantity break",
"add_short": "Add",
- "count_badge": "{{count}} tiers",
"count_badge_one": "{{count}} tier",
+ "count_badge_other": "{{count}} tiers",
"duplicate_quantity": "Two breaks cannot start at the same quantity.",
"empty": "No breaks — this variant is charged one price whatever the order size.",
"help": "From each quantity up, a line is charged this unit price. A variant with breaks is priced by them alone — the list’s percentage does not apply to it.",
diff --git a/packages/dashboard/src/locales/fr.json b/packages/dashboard/src/locales/fr.json
index d9343c1bf5..7afbae93d7 100644
--- a/packages/dashboard/src/locales/fr.json
+++ b/packages/dashboard/src/locales/fr.json
@@ -3411,8 +3411,8 @@
"tiers": {
"add": "Ajouter un palier de quantité",
"add_short": "Ajouter",
- "count_badge": "{{count}} paliers",
"count_badge_one": "{{count}} palier",
+ "count_badge_other": "{{count}} paliers",
"duplicate_quantity": "Deux paliers ne peuvent pas commencer à la même quantité.",
"empty": "Aucun palier — cette déclinaison est facturée au même prix quelle que soit la quantité.",
"help": "À partir de chaque quantité, la ligne est facturée à ce prix unitaire. Une déclinaison à paliers est facturée uniquement ainsi — le pourcentage de la liste ne s’y applique pas.",
diff --git a/packages/dashboard/src/locales/pl.json b/packages/dashboard/src/locales/pl.json
index 6a596bd837..64577ae9b8 100644
--- a/packages/dashboard/src/locales/pl.json
+++ b/packages/dashboard/src/locales/pl.json
@@ -162,8 +162,10 @@
"automatic": "Cena sklepowa z zastosowanym procentem tego katalogu.",
"base": "Zwykła cena sklepowa — ten katalog nie ustala ceny tego produktu."
},
+ "tier_count_few": "+{{count}} progi",
+ "tier_count_many": "+{{count}} progów",
"tier_count_one": "+{{count}} próg",
- "tier_count_other": "+{{count}} progi",
+ "tier_count_other": "+{{count}} progów",
"unpriced": "Brak ceny"
},
"products": {
@@ -3447,8 +3449,10 @@
"tiers": {
"add": "Dodaj próg ilościowy",
"add_short": "Dodaj",
- "count_badge": "progi: {{count}}",
+ "count_badge_few": "progi: {{count}}",
+ "count_badge_many": "progów: {{count}}",
"count_badge_one": "próg: {{count}}",
+ "count_badge_other": "progów: {{count}}",
"duplicate_quantity": "Dwa progi nie mogą zaczynać się od tej samej ilości.",
"empty": "Brak progów — ten wariant kosztuje tyle samo niezależnie od wielkości zamówienia.",
"help": "Od danej ilości w górę linia jest liczona po tej cenie jednostkowej. Wariant z progami jest wyceniany wyłącznie przez nie — procent listy go nie dotyczy.",
@@ -3456,8 +3460,10 @@
"quantity": "Od ilości",
"remove": "Usuń próg od {quantity}",
"save_failed": "Nie udało się zapisać progów ilościowych.",
+ "save_success_few": "Zapisano {{count}} progi ilościowe.",
+ "save_success_many": "Zapisano {{count}} progów ilościowych.",
"save_success_one": "Zapisano {{count}} próg ilościowy.",
- "save_success_other": "Zapisano progi ilościowe: {{count}}.",
+ "save_success_other": "Zapisano {{count}} progów ilościowych.",
"title": "Progi ilościowe — {{variant}}",
"unit_price": "Cena jednostkowa"
},
diff --git a/packages/dashboard/src/locales/zh-CN.json b/packages/dashboard/src/locales/zh-CN.json
index 027a05069d..c96e8a21f7 100644
--- a/packages/dashboard/src/locales/zh-CN.json
+++ b/packages/dashboard/src/locales/zh-CN.json
@@ -3403,12 +3403,12 @@
"tiers": {
"add": "添加数量阶梯",
"add_short": "添加",
- "count_badge": "{{count}} 档",
"count_badge_one": "{{count}} 档",
+ "count_badge_other": "{{count}} 档",
"duplicate_quantity": "两档不能从同一数量开始。",
"empty": "暂无阶梯——无论订购多少,此变体都按同一价格计费。",
"help": "达到各档数量后,该行按此单价计费。设有阶梯的变体只按阶梯定价,列表的百分比对它不适用。",
- "invalid_rung": "每一档都需要大于 1 的数量和单价。",
+ "invalid_rung": "每一档都需要大于 1 的数量和有效的单价。",
"quantity": "起订量",
"remove": "删除 {quantity} 起的阶梯",
"save_failed": "无法保存数量阶梯。",