Hi! I posted this on stack overflow, but have copied the content here also. Please feel free to reply on either.
I’m using the latest apostrophe and want to build a simple solution for page localisation (diff languages). Workflow is great, but it’s overkill for what I need in this case and will confuse my user.
Therefore in this simple version, the Admin would create an /about page in English, and then a new about page in french, setting slug to /fr/about
The site user then:
selects desired locale (eg ‘fr’ for French). Locale is set in express session
when accessing a page link, eg /about, if locale is set in session, lookup to see if ‘/fr/about’ page (slug) exists - if so, redirect; if not show /about
First, let me know if I’m going about this in the complete wrong way.
Otherwise: 1. what’s the best place (module/file) to set and get session locale? 2. what’s the best place (module/file) to check accessed page and lookup localised “parent” slug ie /about -> /fr/about 3. How do you lookup a page via slug (or another method) 4. How do you then display the page data, or simply redirect
I did spend several hours trying to piece this together in apostrophe-custom-pages dispatch.js but ran into a number of hurdles.
Thanks for any thoughts!