💾 Archived View for chirale.org › 2008-07-13_119.gmi captured on 2024-08-18 at 17:34:26. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2024-05-12)
-=-=-=-=-=-=-
Drupal x comes with some nice multilingual features: I want to use these to transform my multilingual website from “prefix path” (http://example.com/en) to language subdomains (http://en.example.com). I like this method on Wikipedia, so it will be a nice additions to my Drupal wiki site.
=> http://example.com/en
=> http://en.example.com
Prerequisites:
* Drupal x (tested on Drupal x)
* A sites/default directory with a settings.php file pointing to your database (locally). You can alternatively create one “sites/example.com” directory on production website. Setting for subdomains will be read here.
If you want to test this on your local machine before any production use, change your /etc/hosts file adding near “localhost” your language subdomains (I will use english\* and italian\*).
1 localhost example en.example it.example
Go to your Apache configuration (usually /etc/apache2/sites-available/default) and copy your local configuration for each server name (copy and change bold declaration, eg. example it.example en.example).
Note: skip this step if you want to configure subdomains. I use this configuration on my local test machine, but I use subdomains (configured via CPanels) on production website.
\<VirtualHost \*\>
ServerName example
DocumentRoot /var/www/example.com/public_html/drupal6/
\<Directory “/var/www/example.com/public_html/drupal6/”\>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from 0/0 ::1/128
\</Directory\>
\</VirtualHost\>
\<VirtualHost \*\>
ServerName it.example
DocumentRoot /var/www/example.com/public_html/drupal6/
\<Directory “/var/www/example.com/public_html/drupal6/”\>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from 0/0 ::1/128
\</Directory\>
\</VirtualHost\>
…
Now visit http://en.example and http://it.example. You should login to these site before proceed, otherwise you cannot set a language URL.
Now, on http://example/ (your localhost server name for this site)
go to Admin \> Languages \> Configure set Language negotiation to Domain name only Save settings go to Admin \> Languages \> List and edit a language (you may have to enable it with add language) On Language domain for english type . Do the same (with it subdomain) on Italian language configuration.
Now you can download and install Internationalization module. After that:
Go to Admin \> Content types \> Your-content-type (tipically Page or similar) On Workflow settings select Enabled, with translation
Now, create a page selecting “English” as language. Save it and go to Translate tab, then add a translation in the other language. On the bottom of the page you can see a language switcher. Click on it and watch your URL.
If you use Path alias (and/or Pathauto module) you can use the same alias for any subdomain. Why? Because {url_alias} table comes with a nice “language” field. If I want to have two different articles about Ritsuko Akagi, one in English and the other in Italian, using the same path alias, my database table {url_alias} will contains:
pid src dst language 6 node/3 wiki/Ritsuko_Akagi it 8 node/4 wiki/Ritsuko_Akagi en
For:
That’s all.
https://web.archive.org/web/20080713000000*/http://example.com/en
to language subdomains (<a href=
https://web.archive.org/web/20080713000000*/http://en.example.com
https://web.archive.org/web/20080713000000*/http://en.example
https://web.archive.org/web/20080713000000*/http://it.example
https://web.archive.org/web/20080713000000*/http://example/
https://web.archive.org/web/20080713000000*/http://en.example
https://web.archive.org/web/20080713000000*/http://drupal.org/project/i18n
https://web.archive.org/web/20080713000000*/http://it.example/wiki/Ritsuko_Akagi
https://web.archive.org/web/20080713000000*/http://en.example/wiki/Ritsuko_Akagi