User Tools

Site Tools


multilingual_sites

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
multilingual_sites [2015/07/02 17:09] – created adminmultilingual_sites [2026/03/21 10:11] (current) – external edit 127.0.0.1
Line 1: Line 1:
- 
 ====== Multilingual Sites ====== ====== Multilingual Sites ======
  
 +This feature lets you create multiple translated versions of a site on one domain. See the FAQ [[New Rotation Hints]] section "Site menu translation (i18)" for interface translation. Here we'll cover translating content.
  
-It'pretty easy to create a multilingual site.+Start by creating additional languages in Rotation - Settings - Multilingual. Then, when editing galleries, you can provide a description for each language. For automatic translation, use [[Google translate]]. Let'say you've added German (de) and Spanish (es) to your English (en) site.
  
-First of all, open Rotation Settings,  multilingual tab. Add as many languages as you wantNote, that each language is basically a new slave site so your DB will grow accordingly.+Switch languages by adding &force_lng=..to the URL (de or es in this example).
  
-Since this moment you'll ba able t edit descriptions for each gallery in each language.  And you can see each gallery in each language using following link (w\o rewrites so you can grasp an idea) http://domain/scj/tube/?slug=...&force_lng=...+**There are 2 ways to display the correct language** via 2 options in Rotation - Settings - Multilingual:
  
-An easy way to create links is to have following lines in you .htaccess file+1. Auto Switch language - the URL stays the same, but the page language changes based on browser language 
 + 
 +2. Auto redirect to existing language - the URL changes, and the language is always fixed for that URL regardless of browser settings 
 + 
 + 
 +**Auto Switch language** 
 + 
 +The script reads the browser's language preference from HTTP headers and displays the page in that language. The URL doesn't change. Simply enable this option to show the same page in different languages based on browser settings. 
 + 
 +**Auto redirect to existing language** 
 + 
 +This option redirects users to a language-specific URL. The default pattern is: 
 + 
 +  http://{DOMAIN}/{LANGUAGE}/{ORIGINAL_REQUEST} 
 + 
 +For example, a request to http://domain/category/asd/ with language set to ru will redirect to http://domain/ru/category/asd/ (assuming ru is configured). Pages accessed via http://domain/ru/category/asd/ are always in Russian, regardless of browser language. 
 + 
 +To enable this, add the default rewrite rule at the start of .htaccess:
  
 <code> <code>
Line 18: Line 35:
 </code> </code>
  
-and links like http://domains/de/gallery/cool/index.html+Of course, you can create your own URL patterns.
  
-but feel free to modify links and rewrite in anyway. 
  
 +**Subdomains**
  
-====== Site Internationalization (i18n======+If you use language subdomains (de.domain.com, fr.domain.com, etc.), point them all to the main domain in your Apache config and add this rewrite:
  
-If you also want to translate site's menu you can do the following 
- 
-1. create custom template , let's say languages  
 <code> <code>
-<?php  
-$my_keywords['en'] = array( 
-  'most_popular' => 'Most popular', 
-  'order_by_date' => 'Order By Date', 
-  and so on 
-); 
  
-$my_keywords['de'= array( +RewriteCond %{HTTP_HOST} ^([a-z]{2})\.domain\.com$ [NC
-  'most_popular' => 'Populärste', +RewriteRule ^ %{REQUEST_URI}?force_lng=%1 [QSA,L]
-  'order_by_date' => 'Sortiert nach Datum', +
-  and so on +
-);+
  
-and so on as many languages as you want+</code>
  
  
 +Each language can maintain statistics separately via two options: Own category stats and Own thumb stats.
  
-if ($_GET['force_lng'] and isset($my_keywords[$_GET['force_lng']])) { +If both are disabled, you get a simple translation. This is good for SEO.
-  $lang = $my_keywords[$_GET['force_lng']]; +
-} else $lang = $my_keywords[$_GET['en']];+
  
-That's it. +**Own category stats** - When enabledcategory thumbnails are sorted by click stats for that specific languageFor example, clicks on http://domain/ and http://domain/de/ are counted separately. This is useful when comparing languages with different user preferences (e.g., jp vs en may have very different category popularity).
-As you can see here if you have &force_lng in URL – it will load appropriate languageotherwise it will be english. +
-</code>+
  
-2In each template, where you need any translations add+**Own thumb stats** - Gallery thumbnails get separate statistics per languageThe system creates an additional set of category thumbnails to ensure category headers appear first. If you enable this without Own category stats, the category thumbnail may differ from other top thumbnails in that category.
  
-<code> +===== Auto Switch language =====
-<!--INCLUDE_TEMPLATE_languages--> +
-</code>+
  
 +This option displays the translation on the same URL.
  
-3. in templates replace actual phrases with variables +When a user with DE language (if configured) visits the site, the page automatically displays in DE without changing the URL. 
-<code> + 
-Most popular => <?=$lang['most_popular']?> +To clarify: **Auto redirect to existing language** - redirects to a language-specific URL (language visible in the URL). 
-Order By Date =>  <?=$lang['order_by_date']?> +**Auto Switch language** - displays the correct language without redirecting (language not visible in the URL). 
-and so on + 
-</code>+===== Save language preferences ===== 
 + 
 +Saves the user's language preference in a cookie. Only relevant for **Auto Switch language**. 
 + 
 +To redirect users to the **main language** (ignoring their saved cookie), use **&force_lng=main**. 
 + 
 + 
 +===== GeoIP Based ===== 
 + 
 +Beyond browser language, you can rotate by country using GeoIP. 
 + 
 +Create a language like FR (you don't need translations, but Own thumb stats is required for separate rotation stats). Then decide that traffic from France (and Belgium, for example) should be counted as FR. In the language settings, add GeoIP codes in the "+ GeoIP Codes" field: FR,BE. 
 + 
 +This setting takes priority. For example, if you have FR and DE languages, a user with browser language DE but an IP from Belgium will be counted as FR, not DE. 
 + 
 +This lets you group countries together.
  
-So at this point you should see translations if you open let's say index page as http://domain/?force_lng=...+Don't create separate rotations for every language unless necessary—you'll need to manage rotations separately for each group, and you need sufficient traffic to justify it.
  
  
 +===== Translations =====
  
 +Translating the site menu (links like "Most Popular", "Order By Date", etc.) is straightforward.
  
 +Go to Rotation - CMS Templates - Tpl Custom Var and add custom variables like most_popular. Use these in templates as <!--CUSTOM_VAR_MOST_POPULAR-->. You can set a different translation for each language.
  
  
multilingual_sites.1435856945.txt.gz · Last modified: (external edit)