I am working on a multi-lingual project. Which has 3 locales en-SG, en-VN, and vi-VN. Among them, en-SG is a default locale.
Is this possible to query the docs in a way so that when there is no doc for any locale(especially en-VN) the site shows the default locale doc?
I have achieved something similar with this query.
*[_type == "cardPage" && (__i18n_lang == $locale || __i18n_lang == $defaultLocale ) && !(_id in path('drafts.**'))]
But it's not working properly when the $locale doc available, it's querying the $locale doc and $defaultLocale doc at the same time. And showing the $defaultLocale doc instead of the actual $locale doc on some pages.
I am using nextjs for front end and sanity-plugin-intl-input plugin for localization.