Are settings fields values for the Checkout UI extension really translatable right now? If so why isn’t it documented anywhere or did I miss it?
How to allow merchants to translate values they enter into those fields? They definitely should be natively translatable. The Shopify Support says they are but I couldn’t receive an answer in which way.
I was thinking of using metafields as a workaround but since there’s no way to track the saved value for a settings field, this option looks inadequate to me.
@AMaL Thanks for you reply but none of those pages describes the way to translate the field value which is entered by merchants through the Checkout Editor.
I was thinking of using metafields as a workaround but since there’s no way to track the saved value for a settings field, this option looks inadequate to me.
Utilize the useSettings() hook to retrieve the setting values defined by the merchant for the extension.
Save Checkout Editor Field Values
Use two Settings fields in the Checkout Editor:
One for the description .
Another for the language (e.g., translation target language).
In the extension, describe in the selected language and save it as a metafield using the applyMetafieldsChange() hook.
Fetch the saved settings field values using the useSettings() hook.
Display the Saved Values
Use the useLanguage() hook to get the store’s active language code.
Use the useAppMetafields() hook to retrieve the saved metafield value.
Compare the store’s active language with the metafield’s language code, and display the corresponding description.
Save a translated description and its associated language using settings fields and applyMetafieldsChange().
Fetch and display the description dynamically based on the store’s active language using useLanguage() and useAppMetafields().
FYI: I have not implemented this approach yet, and I’m not entirely sure if it will work as intended. It’s based on Shopify’s available APIs and hooks
Well, thanks for the try, but it has nothing to do with the reality. Not sure how exactly you’re going to use the language settings field without a dynamic value for it but If you will dig deeper you will see:
Neither Order status nor Thank you page targets doesn’t have the applyMetafieldsChange hook in its API.
There’s no way to save metafields along with settings fields values. If you will update a metafield each time a settings field changes then there’s a chance a merchant won’t save the entered values and as a result metafields values won’t be consistent with the settings fields values.
Set a Separate Field for Language: In the Checkout Editor, we can introduce a dedicated field for the language (example: see the attached sample from an admin app).