1. Trang chủ
  2. » Công Nghệ Thông Tin

Thiết kế web với joomla 1.6(5).x part 26 ppt

10 97 0

Đang tải... (xem toàn văn)

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 10
Dung lượng 1,29 MB

Nội dung

269 CHAPTER Working with the Language Manager IN THIS CHAPTER The function of the Language Manager Installing new language packs Modifying a language pack Specifying the language used T he Language Manager makes it possible for you to add additional lan- guages to your site and manage them with ease. All of the site con- trols, warning messages, prompts, and notifications are controlled by the language packs and can be administered via the Language Manager. Although the Joomla! installation package is delivered with only one lan- guage installed, over 80 translations of Joomla! are available. Through the use of the language packs and the Language Manager, you can tailor both the front-end and the back-end interfaces of your site to suit your needs, in almost any language you choose. In addition to global language settings, the system also supports the use of separate languages for the front end and the back end and even separate lan- guages for particular users or articles. This chapter looks at all of the various configurations that are available in the default system. The Function of the Language Manager The Language Manager serves two important functions: First, it enables you to manage multiple language packs, or translations, and secondly, it allows you to set the language used by the front-end and back-end interfaces of your web site. To access the Language Manager, log in to the admin system of your web site and go to the menu item extensions; click on the option named Language Manager. The Language Manager loads in your browser window, as shown in Figure 11.1. Part II: Working with Content and Users 270 FIGURE 11.1 The Language Manager interface. The toolbar at the top of the Language Manager contains only two controls: l Default: Select a language from the list and then click this icon to set the language as the site’s default language. l Help: Click to access the online Help files related to the active screen. Below the toolbar there are two text links. The link labeled Sites shows you the Site Language Manager; the Administrator link displays the Administrator Language Manager. The controls and fields on each are the same, so I have combined the discussion of them. The main content area of the screen contains a list of all the language packs installed on your Joomla! site. The columns provided are: l # : An indexing number assigned by Joomla! This cannot be changed. l Radio Button (no label): Click a radio button to select a menu; this is needed if you want to use the default option on the toolbar, referenced above. l Language Name: This field displays the full name of the language packs installed on the site. l Default: A yellow star in this column indicates that the language is selected as the site’s default language. Chapter 11: Working with the Language Manager 271 l Version: The version number of the language pack. l Date: The creation date of the language pack. l Author: The name of the author of the language pack. l Author E-mail: A contact e-mail for the author of the language pack. Finally, at the bottom of the screen, below the content area, is the Display # option. Change the value in the combo box control to alter the number of language packs that are displayed on the page. The default value can be altered by changing the List Length option on the Global Configuration Manager (see Figure 11.2). Note Having multiple language packs installed on your site does not automatically enable the display of multilingual content. Language packs only control the language used for the display of system elements, for example, con- trols and warning messages. If you want to display articles in multiple languages and give users the ability to easily switch languages, then you need to install a third-party extension to enable this functionality. Multilingual site extensions are discussed in Chapter 22. FIGURE 11.2 The front end of the default site with the French language pack installed and set as the front-end default language. Part II: Working with Content and Users 272 Installing New Language Packs If your Joomla! site does not use your preferred language, or you want to add an additional transla- tion for the site’s interface, then you can download and install one or more additional language packs. The language packs are available on the Joomla! Extensions web site. Each pack contains complete translations of all the various text strings used for both the front end and the back end of the site. Note Some language packs contain only slightly different contents to allow for regional variations, for example, British English versus American English. To install a new language pack, download the language pack and then follow these steps: 1. Log in to the admin system of your Web site. 2. Click on the option Install/Uninstall on the Extensions menu of the main admin nav bar. The Extension Manager loads in your browser window. 3. Click the Browse button inside the Upload Package File box. The File Upload dia- logue opens in your browser. 4. Navigate to the location of your downloaded language pack. Click once to select the language pack and then click the Open button. The File Upload dialogue closes and returns you to the Extension manager, where you should see the name of the language pack in the Package File text field. 5. Click the button labeled Upload File & Install. The system attempts to install the lan- guage pack and if successful, will display a confirmation message on the Extension Manager. After you have installed the language pack, you see it listed in the Language Manager. Note You can find a list of all the available language packs and download the ones of your choosing from the Joomla! Extensions directory at http://extensions.joomla.org/extensions/languages/translations-for-joomla . Caution You delete language packs the same way that you delete other extensions. However, you should take care not to delete the default language because it will cause errors on the web site. Deleting extensions is discussed in Chapter 22. Chapter 11: Working with the Language Manager 273 Modifying a Language Pack The system’s language packs specify the language strings that are used throughout the site. The strings cover everything from basics such as Read more. . . , to error messages, to instruction text for common core functionalities. If you want to change the wording used in any of these strings you have two options. You can edit the language files on the server or you can create your own language pack. Editing the default language files The language pack files are organized inside of directories, one directory for each language. The individual language pack directories are kept on the server inside the main language directory. The files that contain the language strings in a language pack are primarily .ini files. If you want to change a word or a phrase, you must locate the appropriate .ini file containing the word or phrase, open it, edit it, and save it to overwrite the original file. For example, assume that you want to change the Password Reminder text that appears on the Login module. That text in the default installation reads “Forgot your password?” You can change it to the more conversational “Have you forgotten your password?” To do so, follow these steps: 1. Access your Joomla! installation on your server. 2. Find the directory language/en-GB and open the file en-GB.mod_login.ini. You can open and edit this file with a text editor. 3. Search for the phrase “Forgot your password.” You will find this: FORGOT_YOUR_PASSWORD=Forgot your password? 4. Edit the last part of that line of code. Change the code to read FORGOT_YOUR_ PASSWORD=Have you forgotten your password? 5. Save the file, overwriting the original. If you check your site you can see the change in the Login module. Cross-Reference See Appendix B for a list of all the key files you may want to modify, including the language files. Creating a new language pack Creating a new language pack is more complicated than simply editing the core language pack files, but it has the advantage of creating a distinct set of files that you can maintain independently of the Joomla! core. If you plan to make numerous changes to the individual language files, it is probably easier in the long run to create your own language pack instead of modifying and then maintaining all the various language files. Don’t forget that changes made to the Joomla! core run the risk of being overwritten when you do an upgrade to the system. If you have created your own Part II: Working with Content and Users 274 language pack, you can always reinstall it when you upgrade your site instead of having to go through and modify numerous language files. The easiest way to create a new language pack is to copy an existing language pack and rename the files. In this way you get all of the elements and save yourself a great deal of time. Assume that you want to make a number of changes to the default en-GB language pack and have decided to create your own variation to hold the changes. Follow these steps: 1. Access the Joomla! installation on your server. 2. Duplicate the existing language/en-GB directory. 3. Change the name of all directories and files from “en-GB” to “en-ME.” Don’t forget to update the tag field in the en-GB.xml file. 4. Make your changes to the language strings inside the files of your new en-ME Language Pack. 5. Access the Language Manager and set your new language pack as the default language. Cross-Reference Changing the default language is discussed in the following section. Specifying the Language Used The default setting for Joomla! has one language assigned to both the front end and the back end. The Language Manager allows you to specify the default language used for either the front end, the back end, or both. In addition to the global Language control you get from the Language Manager, you can configure the site to allow users to choose their preferred language and you can also over- ride the global language settings for individual articles. Changing the default language To change the default language used, follow these steps: 1. Log in to the admin system of your web site. 2. Click on the option Language Manager under the Extensions menu. The Language Manager loads in your browser. 3. When you access the Language Manager, you will be shown the front-end languages. If you want to change the back-end default language, click the Administrator link at the top of the Language Manager. 4. Click the radio button next to the language you want to set as the default. 5. Click the Default icon on the toolbar. The system sets your chosen language as the default language and if successful, displays a yellow star in the Default column next to the name of the chosen language, as shown in Figure 11.3. Chapter 11: Working with the Language Manager 275 FIGURE 11.3 The Language Manager interface, showing the French translation set as the default lan- guage for the front-end of the site. Note The front-end and the back-end language selections are independent of each other. Changing one does not impact the other. If you want to change both, you must repeat the process above, once for the front end and once for the back end. Setting the language for users The site administrator can set a specific front-end or back-end language for a user. The parameters associated with the user account include options for selecting a front-end language and if the user is authorized to access the back end, they also include a parameter for the back-end language. The options available correspond to the language packs installed on the site. If no selection is made, the system will apply the default language set in the Language Manager. Cross-Reference Chapter 10 covers creating and editing User accounts. Part II: Working with Content and Users 276 Administrators can also give users the chance to select their preferred language. To enable this functionality, you need to publish for the User Form page for the users. To set this up, follow these steps: 1. Log in to the admin system of your Web site. 2. Access the Menu Item Manager for the User menu by clicking on the option User menu, located under the Menus menu on the main admin nav bar. The User menu Menu Item Manager opens. 3. Click the New icon the top-right toolbar. The first step of the New Menu Item dialogue opens. 4. Select the Menu Item Type named User Form Layout. 5. Click the Next button. The final step of the New Menu Item dialogue appears. 6. Name the Menu Item. 7. Set the Access Level to Registered. 8. Click Save. The system creates the new menu item. The New Menu Item dialogue closes and returns you to the Menu Item Manager. The new menu item now appears on the User menu and is visible to authenticated users. When they click on this menu item, they are taken to a page that allows them to manage their account details and set the choice of language. If they have access to the back end, the language options include both the front end and the back end. The options available to the user are limited to the language pack installed on the site. Cross-Reference See Chapter 8 for more discussion on managing menus and menu items. Setting the language for specific articles It is possible to display articles in languages other than the default language, without the necessity of installing third-party extensions. This is most useful when you want to show only a limited number of pages in other languages, rather than creating a truly multilingual site. Tip If your goal is to create a truly multilingual site, you should download and install an additional extension that gives you all the proper tools you need for managing the content and for giving the users easy access to the content in the various languages. Chapter 11: Working with the Language Manager 277 If, however, you do not need or do not want to create a fully multilingual site, you can set specific articles to use languages other than the default language. The language option is included in the advanced parameters of the Article Editing dialogue. Simply edit the article and select the language you desire from the combo box. The options in the combo box are limited to the language packs installed on your site. Note that you need to do this for each individual article for which you want to use an alternative language. Cross-Reference See Chapter 5 for more information on creating and editing articles. Summary In this chapter, we covered the various advanced tasks associated with managing the language packs on your site. You learned the following: l The function of the Language Manager l How to install new language packs l How to edit a language pack l How to create a new language pack l How to change the default language l How to set the language for a user l How to set the language for an article . Language Manager loads in your browser window, as shown in Figure 11 .1. Part II: Working with Content and Users 270 FIGURE 11 .1 The Language Manager interface. The toolbar at the top of the Language. from the Joomla! Extensions directory at http://extensions .joomla. org/extensions/languages/translations-for -joomla . Caution You delete language packs the same way that you delete other extensions yellow star in the Default column next to the name of the chosen language, as shown in Figure 11 .3. Chapter 11 : Working with the Language Manager 275 FIGURE 11 .3 The Language Manager interface,

Ngày đăng: 04/07/2014, 06:20