P
P
Petrusha Ukropov2013-11-06 20:12:50
PHP
Petrusha Ukropov, 2013-11-06 20:12:50

Add multilingualism to an existing site?

There is a site. Language versions are implemented by copying the engine to a folder with the name of the language (ru, ua, kz, etc...) The main version is English, located in the root. I didn't do it.
Now the task has become to get rid of this method, i. there should be only one engine in the root of the site. But the language versions should remain at the same links: site.com/ru/ site.com/ua/ site.com/kz/ etc… The
CNC on the site is implemented through the .htaccess file, example:

RewriteRule ^blog/?$	index.php?module=BlogView [L,QSA]

Of course, you can simply write for each rule so that the language is also taken into account, but this is about 30 rules. Plus, when adding a new language, everything needs to be edited again.
In a nutshell: old site.com/ru/ or site.com/kz/ links should lead to the root, but depending on the specified language, give the version in the specified language.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
S
serverkon, 2013-11-06
@servekon

Take a look here , maybe you can borrow something.

O
OnYourLips, 2013-11-06
@OnYourLips

Write an application plugin and, at the stage before routing, put an action that will set the desired language and convert links to a common form.

CNC on the site is implemented through the .htaccess file, example
This was clearly a bad idea.

S
SkiF_TLT, 2013-11-07
@SkiF_TLT

Scatter languages ​​into subdomains:
en. site.ru, de. site.ru, etc.
Then all .htaccess settings will work as before, and you will already define the language in the rules by %{HTTP_HOST} . For example like this:

RewriteCond %{HTTP_HOST} (en|de|fr).site.ru
RewriteRule ^(.*)$ %1%/

(I sketched in a hurry, but something like this)

G
great_boba, 2013-11-07
@great_boba

smarti supports loading configs
in the config, you can load sets of constants to
implement the choice of the config through a known language

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question