Logic to display content if translation not available
-
Hi, Chouby
Polylang is my favorite plugin for multilingual websites (and I create them very often), but right now I’ve faced a problem which does not fit into a regular scenario. I inspected your code, WPML and some other solutions and hacks from all over the internet. I would like to know, if it’s possible to achive my tasks, even with extra PHP coding, adding custom rewrites etc.
Is it possible to modify default content display logic to this:
– Show current object (post, page, custom post type) in currently selected language.
– If it’s not available in current language, redirect to this post in the default language (not to homepage or error page).
– If it’s also not available in default language – get it in original language it was written.This must work on archives and single posts/pages. For example, we have a site with 3 languages – en, de, ru. We have a
news
custom post type, which haspost
features.When we go to https://example.com/news/ we need to see all unique news entries – if it’s availalbe in current language – it’s displayed in current, if not – displayed in default site language, if not – in language it was originally published.
Consider we have current language set to ‘de’. In this news archive we click on a news entry in english (‘de’ translation is not available). We should be able to read this entry in ‘en’ without switching our current language to ‘en’. Maybe, show a message like “This post is not available in de, here is the en version”.
And the second question. Is it possible to modify Polylang to stop translating taxonomies? Or do it like usermeta – single object, extra fields for languages (see bio in user profile). This will fix all those problems with unique taxonomy slugs. Create and use system-wide only 1 term, add translations as term meta.
If it is possible with extra coding but you just don’t have time – please let me know. It is entirely possible to hire you for this (and updated plugin can be released to public for free, not a problem).
- The topic ‘Logic to display content if translation not available’ is closed to new replies.