diff --git a/src/pretix/plugins/wallet/static/pretixplugins/wallet/components/input/i18ninput.vue b/src/pretix/plugins/wallet/static/pretixplugins/wallet/components/input/i18ninput.vue index 24bd1e3984..2094555445 100644 --- a/src/pretix/plugins/wallet/static/pretixplugins/wallet/components/input/i18ninput.vue +++ b/src/pretix/plugins/wallet/static/pretixplugins/wallet/components/input/i18ninput.vue @@ -10,6 +10,7 @@ defineOptions({ const props = defineProps<{ errors?: string[], + placeholders: Record }>(); const modelValue = defineModel | string>(); @@ -25,6 +26,6 @@ watchEffect(() => { diff --git a/src/pretix/plugins/wallet/static/pretixplugins/wallet/components/placeholder-field-settings.vue b/src/pretix/plugins/wallet/static/pretixplugins/wallet/components/placeholder-field-settings.vue index 1786b251b8..8fb537e0af 100644 --- a/src/pretix/plugins/wallet/static/pretixplugins/wallet/components/placeholder-field-settings.vue +++ b/src/pretix/plugins/wallet/static/pretixplugins/wallet/components/placeholder-field-settings.vue @@ -4,6 +4,7 @@ import Select from "./input/select.vue"; import I18nInput from "./input/i18ninput.vue"; import TextContent from "./text-content.vue"; import { StoreKey } from "../walletStore"; +import { i18nstringLocalize } from "../helpers.js"; const store = inject(StoreKey)!; @@ -54,7 +55,7 @@ const placeholderChoices = computed(() => { .filter(([_, { required_context }]) => new Set(required_context).isSubsetOf(availableContext), ) - .map(([k, v]): [string, string] => [k, v.label]); + .map(([k, v]): [string, string] => [k, i18nstringLocalize(v.label)]); choices.push(["other", gettext("Other…")]); return choices; }); @@ -70,6 +71,28 @@ const overflowText = computed(() => { ); return interpolate(formats, [props.fieldgroup.max_entries]) }) + +const placeholders = computed(() => { + return fieldConfig.value.entries.map((entry) => { + const placeholder = + entry.type === "placeholder" + ? store.variables[props.fieldgroup.content_type][entry.content] + : null; + const placeholders = {}; + let base; + if (i18nstringLocalize(entry.label)) { + base = entry.label + } else if (placeholder) { + base = placeholder.label + } else { + return null + } + for (const locale of Object.keys(store.locales)) { + placeholders[locale] = i18nstringLocalize(base, locale) + } + return placeholders + }) +});