Bí quyết 2 - đa ngôn ngữ trong Drupal 7

Bí quyết 2 - đa ngôn ngữ trong Drupal 7

Blog Site in Multiple Languages: Recipe 2

In our last blog post, we saw how to set up a simple website in a foreign language. Like our last recipe, this one is very easy too.  The main difference lies in the fact that we need to give users the possibility to choose their preferred language.  Content will not be translated to each language, but the user needs to be able to navigate the site in their preferred language, so that they can find what they’re looking for a blog post in a language they understand.

To achieve this, we follow the same steps we did in our last blog post, with a couple changes: First, instead of just adding one language, choose all the languages you will support.  Remember that since we installed and enabled the Localization Update module, it will automatically download the available site translations for your site’s interface.  Second, configure the “Detection and Selection” settings.

So let’s go ahead and do the second change we need. Go to /admin/config/regional/language and select the “Detection and Selection” tab.  Here, you will be presented with several language detection methods.  You will need to setup at least one.  The most common one is the URL detection method.  When you configure it, you can either choose “Path prefix” or “Domain.”  The first is the easiest one.  It simply uses predefined prefixes in your site’s URL to determine what language is being used; like http://example.com/es for Spanish or http://example.com/de for German.  The second requires some additional server modifications so that your site can respond to domains such as http://es.example.com for Spanish or http://de.example.com for German.  Let’s use “Path Prefix” for now.  Save configuration, and you are good to go.

Screen shot 2012-07-31 at 7.51.33 PM.png

Now that we have a way for the system to know when to present one language or the other, let’s give the user the possibility to pick one.  The Locale Module provides a block that you can enable, giving users the possibility to pick the language of their preference.  Go to /admin/structure/block and look for the “Language Switcher” block, place it in a region where users can easily find it; like the “Sidebar First” or the “Help” regions in a Bartik theme.  If you’ve been following me, you should see something like this:

Screen shot 2012-07-31 at 8.01.24 PM.png

You can see that the selected language is Spanish, and almost all of the user’s interface has been localized so that Spanish users can understand and navigate through your site.

This concludes this second recipe.  So far we’ve seen a couple of very basic scenarios for Multilingual websites.  As you can see, setting up Multilingual websites like these is a no-brainer.  These simple steps can open up the possibilities of your site by making it available to a broad variety of users with very little effort.  This process would otherwise be a laborious task to do without such wonderful Multilingual features that Drupal provides.

Our next blog post will deal with a far more complex Multilingual website.  You’ll learn how to handle the translation workflow of your content and other interesting topics such as content moderation and automated translation techniques.  I hope the recipes we’ve seen so far will help you in your own Multilingual projects.

Bạn thấy bài viết này như thế nào?: 
No votes yet
Ảnh của Tommy Tran

Tommy owner Express Magazine

Drupal Developer having 9+ year experience, implementation and having strong knowledge of technical specifications, workflow development. Ability to perform effectively and efficiently in team and individually. Always enthusiastic and interseted to study new technologies

  • Skype ID: tthanhthuy

Tìm kiếm bất động sản

 

Advertisement

 

jobsora

Dich vu khu trung tphcm

Dich vu diet chuot tphcm

Dich vu diet con trung

Quảng Cáo Bài Viết

 
Đằng sau việc giấu nợ xấu, khoe lãi khủng là gì?

Đằng sau việc giấu nợ xấu, khoe lãi khủng là gì?

Lãi “khủng” thực ra lại là “khối u ác tính” đang tích tụ trong cơ thể ngân hàng, chỉ chờ ngày bung ra thành những di căn không thể cứu chữa.

Thử làm 1 git-based patch workflow cho drupal.org năm 2015

Thử làm 1 git-based patch workflow cho drupal.org năm 2015

Git's killer feature, in my opinion, is local branches. Local branches allow you to keep work on different issues separate, and they allow you to experiment and backtrack.

Giới thiệu tính năng Drupal Commerce MailChimp

Giới thiệu tính năng Drupal Commerce MailChimp

This article describes the main features of the Commerce MailChimp module. The module integrates Drupal Commerce, MailChimp module and MailChimp’s eCommerce360 feature.

Công ty diệt chuột T&C

 

Diet con trung