<?xml version="1.0"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>Forum posts to 'Archive'</title>
		<link>http://www.silverstripe.org/archive/rss</link>
		<atom:link href="http://www.silverstripe.org/archive/rss" rel="self" type="application/rss+xml" />
		<description></description>

		
		<item>
			<title>Re: Pretty i18n URLs: alternative (for multilingual pages)</title>
			<link>http://www.silverstripe.org/archive/show/235501?start=0#post238861</link>
			<description>&lt;p&gt;Hi Anatol,&lt;/p&gt;&lt;p&gt;I have got it to work now, just needed to run a  i18n/textcollector/  everytime I add a new language in the cms. Will try the .htaccess mod_rewrite function you suggested today, thank you very much for your great support. When you pop down to Christchurch, let me know, I will show you around.&lt;/p&gt;&lt;br&gt;&lt;br&gt;Posted to: Pretty i18n URLs: alternative (for multilingual pages) &lt;a href=&quot;http://www.silverstripe.org/archive/show/235501?start=0#post238861&quot;&gt;Show Thread&lt;/a&gt; | &lt;a href=&quot;http://www.silverstripe.org/archive/reply/235501?start=0#post238861&quot;&gt;Post Reply&lt;/a&gt;</description>
			<pubDate>Fri, 28 Nov 2008 14:11:52 +1300</pubDate>
			<dc:creator>kudesign</dc:creator>
			<guid>http://www.silverstripe.org/archive/show/235501?start=0#post238861</guid>
		</item>
		
		<item>
			<title>Re: Pretty i18n URLs: alternative (for multilingual pages)</title>
			<link>http://www.silverstripe.org/archive/show/235501?start=0#post238743</link>
			<description>&lt;p&gt;Anatol, thanks for your detailed reply!&lt;/p&gt;&lt;p&gt;In your opinion, is silverstripe an ideal CMS for dev a multi-lingual site? I came across another CMS called quick.CMS, it does multi-lingual contents out-of-the-box. Modx also allow easy setup for multilingual contents, it uses redirect... I prefer the SS user interface, and all I want to know is if SS is worth my time doing further dev with multi-lingual.&lt;/p&gt;&lt;p&gt;I am having abit of a trouble enabling i18n, getting the ?lang=en  ?lang=zh  ?lang=fr to work in my url, was wondering if you could briefly talk me through the process?&lt;/p&gt;&lt;p&gt;1. in mysite/_config.php, I enabled  &lt;br /&gt;&lt;div class=&quot;codesnippet&quot;&gt;&lt;p&gt;i18n::enable();&lt;/p&gt;&lt;/div&gt;&lt;br /&gt;2. I set the locale to      &lt;br /&gt;&lt;div class=&quot;codesnippet&quot;&gt;&lt;p&gt;i18n::set_locale('en_GB');&lt;/p&gt;&lt;/div&gt;&lt;br /&gt;3. I did a text collect:  http://&amp;lt;mysite&amp;gt;/i18n/textcollector/&lt;br /&gt;4. I made dataobject translatable   &lt;br /&gt;&lt;div class=&quot;codesnippet&quot;&gt;&lt;p&gt;class Team extends DataObject {&lt;br /&gt;  static $db = array(&lt;br /&gt;    &quot;Name&quot; =&amp;gt; &quot;Varchar&quot;,&lt;br /&gt;    &quot;FoundedDate&quot; =&amp;gt; &quot;Date&quot;,&lt;br /&gt;    &quot;Description&quot; =&amp;gt; &quot;Text&quot;,&lt;br /&gt;  );&lt;/p&gt;&lt;p&gt;  // we don't want all fields to be translated (wouldn't make sense for a date, right?)&lt;br /&gt;  static $extensions = array(&lt;br /&gt;    &quot;Translatable('Description')&quot;&lt;br /&gt;  );&lt;br /&gt;}&lt;/p&gt;&lt;/div&gt;&lt;/p&gt;&lt;p&gt;5. I ran a /db/build/flush=1&lt;/p&gt;&lt;p&gt;6. In CMS, I added under the 'Translation' tab, the languages I wanted to include for my site.&lt;/p&gt;&lt;p&gt;Is that all I needed to do to enable multilingual contents? I can't seem to get ?lang=en, ?lang=zh, ?lang=fr to work properly... Please check for me. &lt;/p&gt;&lt;p&gt;Thank you very much!&lt;/p&gt;&lt;br&gt;&lt;br&gt;Posted to: Pretty i18n URLs: alternative (for multilingual pages) &lt;a href=&quot;http://www.silverstripe.org/archive/show/235501?start=0#post238743&quot;&gt;Show Thread&lt;/a&gt; | &lt;a href=&quot;http://www.silverstripe.org/archive/reply/235501?start=0#post238743&quot;&gt;Post Reply&lt;/a&gt;</description>
			<pubDate>Fri, 28 Nov 2008 12:59:53 +1300</pubDate>
			<dc:creator>kudesign</dc:creator>
			<guid>http://www.silverstripe.org/archive/show/235501?start=0#post238743</guid>
		</item>
		
		<item>
			<title>Re: Pretty i18n URLs: alternative (for multilingual pages)</title>
			<link>http://www.silverstripe.org/archive/show/235501?start=0#post238524</link>
			<description>&lt;p&gt;Hi,&lt;/p&gt;&lt;p&gt;Just do the changes in one line:&lt;/p&gt;&lt;p&gt;&lt;div class=&quot;codesnippet&quot;&gt;&lt;p&gt;# MULTILINGUAL SUBDOMAIN SETTINGS&lt;br /&gt;RewriteCond %{HTTP_HOST} ^(en|mi|fr|zh)\.domain\.com&lt;br /&gt;RewriteRule ^(.*) $1?lang=%1&amp;amp;%{QUERY_STRING}&lt;/p&gt;&lt;/div&gt;&lt;/p&gt;&lt;p&gt;Don't forget to change the domain to your domain name in the same line.&lt;/p&gt;&lt;p&gt;What the RewriteCond line does is that it checks the subdomain of your domain name. If it is e.g. MÄori (mi.domain.com) it will simply translate that url and open the page domain.com/?lang=mi . This happens internally on the server, the URL in the browser remains mi.domain.com .&lt;/p&gt;&lt;p&gt;To explain what is happening e.g. for the domain &lt;strong&gt;mi.domain.com&lt;/strong&gt;:&lt;/p&gt;&lt;p&gt;&lt;div class=&quot;codesnippet&quot;&gt;&lt;p&gt;RewriteCond %{HTTP_HOST} ^(en|mi|fr|zh)\.domain\.com&lt;/p&gt;&lt;/div&gt;&lt;br /&gt;This line checks if the domain 'domain.com' has a subdomain 'en' or 'mi' or 'fr' or 'zh'. If it does then the URL is translated in the following line:&lt;/p&gt;&lt;p&gt;&lt;div class=&quot;codesnippet&quot;&gt;&lt;p&gt;RewriteRule ^(.*) $1?lang=%1&amp;amp;%{QUERY_STRING}&lt;/p&gt;&lt;/div&gt;&lt;/p&gt;&lt;p&gt;^(.*) is a regular expression and for Silverstripe URLs it contains the page name (e.g. mi.domain.com/&lt;strong&gt;news/&lt;/strong&gt; . The value in brackets (&lt;strong&gt;.*&lt;/strong&gt;) - in this example 'news/' - is stored in the variable $1. The subdomain in brackets (&lt;strong&gt;en|mi|fr|zh&lt;/strong&gt;) from the RewriteCond line is stored in the variable %1 - in this example 'mi'. So knowing that $1 is 'news/' and %1 is 'mi' you can easily rewrite the URL.&lt;/p&gt;&lt;p&gt;The {QUERY_STRING} in the RewriteRule line simply ensures that other values (e.g. mi.domain.com/news/?&lt;strong&gt;executeForm=SearchForm&amp;amp;Search=test&lt;/strong&gt;) will be passed on, too.&lt;/p&gt;&lt;p&gt;So &lt;strong&gt;$1?lang=%1&amp;amp;%{QUERY_STRING}&lt;/strong&gt; is the translated string.&lt;/p&gt;&lt;p&gt;e.g. a slightly more complex URL like&lt;br /&gt;&lt;strong&gt;mi.domain.com/news/?executeForm=SearchForm&amp;amp;Search=test&lt;/strong&gt;&lt;br /&gt;becomes&lt;br /&gt;&lt;strong&gt;/news/?lang=mi&amp;amp;executeForm=SearchForm&amp;amp;Search=test&lt;/strong&gt;&lt;br /&gt;on the server side.&lt;/p&gt;&lt;p&gt;Anyway, the only line you need to adjust is RewriteCond.&lt;/p&gt;&lt;p&gt;Rewrite Rules (the Apache mod_rewrite module) can be very powerful. I'm certainly no expert, but I find my way around with some trial and error. There are many tutorials out there to make things clearer. A beginners one is &lt;a href=&quot;http://www.workingwith.me.uk/articles/scripting/mod_rewrite&quot;&gt;http://www.workingwith.me.uk/articles/scripting/mod_rewrite&lt;/a&gt;&lt;/p&gt;&lt;p&gt;Cheers!&lt;br /&gt;Anatol&lt;/p&gt;&lt;br&gt;&lt;br&gt;Posted to: Pretty i18n URLs: alternative (for multilingual pages) &lt;a href=&quot;http://www.silverstripe.org/archive/show/235501?start=0#post238524&quot;&gt;Show Thread&lt;/a&gt; | &lt;a href=&quot;http://www.silverstripe.org/archive/reply/235501?start=0#post238524&quot;&gt;Post Reply&lt;/a&gt;</description>
			<pubDate>Fri, 28 Nov 2008 10:25:42 +1300</pubDate>
			<dc:creator>Anatol</dc:creator>
			<guid>http://www.silverstripe.org/archive/show/235501?start=0#post238524</guid>
		</item>
		
		<item>
			<title>Re: Pretty i18n URLs: alternative (for multilingual pages)</title>
			<link>http://www.silverstripe.org/archive/show/235501?start=0#post238239</link>
			<description>&lt;p&gt;Kiora, thanks for an innovative way to deal with multi-lingual! if i want to switch between 3 or 4 different languages, do I just add in additional languages in the .htaccess file? e.g:&lt;/p&gt;&lt;p&gt;# MULTILINGUAL SUBDOMAIN SETTINGS&lt;br /&gt;RewriteCond %{HTTP_HOST} ^(en|mi)\.domain\.com&lt;br /&gt;RewriteCond %{HTTP_HOST} ^(fr|mi)\.domain\.com&lt;br /&gt;RewriteCond %{HTTP_HOST} ^(zh|mi)\.domain\.com&lt;br /&gt;RewriteRule ^(.*) $1?lang=%1&amp;amp;%{QUERY_STRING}&lt;/p&gt;&lt;p&gt;sorry, I am new to coding... cheers!!&lt;/p&gt;&lt;br&gt;&lt;br&gt;Posted to: Pretty i18n URLs: alternative (for multilingual pages) &lt;a href=&quot;http://www.silverstripe.org/archive/show/235501?start=0#post238239&quot;&gt;Show Thread&lt;/a&gt; | &lt;a href=&quot;http://www.silverstripe.org/archive/reply/235501?start=0#post238239&quot;&gt;Post Reply&lt;/a&gt;</description>
			<pubDate>Fri, 28 Nov 2008 01:41:50 +1300</pubDate>
			<dc:creator>kudesign</dc:creator>
			<guid>http://www.silverstripe.org/archive/show/235501?start=0#post238239</guid>
		</item>
		
		<item>
			<title>Pretty i18n URLs: alternative (for multilingual pages)</title>
			<link>http://www.silverstripe.org/archive/show/235501#post235501</link>
			<description>&lt;p&gt;Hi,&lt;/p&gt;&lt;p&gt;I am currently building my first multilingual Silverstripe site. Here is an alternative way (compare &lt;a href=&quot;http://doc.silverstripe.com/doku.php?id=recipes:pretty_i18n_urls&amp;amp;s=i18n&quot;&gt;recipes:pretty_i18n_urls&lt;/a&gt;) to build pretty URLs of the kind &lt;strong&gt;en.domain.com/news/&lt;/strong&gt; instead of &lt;strong&gt;domain.com/news/?lang=en&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;It does not require any changes in the Silverstripe core code, but you may have to add some DNS entries for your domain.&lt;/p&gt;&lt;p&gt;All the magic happens in the .htaccess file. Simply add the &lt;strong&gt;&lt;span style=&quot;color:red&quot;&gt;red&lt;/span&gt;&lt;/strong&gt; lines to your .htaccess file and adjust them to your needs:&lt;/p&gt;&lt;p&gt;&lt;div class=&quot;codesnippet&quot;&gt;&lt;p&gt;### SILVERSTRIPE START ###&lt;br /&gt;RewriteEngine On&lt;br /&gt;RewriteBase /&lt;/p&gt;&lt;p&gt;&lt;strong&gt;&lt;span style=&quot;color:red&quot;&gt;# MULTILINGUAL SUBDOMAIN SETTINGS&lt;br /&gt;RewriteCond %{HTTP_HOST} ^(en|mi)\.domain\.com&lt;br /&gt;RewriteRule ^(.*) $1?lang=%1&amp;amp;%{QUERY_STRING}&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;RewriteCond %{REQUEST_URI} !(\.gif)|(\.jpg)|(\.png)|(\.css)|(\.js)|(\.php)$ &lt;/p&gt;&lt;p&gt;RewriteCond %{REQUEST_URI} ^(.*)$&lt;br /&gt;RewriteCond %{REQUEST_FILENAME} !-f&lt;br /&gt;RewriteRule .* sapphire/main.php?url=%1&amp;amp;%{QUERY_STRING} [L]&lt;br /&gt;### SILVERSTRIPE END ###&lt;/p&gt;&lt;/div&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;(en|mi)&lt;/strong&gt; are the language codes for the available translations of your site. In this case it's English and MÄori, for e.g. English, French and German just use &lt;strong&gt;(en|fr|de)&lt;/strong&gt; instead.&lt;/p&gt;&lt;p&gt;In the same line also replace &lt;strong&gt;\.domain\.com&lt;/strong&gt; with your domain name.&lt;/p&gt;&lt;p&gt;This simply translates the URL &lt;strong&gt;en.domain.com/news/&lt;/strong&gt; to &lt;strong&gt;domain.com/news/?lang=en&lt;/strong&gt;. No links or references to files and images need to be changed.&lt;/p&gt;&lt;p&gt;URLs such as &lt;a href=&quot;http://www.domain.com&quot;&gt;www.domain.com&lt;/a&gt;, domain.com, &lt;a href=&quot;http://www.domain.com/news&quot;&gt;www.domain.com/news&lt;/a&gt; and domain.com/news will display your default language.&lt;/p&gt;&lt;p&gt;I had to add CNAME entries to my DNS records to make it work, i.e.:&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Name:&lt;/strong&gt; mi.domain.com&lt;br /&gt;&lt;strong&gt;TTL:&lt;/strong&gt; 3600&lt;br /&gt;&lt;strong&gt;Type:&lt;/strong&gt; CNAME&lt;br /&gt;&lt;strong&gt;Value:&lt;/strong&gt; domain.com. (add the trailing dot &quot;.&quot;)&lt;/p&gt;&lt;p&gt;And the same for en.domain.com&lt;/p&gt;&lt;p&gt;(It may take a couple of minutes to a few hours until these new DNS entries are propagated and you can see the effect.)&lt;/p&gt;&lt;p&gt;This method solves a couple of problems I had with multilingual pages:&lt;/p&gt;&lt;p&gt;* The URL is unique for each language (no browser caching problems and no need to set &quot;HTTP::set_cache_age(0);&quot; in the _config.php file which would slow down everything)&lt;/p&gt;&lt;p&gt;* I would like to use the existing &lt;a href=&quot;http://doc.silverstripe.com/doku.php?id=recipes:pretty_i18n_urls&amp;amp;s=i18n&quot;&gt;pretty_i18n_urls&lt;/a&gt; recipe but I never liked that &lt;em&gt;&lt;span style=&quot;color:gray&quot;&gt;&quot;you need to have distinct page names for all languages. /en/news and /fr/news will give you the news page from the default language. SS does not honor language/page combinations, it.seems&quot;&lt;/span&gt;&lt;/em&gt; It is no problem to have the same page name for all languages with the method described here.&lt;/p&gt;&lt;p&gt;* I quite like that I don't have to touch core code (or any PHP code).&lt;/p&gt;&lt;p&gt;This method is not yet much tested but so far it works for me without problems. Any comments and suggestions are welcome.&lt;/p&gt;&lt;p&gt;Just as a thought (this is completely untested): I think with another .htaccess rewrite rule it should be quite easy to enable translated images. You would just have to check a folder that contains language specific images: if the image exists then use it, otherwise use the image of the default language.&lt;/p&gt;&lt;p&gt;I hope this is helpful.&lt;/p&gt;&lt;p&gt;Cheers!&lt;br /&gt;Anatol&lt;/p&gt;&lt;br&gt;&lt;br&gt;Posted to: Pretty i18n URLs: alternative (for multilingual pages) &lt;a href=&quot;http://www.silverstripe.org/archive/show/235501#post235501&quot;&gt;Show Thread&lt;/a&gt; | &lt;a href=&quot;http://www.silverstripe.org/archive/show/235501#post235501&quot;&gt;Post Reply&lt;/a&gt;</description>
			<pubDate>Mon, 24 Nov 2008 17:46:41 +1300</pubDate>
			<dc:creator>Anatol</dc:creator>
			<guid>http://www.silverstripe.org/archive/show/235501#post235501</guid>
		</item>
		

	</channel>
</rss>