Open david-w-shopify opened 4 days ago
The count variable is not always rendered inside a translation, but still needed for the pluralisation logic to work. If a pluralised variable is injected, count should be included with the variables regardless of if it is used inside the rendered string.
I didn't even know that. 🤦
You made me second guess, so I had to double check on pluralisation this morning. If you don't pass a count
variable the object is rendered rather than any of the individual values.
Fwiw I think it is a lesser-known feature, but here are the docs: https://shopify.dev/docs/storefronts/themes/architecture/locales/storefront-locale-files#pluralize-translations
Is your feature request related to a problem? Please describe. The existing translation completions support pluralised translations, which is excellent, but there are a couple of edge cases that haven't yet been addressed.
count
variable is not always rendered inside a translation, but still needed for the pluralisation logic to work. If a pluralised variable is injected,count
should be included with the variables regardless of if it is used inside the rendered string.Describe the solution you'd like
Use case 1:
In this example the completion should be:
Despite
count
not being used in the actual rendered string, it is required for the pluralisation rules to work.Use case 2:
In this example the completion should be:
Variables discovered in all options should be completed to ensure the string can always render correctly.