Page 1 of 1

Revisiting the multilingual feature of static page plugin

Posted: Tue Apr 12, 2016 7:18 am
by wesley
I've recently switched over to a new theme on my blog. As the the built-in navbar looks so nice, I decided to use it instead of using an HTML nugget to create one like I used to do in the old theme.

The problem is that the blog is multilingual and the navbar has links to static pages via permalink. I would like a single link to point to a set of static pages with identical permalinks but in differing languages - s9y would pick out and serve the page with the correct language (the one that the user or the browser has selected beforehand). But the multilingual feature of the static page plugin does not seem to work this way, according to my personal experience, as well as past forum posts.

Is there a way to achieve this in a reasonable way?

Re: Revisiting the multilingual feature of static page plugi

Posted: Tue Apr 12, 2016 11:54 am
by Timbalu
If I get you right, you want the themes top navigation static pages permalinks to either
  • 1. change by selected language, or (as being static)
    2. change their content by selected language.
This is not possible automatically as far as I know.

These permalinks are static. To make this dynamic, you would at least need some javascript and a static permalink array to change permalinks by language (untested), I assume.

But what you can do is this:
Use the multilingual event plugin additionally or make your own smarty modifier (function).

If using the plugin, you can append the "|multilingual_lang" (*) modifier to any Smarty "content" var.
  • Set the static page in question to lang ALL (**).
  • Change inside plugin_staticpage.tpl (should be in your theme)

    Code: Select all


    Code: Select all

  • and inside the staticpage body field add

    Code: Select all

    {{!en}}English version of your text{{--}}{{!ko}}Korean version of text{{--}}
  • You may use html tags here etc, but these strings should not have any linebreaks. (***)
(*) This modifier is normaly used for "title-input-field" titles, eg the staticpage or sidebar plugin titles.

(**) The static page lang option is relevant only for fetching the array on sidebar by language. So in this case, since the permalink is living "set by hand" in the themes navigation, you won't need to set this option specifically though.)

(***) Note the Wysiwyg-CKEditor changes html-tagged strings to expand by linebreaks. You can cheat this behaviour by editing the text in source code mode and immediately save the entry without switching back into wysiwyg mode. Each time you open this entry again, you will have to remove these linebreaks in source-code-mode added by the starting wysiwyg-mode before saving again!

Disclaimer: I dont know if this works with the current staticpage version by Spartacus. I tested this with my dev-version only.

Re: Revisiting the multilingual feature of static page plugi

Posted: Tue Apr 12, 2016 7:17 pm
by wesley
Thanks for the idea. :)

Re: Revisiting the multilingual feature of static page plugi

Posted: Wed Apr 13, 2016 1:06 pm
by Timbalu
Please note, I patched the multlingual plugin to allow newlines, so the cheaty workaround for the CKEditor is not needed any more. Available tomorrow.