Vadiklk
Vadiklk

Reputation: 3764

Multi languages site

I have a site with texts in 2 languages. How should I go between the pages so that from the point that he clicked to change the language he will see it and the moment he clicks the other language, it will change back?

An option is that when the user clicks the link to change the language I will store it into the session and use it. But I've heard it won't work well with the search engines.

A second option is to pass the language variable through the URL to every page.

Third option is to smartly use the zend extension ability.

(Using PHP + Zend Framework). SEO is very important to me.

EDIT: The texts that are in the site(and that are in several languages), are entered by an admin. It works now with languages objects that I've created with the option for the admin to add texts in each of them. So when I'll enter the first page(of which the text can be changed) I'll see it in English and when I click the Russian flag it will display that page(and the others later) in Russian.

Using Zend_Locale or translate won't work for me(I think), and passing through the URL is an option. The question is if it is the best one?

Upvotes: 0

Views: 185

Answers (2)

timdev
timdev

Reputation: 62914

Zend Framework provides a pretty solid set of tools for this.

Start with Zend_Locale and Zend_Translate

It ought to be possible to tweak ZF's routing to contain a segment that indicates the locale. So you'd end up something like /:locale/:controller/:action (or similar). Your URLs would then look like http://example.com/en/some-controller/some-action.

Note that there's more than just translation of language. You can also localize the display of numbers, currency, dates, etc.

Come back with more specific questions once you've played with those.

Upvotes: 2

lyricat
lyricat

Reputation: 1996

It is best to pass it along as a parameter in the URL, google uses locale=en for this. It would also be ok to store it in the session only if the user is logged into your website and selected a preferred locale or something. That way search engines can index the different locales with different urls, but your users would see pages in whatever locale they have chosen.

Upvotes: 2

Related Questions