I try to figure out how I can change the language option per post such that I can select multiple languages. I have some pages that I wouldn’t like to rewrite for every different language (English and Dutch in my case) but still would like to show for both languages (selected by the user on the front-end). I don’t think there is much difficulty in programming, but I just don’t know ho to do it. There are some considerations:
- when a single language is selected, show the post/page as it is done now.
- when multiple languages are selected, show them for all those languages (the question is whether the polylang database structure allows for that).
- when no language is selected, show the post/page for any language.
- the plugin should remember which language was formerly used by the visitor, to know in which language to show the sidebar and other translated options. This could be done through cookies, or by keeping the language bigram in the URL, even if a page has no language set (/en/ and /nl/ could point to the same file, although the URL tells wordpress that language options are to be different).
- Explicit page links (e.g. shortcodes) to other pages/posts within the site, that doe not have the explicitly selected language (the language of the refferring page, by URL) could get a link to the google translator. But this may be to far fetched.
Only, when someone enters the site through a shortlink, to a page that has multiple languages selected, the site does not know what to do, unless the language was explicitly set in the URL (e.g. /en/). In that case, I would just show the default locale for the menus; there is always the language switch option.
(And it would be nice to have an [en]…[/en] [nl,en]…[/nl,en] like construction for pages that are mostly identical for multiple languages (like photo galleries) but differ only by minor texts.)
Besides, this is the language plugin that does most things the way I would like them to work. Yet it would be perfect for me (and for others, I hope and guess) with the above options included.
- The topic ‘[polylang] Multi-select language per post’ is closed to new replies.