This PR is centered around implementation of language settings throughout the theme.
Because we need to support live changes from the editor in the same way as for the other theme settings, the language settings are located in the settings store under the .lang namespace. I18n libraries were considered for this, but making live changes to the language settings can't be implemented that way unless we store the settings in a store, which would make the library redundant.
Changes:
fetch the available locales of the storefront in the next.config.js file to populate the i18n settings.
move locales/currencies fetch server-side and set locales/currencies stores on first render.
add lang settings configuration in editor.json & default values in defaults.json
add sendMessage function for notifying the editor of locale changes
add sameSite: none setting to cookies when in editor mode so we can se atuhentication cookies from inside the iframe
add useI18n hook to handle translations by passing the path to the language setting as argument
make changes to the dynamic text formatters to use the parseTextWithVariables function.
add prefix for order, subscription status keys in STATUS_MAP as there are overlapping values that need to be differentiated, ex: complete, canceled.
This PR is centered around implementation of language settings throughout the theme.
Because we need to support live changes from the editor in the same way as for the other theme settings, the language settings are located in the settings store under the
.lang
namespace. I18n libraries were considered for this, but making live changes to the language settings can't be implemented that way unless we store the settings in a store, which would make the library redundant.Changes: