Multi lingual support

General chit chat about razor, not specifically related to a topic but about razorCMS

Multi lingual support

Postby smiffy6969 » Wed Mar 07, 2012 7:39 pm

Hi All,

I have temporarily stopped on version 2 for a short while, I have a few websites to get out the way, and also I want to add in multilingual support to razor 1.X.

First question, how do people feel this would be best handled?.

1) All page data is the same for each language (title, page link, meta data, cats), but we have multiple content blocks per language and based on the language selected, it loads the correct content.
2) Some of the data is common to all languages (meta, page links), other data is per language (content, title etc.)
3) Al language variants have completely their own data, basically we just double up on the whole datastore directory for each language (will mean issues with saving backups etc.)

Next, how would we like this to be handled, my view is the following.....

1) We click on a page to edit or create a new page, and we have the normal page come up, BUT, this page has tabs on it, where we can click on a tab to see the page for different langauges. This keeps things organised well, and would not mean much more navigation to get to your language variants.
2) We have different sections in teh menu system entirely for different languages when creating content.

Finally.. How do you see the best way to switch langauges in the front end, and how do we go about selecting the correct language page.

1) Have autogenerated link using a socket in the header of the public section, this loads a language bar or flags, that switch
2) You do this your self in your theme


1) We use subdomains for language switching (,
2) We use page for language switching (,
3) Using get variables (,
or my favorite
4) Using sessions ( but using session (or maybe cookie)

All of the above have drawbacks, sessions or cookies is cleaner, you still only see one site (so doesn't mess with page ranking) can remember your choice for XXX amount of time (need to kill cookies based on new EU law after XXX time).

Any thoughts on how you guys would want this to work. I feel it's a BIG missing link, unfortunately I have no need of it at present, but I hear you all and you do need this, it is important. So you who are going to use this feature the most, what are your thoughts.

Posts: 1866
Joined: Sat May 24, 2008 8:18 am
Location: Loughborough, UK

Re: Multi lingual support

Postby Adminer » Wed Mar 07, 2012 11:55 pm

Now you should have so many skins created as you want to have number of languages.
When I was creating such site like this, I have to create categories: sidebar, sidebar-de, sidebar-en, the same way for top-navigation, top-navigation-de, top-navigation-en, and the same with the footer.

There is a one big problem to solve: the same names for the links.
In Poland I have for example kontakt.htm, in english it's contact.htm, but in germany.... it is the kontakt.htm too (so I must to eliminate the same name).
So - how to find easy solution for the same names for our pages - it's the point.

My working multilanguage site based on engine from razorCMS (in my polish fork rCMS I was adding more themes to use - so now I may have 8 languages :mrgreen: in this way, by creation one theme for one language to use).
To ilustrate my working solution:
(BTW, please, check google translation is correct there?, and help me to eliminate language bugs if you can find any).

Posts: 578
Joined: Wed Apr 08, 2009 9:52 pm
Location: Poland

Re: Multi lingual support

Postby gbon » Tue Mar 13, 2012 3:30 pm

Hi Smiffy,

I just was taking a look at Razor since yesterday I got a request to help with a university's laboratory page and I saw it's made using Razor.
So far I find it great, nice work!

One of the things that I stumbled upon is that the page should be in three languages as it's from an argentinian university but cooperates with people from france and also english is a must on scientific works. So this change would be great (they currently use google translate) !

Now regarding your questions,

First: I would go for 1, same structure, content on different languages.
Next: 1, this is how qTranslate does it for Wordpress and it's really quick when you're writing stuff.
1 - I would go for both possibilities allowing the user to disable 1 if he wants to use his own switcher.
2 - Subdomains are cool but some users may have troubles to configure it, you could use sessions (sessions usually use cookies anyway) overridable by a get variable if necessary allowing you to use a redirect rule in htaccess to switch languages. A really cool feature that helps with SEO is to enable page name per language but it's harder to implement.

Thanks for you work,
Posts: 2
Joined: Tue Mar 13, 2012 3:20 pm

Re: Multi lingual support

Postby Adminer » Wed Mar 14, 2012 10:49 am

IMHO, we need to create a new page:
- declaration, how many languages we need in configuration tab. If any:
language selector:,en,de, etc... will be working - so that information may be easy to display by ?lang=de

Language selector may add changes to the category names: now we have top-navigation, sidebar, footer, mylinks,
but with multilanguage site it's may be with a language selector. So in the end, top-navigation-de, sidebar-fr, footer-pl etc... categories we may have to use in our national themes. Every new category will create the same category name with language selector in our database - but unlimited themes we should have in razorCMS now.

And when we go to create a new page, we select language selector first, we set category to the page like sidebar-de, put the name of the page which may be glue with this language selector, but a new field will be required to description, how link should be displayed there.

So, If we set 'de' in selector, kontakt for name of our link, that name will be transformed to the kontakt-de in razordatabase, and the table will glue this information kontakt-de to display our link with the name kontakt.htm?lang=de
If we set 'pl' in selector, kontakt for name of our link, that name will be transformed to the kontakt-pl in razordatabase, and the table will glue this information kontakt-pl to display link with the name kontakt.htm?lang=pl
So, now we have the name of our link to display link, in new multilanguage razor the name should be a place to glue with a new name of link. Names of the links may be the same, because language selector is required there to select txt file to display.
It's my proposal.

Posts: 578
Joined: Wed Apr 08, 2009 9:52 pm
Location: Poland

Re: Multi lingual support

Postby Adminer » Sat Mar 17, 2012 6:23 pm

Did you use Page Title (optional) field when you create new pages? I never...
So, I discovered that if I use this table - i can display everything what i like - so I have no any problem to display many kontakt.htm links or many contact.htm links in razorCMS now.
The hint is to use Page Title (optional) filed always and a little change in function in /core:
Code: Select all
 // fetch links array //
    function getLinksArray( $cat ) {
        global $razorArray;
        $cdt = $razorArray['links_cats'];
        if( in_array( $cat, array_keys($cdt) ) ) {
            $scids = $cdt[$cat];
            $slabs = $razorArray['slabs'];
         // $titles = $razorArray['titles'];
            $titles = $razorArray['ptitles'];
            $dslabs = array();
            foreach( $scids as $sid ) {
                $dslabs[ $slabs[$sid] ] = $titles[$sid];
            return $dslabs;
        } else {
            return '';
    // end ///////////////

All my links are displayed now by $titles = $razorArray['ptitles']; table, from the names from ptitles razor table - now I may have many the same links in razorCMS. So, now I can have 'Lomi Lomi Nui' :mrgreen: link in my polish version of the site, in english and german version the same site too. Now I must do something in code to write ptitles always, because if not, I have no links ;-)
One step more to easy life in multilanguage site... ;-)

Now it's the only one problem to solve - multilanguages categories. External links are not working too. To do.
Now I have to create all multilanguage categories manualy: sidebar, sidebar-de, sidebar-en - if I have 3 flags - it's not a big problem, like three new themes to display them.

Posts: 578
Joined: Wed Apr 08, 2009 9:52 pm
Location: Poland

Re: Multi lingual support

Postby jaskorhov213 » Mon Mar 19, 2012 2:48 am

Last edited by jaskorhov213 on Fri Mar 30, 2012 12:22 am, edited 1 time in total.
Posts: 1
Joined: Mon Mar 19, 2012 2:36 am

Re: Multi lingual support

Postby smiffy6969 » Mon Mar 19, 2012 8:32 pm

Your post has no substance, I can spot you spammers a mile away, stop or i'll ban your whole ip range.

Posts: 1866
Joined: Sat May 24, 2008 8:18 am
Location: Loughborough, UK

Return to General Discussions

Who is online

Users browsing this forum: No registered users and 1 guest