


6. Język |
![]() |
![]() |
OverviewThe Core language support is focused on the static text which is used for the different presentation outputs. Most of the text which you see in the Frontend presentation of your web Site is defined within the language files and can be changed easily by adding new languages within the language Manager (see Administrator guide). The language support of Joomla is based on the requirement to have a web site in one certain language. With that requirement the feature enables you to control the following Elements of the language presentation:
The feature to provide a multilingual web site will be supported by Joomla core in a future release (see roadmap). At the moment the support for multilingual web sites is provided by a third party component Mamblefish. Installation and global configuration of languagesThe language file support is based on the language files stored in the /language directory. The management of these files can be done thru the language manager within the administration or by copying the content of the language packages (language file and XML declaration for the language) into the /language directory. Each Joomla web site must have one active language (default). To change this language, you have to install a second language and either publish this language within the language manager or activate it in the global configuration. Both actions require administrator rights within your administration and a writeable configuration.PHP file. For further details of installing a language please see the administrator documentation. Creation of language filesTo create your own language file it is necessary that you use the exact contents of the default language file and translate the contents of the define statements. Files within a language packageThe following files are used within a language package. These files must be provided for each language in order to install reliably within the language manager.
Manipulating the static textThe following code is an extract from the english.php language file. In order to present the static text of your site in a different language, you have to translate the English text. Everything else in the file (especially the define names) must stay the same. <?php /** * @version $Id: languages.xml,v1.5 2004/09/14 22:33:07 eddieajau Exp $ * @package Joomla * @copyright Copyright (C) 2005 Open Source Matters. All rights reserved. * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php * Joomla! is free software and parts of it may contain or be derived from the * GNU General Public License or other free or open source software licenses. * See COPYRIGHT.php for copyright notices and details. */ /** ensure this file is being included by a parent file */ defined( '_VALID_MOS' ) or die ( 'Direct Access to this location is not allowed.' ); /** common */ DEFINE ("_NOT_AUTH","You are not authorized to view this resource."); DEFINE("_DO_LOGIN","You need to login."); DEFINE('_VALID_AZ09',"Please enter a valid %s. No spaces, more than %d characters and contain 0-9,a-z,A-Z"); DEFINE('_CMN_YES',"Yes"); DEFINE('_CMN_NO',"No"); DEFINE('_CMN_SHOW',"Show"); DEFINE('_CMN_HIDE',"Hide"); The translated version (here into German) would look like: <?php // $Id: languages.xml,v 1.5 2004/09/14 22:33:07 eddieajau Exp $ /** * Content code * @version $Revision: 1.5 $ * @package Joomla * @copyright Copyright (C) 2005 Open Source Matters. All rights reserved. * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php * Joomla! is free software and parts of it may contain or be derived from the * GNU General Public License or other free or open source software licenses. * See COPYRIGHT.php for copyright notices and details. */ defined( '_VALID_MOS' ) or die ( 'Direkter Zugriff zu diesem Bereich ist nicht erlaubt.' ); // common DEFINE("_NOT_AUTH","Du bist nicht berechtigt, diesen Bereich zu sehen."); DEFINE("_DO_LOGIN","Du musst dich anmelden."); DEFINE('_VALID_AZ09',"%s ist nicht zulässig. Bitte keine Leerzeichen, mindestens %d Stellen, 0-9,a-z,A-Z sollte enthalten sein."); DEFINE('_CMN_YES',"Ja"); DEFINE('_CMN_NO',"Nein"); DEFINE('_CMN_NAME',"Name"); DEFINE('_CMN_DESCRIPTION',"Beschreibung"); DEFINE('_CMN_SAVE',"Speichern"); Language configuration XMLThe configuration XML file is needed for the installation and basic language settings. In the future this XML file will get more importance because it will contain language related information such as the usual charsets and ISO code references for the language. So please be sure to provide this XML file in any language package you distribute. <xml version="1.0" encoding="iso-8859-1"> <mosinstall type="language"> <name>English</name> <version>1.14</version> <creationDate>07/07/2004</creationDate> <Author>Joomla Project</author> <authore-mail>admin @joomla.org</authore-mail> <files> <filename>english.php</filename> <filename>english.xml</filename> </files> </mosinstall> This XML file covers the standard installer tags and attributes. Usage of language filesWhen you write your own Joomla component (or, more generally, Joomla element) and have defined your own language file, you only need one line in your program to activate the chosen language: include_once('language/'.$mosConfig_lang.'.php'); This will load the defined text as PHP constants which you have used all over your program. |
|
Zmieniony ( 02.02.2006. ) |