Drupal 建立非英文網頁的設置

https://www.drupal.org/docs/7/multilingual/cookbook-build-a-non-english-d7-website


Cookbook: Build a non-English D7 website

Primary tabs

Last updated on 
7 February 2017

This Cookbook shows, how you can build a new website using Drupal 7 with only ONE (non-English) language. The administration language remains English, because this is the language on www.drupal.org.

Remarks

  • The intention of this cookbook is to explain the building of a non-English website as a working demo. All visitors of this website (except for the admins) only see this ONE language!
  • I assume that we are installing this development server on a Windows client, for this purpose the Steps 1 and 2 of the Quick install Drupal with XAMPP on Windows are done for Drupal 7. The homepage of this website will be http://127.0.0.1/drupal7/.

    But: XAMPP should only be used as a development server (https://www.apachefriends.org/about.html)!

  • If you use another system of installation of the websever or another webserver or another OS on your computer, you have to read your homepath of the webserver instead of "C:\xampp\htdocs\drupal7\"!

Cookbook:

Follow it step by step1)!

Step 1: Install Drupal 7

Install Drupal 7 as told in the Installation Guide on www.drupal.org.

For your first try of this cookbook use a fresh installed Drupal 7 (Recommended release) from https://www.drupal.org/project/drupal with Default profile in the path "C:\xampp\htdocs\drupal7\" and then start with the next step.

Step 2: Install SEO supplements

I recommend the following key modules to install2):

  1. Token from https://www.drupal.org/project/token
  2. Pathauto from https://www.drupal.org/project/pathauto
  3. Subpathauto from https://www.drupal.org/project/subpathauto
  4. Pathologic from https://www.drupal.org/project/pathologic
  5. Transliteration from https://www.drupal.org/project/transliteration

They ensure that the paths are displayed in the form "http://www.example.com/content/hello", not as "http://www.example.com/node/532" and are listed accordingly in the respective side's <head> area.

Download these modules and unpack them to the path "C:\xampp\htdocs\drupal7\sites\all\modules\".

Then put a tick "Enabled" for these modules at "http://127.0.0.1/drupal7/admin/modules" and then click "Save configuration".

Now you have to configure these modules:

  1. At http://127.0.0.1/drupal7/admin/config/search/path/settings put a tick "Transliterate prior to creating alias" and then click "Save configuration".
  2. At http://127.0.0.1/drupal7/admin/config/search/path/subpaths you can administer the subpaths, then click "Save configuration".
  3. At http://127.0.0.1/drupal7/admin/config/content/formats configure all text formats ("Filtered HTML", "Full HTML" and "Plain text") like:
    • Put a tick "Correct URLs with Pathologic",
    • at "Filter processing order" drop "Correct URLs with Pathologic" down to be the last row,
    • at "Filter settings" within the tab "Correct URLs with Pathologic" set "Processed URL format" to "Path relative to server root (/foo/bar)" and add the two lines "http://127.0.0.1/drupal7/" and "/" in the field "All base paths for this site",
    • then click "Save configuration".

For information, refer to the appropriate help.

Step 3: For a non-English website

For a functional non-English language site2) you should install some additions:

  1. Locale (core-module)
  2. Administration language from https://www.drupal.org/project/admin_language3)
  3. Localization update from https://www.drupal.org/project/l10n_update

The Locale module allows your Drupal site to be presented in languages other than the default English.
The module Localization update automatically loads down the installed translations of the Drupal interface, so it guarantees and updated the non-English translation of the website interface (in other CMS called "frontend" and "backend").

In the administration of the website (Admin menu and the admin pages) the module Administration language serves the English language. This allows that all descriptions on https://www.drupal.org/documentation can be followed without any translation work.

Download the non-core-modules and unpack them to the path "C:\xampp\htdocs\drupal7\sites\all\modules\".

Then put a tick "Enabled" for these modules at "http://127.0.0.1/drupal7/admin/modules" and then click "Save configuration".

Hint:
At this moment, do not add a language4)!

Now you have to configure one module:

  1. At http://127.0.0.1/drupal7/admin/config/regional/language/update at "Update mode" put a tick "Edited translations are kept, only previously imported ones are overwritten and new translations are added", at "Store downloaded files" type in "sites/all/translations" and then click "Save configuration".

For information, refer to the appropriate help or the files README.txt of the installed modules

Last Step: Add your language and the language settings4)

Goto http://127.0.0.1/drupal7/admin/config/regional/language/add and select the language of your website in the field Language name and then click "Add language".

In the colomn "Default" set the bullet to your new language and then click "Save configuration".

Now we need to do some configuration:

  1. Adjust the Regional settings at http://127.0.0.1/drupal7/admin/config/regional/settings.
  2. At http://127.0.0.1/drupal7/admin/config/regional/date-time/formats/add you can add new Time-formats (e.g. for the German Medium date-format: "D., d.m.Y - H:i", this shows dates like "Sun., 03.08.2014 - 16:03"), if you need them in the next configuration step.
  3. At http://127.0.0.1/drupal7/admin/config/regional/date-time/locale click on "Edit" in the row with your new language.
    Select the correct date format in the column "Format" of every row.
    Then click "Save configuration".
  4. At http://127.0.0.1/drupal7/admin/config/regional/language/admin_language select the option you want, I normally enable all options. Then click "Save configuration".

Hint

Now you can build your website like the Site Building Guide shows on www.drupal.org.

Good luck!


Notes

1) = These steps will change significantly in Drupal 8!

2) = But in a multilingual website for the visitor is recommended to choose a different approach.

3) = This module is for a non-English website in fact not necessary, but for me is the default for all non-English spoken websites. Thereby the administration language remains English, because this is the language on www.drupal.org.

4) = We do this here at the end of this cookbook in order not to change the flow of this cookbook through translations.


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章