Revisiting the multilingual feature of static page plugin

Creating and modifying plugins.
Post Reply
wesley
Regular
Posts: 197
Joined: Sun Jul 10, 2005 11:15 am
Contact:

Revisiting the multilingual feature of static page plugin

Post 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?
I make s9y plugins, too.
My s9y blog depends on them. :)
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: Revisiting the multilingual feature of static page plugi

Post 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

    {$staticpage_content}
    to

    Code: Select all

    {$staticpage_content|multilingual_lang}
  • 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.
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian
wesley
Regular
Posts: 197
Joined: Sun Jul 10, 2005 11:15 am
Contact:

Re: Revisiting the multilingual feature of static page plugi

Post by wesley »

Thanks for the idea. :)
I make s9y plugins, too.
My s9y blog depends on them. :)
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: Revisiting the multilingual feature of static page plugi

Post 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.
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian
Post Reply