Decide/handle behavior for accessing untranslated/unpublished translation pages
See #2047 for more context/conversation.
Scenario
When on an English version page a user switches the language (using the locale switcher).
Current Behavior
- When there is no translated page, the user gets a 404 error page.
- When there is a translated page but the translated page has not been made public, the user gets the generic non-authorized behavior and is sent to the Application's home page with a not authorized message.
Desired Behavior (as described in #2047)
- In either case (non existent or unpublished) the user would sent to the Exhibit's home page with a message indicating that the page is not available in that language and a link to go back to the default language version of the page.
Note: an acceptable answer to this is that this should be a local application customization. Just using this as an opportunity to experiment with the code needed to accomplish this and to start that discussion
A couple questions @ggeisler.
- I assume this should only happen when we get an access denied/not found for a non-default language?
- Should we try to determine if the user can access the english/default language version page before linking to it? (the reason I ask is because technically the english/default language version could be unpublished)
- Should we only do this redirect/message if we know that there is an english/default language version of the page they tried to access (which would potentially answer 2), and otherwise do the default behavior of redirecting to the Application's home page?
- I assume this should only happen when we get an access denied/not found for a non-default language?
Ideally it should apply to the default language scenario as well (i.e., I'm viewing a Spanish About page and change locale to English/default lang and that page is not published in English). The language refs in the flash message would just be reversed ("The page you requested is not available in English. View page in Spanish").
- Should we try to determine if the user can access the english/default language version page before linking to it? (the reason I ask is because technically the english/default language version could be unpublished)
Man, this gets complicated. Not sure this is already clear but what I intended in my mockup was actually that the link "View page in English" is a link back to the page the user was one when changing the locale (covering the scenario where the page is more important to the user than changing the locale). So I think the page we link to must be published, because they were already on it before changing the locale, right?
If so, there is still the clarification that ideally, the link doesn't always say "View page in English" (or whatever the default language is). What it says is "View page in [previous locale]". So the page we link to is the page they were redirected from, in the locale they were in before changing to the locale that caused the error. Maybe changing the linked string to "View that page in [previous locale]" (added "that") makes what will happen a bit more clear.
- Should we only do this redirect/message if we know that there is an english/default language version of the page they tried to access (which would potentially answer 2), and otherwise do the default behavior of redirecting to the Application's home page?
If my answer to (2) makes sense, then I think we can always be sure there is a valid page to link to, because it was the page the user was on before changing locales.
Ideally it should apply to the default language scenario as well (i.e., I'm viewing a Spanish About page and change locale to English/default lang and that page is not published in English).
Would this then only apply if there are multiple languages in the exhibit? If not, then we would be changing the current behavior for exhibit's who don't care about multilingual translations at all. Is this suggesting that we want to change this behavior in general for all pages?
... Not sure this is already clear but what I intended in my mockup was actually that the link "View page in English" is a link back to the page the user was one when changing the locale (covering the scenario where the page is more important to the user than changing the locale). So I think the page we link to must be published, because they were already on it before changing the locale, right?
I understand that, but from a functional perspective there is no difference between a user getting to that page from switching locales vs. them getting there in any other way. So technically a user could get to a Spanish translated page that was unpublished/deleted and its English equivalent has also been unpublished. It may be unlikely, but in that scenario we may end up throwing an error or rending a dead link.
Man, this gets complicated.

Would this then only apply if there are multiple languages in the exhibit? If not, then we would be changing the current behavior for exhibit's who don't care about multilingual translations at all. Is this suggesting that we want to change this behavior in general for all pages?
No, no, I'm just suggesting the behavior should be the same no matter what languages the user is switching to and from. But if the site doesn't have multiple languages I don't think there is any reason to apply the behavior there.
I understand that, but from a functional perspective there is no difference between a user getting to that page from switching locales vs. them getting there in any other way. So technically a user could get to a Spanish translated page that was unpublished/deleted and its English equivalent has also been unpublished. It may be unlikely, but in that scenario we may end up throwing an error or rending a dead link.
Okay, I see. Is it feasible to check the validity of the page we want to link to before presenting the link (maybe what you were asking originally)? If so, we could link as suggested in my mockup if we know the page exists, and if it isn't a valid page (for the current user), just leave off the link? In that case we're at least telling the user that the requested page isn't valid, and we let them figure out how they want to proceed from the exhibit homepage.