User Tools

Site Tools


multilingual_sites

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
multilingual_sites [2018/02/25 08:54] – external edit 127.0.0.1multilingual_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**
  
-====== Categories and galleries ======+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:
  
-You can edit language data for each category and galleries.  +<code>
-Note, that you have some options here: you can have just translations, and\or separate stats for category thumbs, and\or separate stats for thumbs. Os course, if you select separate stats for thumbs you'll need more traffic to rotate and calculate thumbs' ctr.+
  
-====== Site Internationalization (i18n) ======+RewriteCond %{HTTP_HOST} ^([a-z]{2})\.domain\.com$ [NC] 
 +RewriteRule ^ %{REQUEST_URI}?force_lng=%1 [QSA,L]
  
-If you also want to translate site's menu you can do the following+</code>
  
-1. create custom template , let's say languages  
-<code> 
-<?php  
-$my_keywords['en'] = array( 
-  'most_popular' => 'Most popular', 
-  'order_by_date' => 'Order By Date', 
-  and so on 
-); 
  
-$my_keywords['de'] = array( +Each language can maintain statistics separately via two options: Own category stats and Own thumb stats.
-  'most_popular' => 'Populärste', +
-  'order_by_date' => 'Sortiert nach Datum', +
-  and so on +
-);+
  
-and so on as many languages as you want+If both are disabled, you get a simple translation. This is good for SEO.
  
 +**Own category stats** - When enabled, category thumbnails are sorted by click stats for that specific language. For 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).
  
 +**Own thumb stats** - Gallery thumbnails get separate statistics per language. The 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.
  
-if ($_GET['force_lng'] and isset($my_keywords[$_GET['force_lng']])) { +===== Auto Switch language =====
-  $lang $my_keywords[$_GET['force_lng']]; +
-} else $lang $my_keywords[$_GET['en']];+
  
-That's it. +This option displays the translation on the same URL.
-As you can see here if you have &force_lng in URL – it will load appropriate language, otherwise it will be english. +
-</code>+
  
-2. In each templatewhere you need any translations add+When a user with DE language (if configured) visits the sitethe page automatically displays in DE without changing the URL.
  
-<code> +To clarify: **Auto redirect to existing language** redirects to a language-specific URL (language visible in the URL). 
-<!--INCLUDE_TEMPLATE_languages--> +**Auto Switch language** displays the correct language without redirecting (language not visible in the URL).
-</code>+
  
 +===== Save language preferences =====
  
-3. in templates replace actual phrases with variables +Saves the user's language preference in a cookie. Only relevant for **Auto Switch language**. 
-<code> + 
-Most popular => <?=$lang['most_popular']?> +To redirect users to the **main language** (ignoring their saved cookie), use **&force_lng=main**. 
-Order By Date =>  <?=$lang['order_by_date']?> + 
-and so on + 
-</code>+===== 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.1519548862.txt.gz · Last modified: by 127.0.0.1