I have a number of app blocks which are currently hard-coded in English. The text the app blocks display is provided by the merchant via app block settings. We specify a default value for each of these settings, which is also currently hard-coded in English.
We’re now looking to add translation support to these app blocks, which means that we need to be able to provide translations for the default values of the settings we expose to merchants. There are vague instructions for achieving this via schema locale files, but when I tried this I receive a “translation not found” string in the theme editor. I know that the translations are set up correctly because I’ve also set the input’s label to the same translated value and it displays in the theme editor correctly:
The code to obtain this result was as follows:
// block.liquid
// liquid template here
{% schema %}
{
"name": "Test app block,
"target": "section",
"javascript": "test-app-block.js",
"stylesheet": "test-app-block.css",
"available_if": "{{ app.metafields.test-app-block.should-show }}",
"enabled_on": {
"templates": ["product"]
},
"settings": [
{
"id": "test_text_setting",
"type": "richtext",
"label": "t:templates.app_block.test_string_label",
"default": "t:templates.app_block.test_string_label"
},
]
}
{% endschema %}
// en.default.schema.json
{
"templates": {
"app_block": {
"test_string_label": "Test",
}
}
}
So it looks like translated default values for merchant-configurable values don’t work in the way the documentation suggests that they should. Is this a known issue, and/or is there a known workaround? I can of course remove the default value from the setting and make it a customer-facing translation in the en.default.json locale file and access it via the Liquid t filter instead, but I think it’s a nicer merchant experience if we’re able to pre-populate the text input with a default value rather than leaving it blank. Thanks!
