I'm building a multi-language foundation.
I have a select with the chosen language, but there is no guarantee that 100% of the content is translated, so I need to make a kind of or
for the default language as a secondary alternative.
select ...
where ...
and (idioma = 'pt-br' or idioma = 'en-us')
There is a relationship in this query, but that's beside the point. The problem is that when I have entries in both languages, select
always returns the lowest ID, in the case en-us
:
id | idioma | texto
1 | en-us | ...
2 | pt-br | ...
3 | it | ...
What I need is to prioritize the desired language, and bring the default only when the desired language is not found.