Note: I am not able to see the “Slovenian (Slovenian)” option on my dev stores, so if you know how to enable this for my dev stores for testing I’d appreciate it.
Is this a bug in the Storefront API that the SL_SI - Slovenian (Slovenian) language is not supported?
Or should the SL_SI language code be mapped to SL, even though they are different iso codes?
This does seem like an inconsistency between the Storefront API and the Liquid API. I’ll dig into this on our side - is this for a custom storefront? Any info you can give on the usecase would be helpful.
Also I am seeing Slovenian as an option in my dev store:
Click save and then you should be able to see the language iso code shows as:
si-SL in Liquid. This is the Slovenian (Slovenia) iso code.
SL In the Storefront API. This is the Slovenian iso code.
I suspect what is happening is the Storefront API does not support all of the languages that themes support, so in this case the Storefront API is converting the si-SL to the closest match of SL. However, these are not the same iso codes so I’m not sure it makes sense for apps to treat these the same when calling the Storefront API.
However, it is not possible to send an invalid LanguageCode since the API prevents this with the error "message": "Argument 'language' on Directive 'inContext' has an invalid value (SL_SI). Expected type 'LanguageCode'."
One possible workaround for now is to not send the language to inContext for the default language. I believe only the default languages include iso codes not supported by the inContext directive, and the API should use the default language automatically.
Ideally the Liquid and Storefront languages should be consistent, or there should be a warning and documentation on how to handle unsupported iso codes.
I suspect what is happening is the Storefront API does not support all of the languages that themes support, so in this case the Storefront API is converting the si-SL to the closest match of SL.
I am also thinking this is the case - have connected with some internal folk on this, will update here when I learn more!