Multi-Lingual Website support

Get help with installation and running PivotX 2.0.x here. Please do not post Extension or Theme related questions here.

Multi-Lingual Website support

Postby hansfn » Thu Jul 15, 2010 9:34 am

As you know, PivotX is translated to many languages (more or less complete). You also now that you can have many weblogs, and that each weblog can have different language settings. In addition you can associate a page to a weblog (by adding a weblog parameter) and hence indirectly setting the language for the page.

In other words, you can quite easily run a multi-lingual website with PivotX. The only "hard" thing is to make a proper navigation. This thread is meant as a placeholder for different solution techniques and related discussions.

NB! If you decide to use different weblogs for each language, I strongly recommend setting para_weblog_always to 1 in the advanced configuration.
hansfn
Developer
 
Posts: 3282
Joined: Sun Nov 25, 2007 7:48 pm
Location: Molde, Norway

Re: Multi-Lingual Website support

Postby hansfn » Thu Jul 15, 2010 9:37 am

The first solution is to use the Weblog-Menus extension (for Multi-Lingual Website support). It works very well, but requires that you use a particular naming scheme for the chapters and pages. A very little burden indeed. Highly recommended - see the forum thread for more details.
hansfn
Developer
 
Posts: 3282
Joined: Sun Nov 25, 2007 7:48 pm
Location: Molde, Norway

Re: Multi-Lingual Website support

Postby hansfn » Thu Jul 15, 2010 9:59 am

The second solution is to use the Hierarchical Menus extension. If you have any questions related to this approach, please ask in the dedicated forum thread.

Anyway, this is the procedure - quite similar to the weblog-menus setup. In this example I'll assume that you plan to support English and French.

1) Create two weblogs name English and French (or Français).
2) Create two chapters named English and French (or Français). These two chapters are index chapter for all pages and chapters belonging to each language. (This is explained in the menu extension documentation, but I'll elaborate some below.)
3) In your templates insert

Code: Select all
[[ menu firstchapter=$modifier.weblog weblog=$modifier.weblog ]]

where you want the menu with all pages and chapters for the current weblog/language.

That's it. You probably want to use the weblog_list template tag too to enable switching between the weblogs/languages.

I have created an example site - visit http://pivotx.net/sandbox/multi-lingual/ which is based on the Bare bones template. You'll find the used templates by visiting the templates directory, but I really only changed _sub_sidebar.html -

----

An example of chapter structure.

Chapter English:
- Page Start
- Page Products
- Page About
Chapter Products
- Page Product 1
- Page Product 2
- ...

Similar for French. This will generate the following menu (for the English weblog):

- Start
- Products
--- Product 1
--- Product 2
--- ...
- About

This works because the page Products in the index chapter matches the (content) chapter Products.
hansfn
Developer
 
Posts: 3282
Joined: Sun Nov 25, 2007 7:48 pm
Location: Molde, Norway

Re: Multi-Lingual Website support

Postby kabaal » Thu Jul 15, 2010 11:00 am

Hey there Hansfn,

great stuff! I have searched all over the web for a decent multi-lingual flatfile-based cms, and I think taking the multi-lingual support one step further will make PivotX a very serious competitor to systems such as Joomla.

For those of you that wish to use either of the options, here's a little code that you can use in your templates to display all available weblogs/languages:
Code: Select all
[[weblog_list format="<a %active% href='%link%' title='%payoff%'>%payoff%</a><br>" current="class='active'" sort="payoff"]]


Taking the idea of multi-linguality (I'm not even sure if that's a real word :-)) one step further, how about the following:

Would it be an idea to optionally assign chapters to weblogs? I'm talking about a general configuration option, whereby, similar to setting categories to weblogs, you'd set chapters for weblogs? Or (idea #2) maybe an alternative to that, which is to optionally exclude chapters for weblogs ?

That way, you could use standard functionality such as pagelist, to display pages that are included for the weblog (or ones that are not excluded from the weblog (idea #2), whichever way you preffer). Sounds like a doable update, I'd personally add that to the weblog-configuration, rather than change the chapter-configuration, but of course you could also decide to have an extra flag in the chapter setup that sets the weblog for specific chapters (idea #3).

I really like the idea of using weblogs as languages (hence my little extension), since it also switches the i18n for dates and such, but still gives you the option of having multiple seperate sites in the same language as well..

What made PivotX powerfull for me, is that I can use standard functionality for 99% of the things I want to do with a "standard" website. I'm using entries for guestbook, entries for upcoming events and event calendars, have a nice gallery, etc.

However, I personally think multi-linguility is extremely important, and I think that a lot more people would choose PivotX for their website if it was generally supported. Fortunately, extensions allow the programmers among us to get almost anything done with PivotX, but wouldn't this be an extremely nice feature for everybody?

Any thoughts?
JDT - Only trying to help...
kabaal
 
Posts: 25
Joined: Fri Jul 09, 2010 7:17 am
Location: Netherlands / Germany

Re: Multi-Lingual Website support

Postby hansfn » Sat Jul 17, 2010 6:12 am

A quick reply before I leave on vacation today. (I'll be off-line for 2 weeks.)

Yes, assigning chapters to weblogs is one solution. We might add that - I kind of like it. However, you can already do something by using extrafields (using the bonus fields extension) for each page, not chapter.
hansfn
Developer
 
Posts: 3282
Joined: Sun Nov 25, 2007 7:48 pm
Location: Molde, Norway

Re: Multi-Lingual Website support

Postby kabaal » Sat Jul 17, 2010 10:00 am

Hi Hans,

I hope you have a nice holiday (though you probably won't read this before you're back)!

Having thought things over a bit, I think the easiest would be to add a configuration option to the chapter itself. Ideally, I think it would make sence that you can optionally add chapters to weblog(s), so some kind of list where you select to which weblog(s) the chapter belongs. If you don't set the weblog, that would mean the chapter belongs to all weblogs and is displayed in all pagelist/etc tags..

Since there is no real "multi-linguality" in pages (one could technically achieve it by adding content fields for different weblogs, but I think it's overdoing things :-)), like having multiple content for different languages, I'd stick to the idea with the chapters. The pages would then be chapter-specific and only in 1 language. Of course one can take the idea further and also add some weblog configuration for pages as well, so that the chapter would be displayable in multiple weblogs but certain pages would only be displayed in specific ones, but I was personally thinking of "an easy way" to accomplish multi-linguality.. (as part of core functionality, I already have multi-linguility with my little weblog-menus extension and language specific categories)

Resumé of my idea:

  • Add a configuration option to the "create chapter" / "edit chapter" panel (and to the database table) where one (or multiple ?) weblogs can be assigned.
  • Add code to the pagelist tag (and similar ones I can't think of right now) that evaluate the chapter's weblog(s) and "hides" chapters (and the belonging pages) that shouldn't be displayed

I do think it would make it even more flexible if one would at some point also add the page weblog config, but I haven't heard many people "complain" about not having multi-linguality as standard functionality, so maybe that's a step for the future.

I would also like to add that I'm not using PivotX as a blogging system, but rather as a multi-lingual website (including newsletters, news items, events, guestbook, gallery and multi-linguality using mostly PivotX-functionality and some minor extension). I know people generally speak of PivotX as a blogging system, but I think it is quite a lot more than that, that's also why I think the system benefits from this particular feature...

Take care,
JDT
JDT - Only trying to help...
kabaal
 
Posts: 25
Joined: Fri Jul 09, 2010 7:17 am
Location: Netherlands / Germany

Re: Multi-Lingual Website support

Postby Austrys » Mon Jul 26, 2010 2:08 pm

This is very good engine, to power-up websites, but still like other good (like SubdreamerCMS) CMS, is the lack of feature that allows to create multi-lingual project. :( Hope this feature will be upcoming goal for futher development of this wonderful community. As this looks very promising to be added in future, I will stick with you. I like PivotX very much. :)
Austrys
 
Posts: 1
Joined: Mon Jul 26, 2010 12:59 pm

Re: Multi-Lingual Website support

Postby kabaal » Thu Jul 29, 2010 10:32 am

I think people see PivotX as a blogging system, which is not entirely true neither entirely wrong. I wasn't looking for a blogging system myself and initially, after trying out bits and bobs, decided PivotX didn't suit my needs for the simple reason that it did not support Multi-Linguility, the first thing I need. After searching on and on, I eventually came back to PivotX, since it allows me to write extensions quite easily and rapidly. With a bit of php and pivotx knowledge, it was quite easy making my entire multi-lingual dynamic website work in PivotX, but... it's not standard functionality yet.. I think it should be (since hans should be back soon, we can discuss that some more :twisted: ).

The combination of flexibility (writing own modules/extensions/widgets), dynamic content management, flat-file support and multi-linguility will make this one of the most powerfull open source CMSs around (IMHO).
JDT - Only trying to help...
kabaal
 
Posts: 25
Joined: Fri Jul 09, 2010 7:17 am
Location: Netherlands / Germany

Multi-Lingual Website Logistics?

Postby Stark Raving » Mon Sep 13, 2010 5:46 am

Okay, I have a multi-language website. I'm curious as to the best way to set it up because I want it to be as easy as possible for the next web manager to understand, as I will one day move on or die or whatever.

So, this site has 4 languages at the moment. I've only put the English and French up so far.

http://art-of-peace.org

Here's the thing: the design is the same; however, each language needs it's own header image, menu, sidebar, and so on. So far, I've created a template folder for each language: for argument's sake, I'll call them english, french, spanish, and portuguese. Each folder contains the usual files like frontpage_template.html, page_template.html, etc., as well as the includes like _sub_header.html, _sub_footer.html, etc. Each folder also contains folders for the css and images.

So, there are 4 sets of template folders. I'm wondering if this is the easiest way to set it up? The css is the same for most things, except for the header image, and maybe a few logos. Really, that seems overkill to have 4 near duplicates of the css file, and that also means that when I change one, I have to go into each template folder to change all of the css files.

I wonder if it would be better to keep all the template files in one folder? Then there would be one folder for the css, and one for the images. And each language would have it's own frontpage template, but I would name them frontpage_template.html (for English), fr_frontpage_template.html (French), etc. I would name the include files in a similar naming pattern: _sub_header.html, _sub_header_fr.html, etc. It seems like this would be easier to maintain.

I've attached a chart of three options.

Am I out to lunch or what? Anyone have any thoughts and/or suggestions?

Much appreciated.
Attachments
Diagram_tmp.jpg
Diagram_tmp.jpg (138.87 KiB) Viewed 17785 times
"After I'm dead I would rather have people ask why I have no monument than why I have one." ~ Cato the Elder

"In heaven all the interesting people are missing." ~ Friedrich Nietzsche
User avatar
Stark Raving
Silver Sponsor
 
Posts: 115
Joined: Tue Dec 11, 2007 9:24 pm
Location: Vancouver

Re: Multi-Lingual Website support

Postby hansfn » Mon Sep 13, 2010 12:36 pm

One folder and one front page template. In the front page template use:

Code: Select all
[[ include file="yourtemplate/_sub_header_`$modifier.weblog`.html" ]]
...
[[ include file="yourtemplate/_sub_footer_`$modifier.weblog`.html" ]]


I'm assuming you are using weblogs for each language.
hansfn
Developer
 
Posts: 3282
Joined: Sun Nov 25, 2007 7:48 pm
Location: Molde, Norway

Next

Return to 2.x Support Forum

Who is online

Users browsing this forum: No registered users and 18 guests

cron