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

 
Một thập niên đầy biến động tại Hewlett/Packard (HP)

Một thập niên đầy biến động tại Hewlett/Packard (HP)

Một thập niên đầy biến động tại Hewlett/Packard (HP) với việc các thành viên hội đồng quản trị (HĐQT) và Giám đốc điều hành công ty liên tục từ chức hoặc bị buộc ngưng việc do rất nhiều lí do khác nhau.

Drupal 7 – Part 2: Deliver digital faster, ít rủi ro hơn

Drupal 7 – Part 2: Deliver digital faster, ít rủi ro hơn

I showed you some of the many examples of successful sites built rapidly thanks to Drupal’s modularity.

Galaxy Tab 7 Plus, Máy tính bảng Nexus, Surface, windows 8

Microsoft công bố máy tính bảng Surface chạy Windows 8

Tại sự kiện diễn ở Los Angeles vào rạng sáng nay (19/6) theo giờ Việt Nam, Microsoft đã công bố máy tính bảng mang tên Surface chạy trên nền tảng hệ điều hành Windows 8 sắp sửa ra mắt của mình.

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

 

Diet con trung