最新更新 sitemap 网站制作设计本站搜索
网页设计
国外网站 韩国网站 个人主页 手提袋设计 CSS 网页特效 平面设计 网站设计 Flash CMS技巧 服装网站 php教程 photoshop 画册 服务器选用 数据库 Office
虚拟主机 域名注册 云主机 网页设计 客服QQ:8208442
当前位置:首页 > 网站综合 > CMS系统技巧

为Joomla网站cms系统插件创建语言包

日期:09-11    来源:中国设计秀    作者:cnwebshow.com

 D5J中国设计秀

当你为第三方的插件扩展做翻译时,通常是直接做到插件包中的,但有时你的语言包需要单独提交。后面这种情况下,也许会不大容易让使用者知道应该将语言包上传到哪里。D5J中国设计秀

为了避免这种情况的发生,我们可以模仿Joomla 1.5的方式来创建一个用于Joomla 1.5 native的语言包安装插件。你需要将一些.ini文件与一个.xml文件(install.xml)压缩成为一个可被支持的档案类型。其中.xml文件的代码如下(此代码对应管理后台的翻译):D5J中国设计秀

<?xml version="1.0" encoding="utf-8"?>D5J中国设计秀
<install version="1.5" client="administrator" type="language" method="upgrade">D5J中国设计秀
<tag>xx-XX</tag>D5J中国设计秀
<version>1.0</version>D5J中国设计秀
<creationDate>YYYY-MM-DD</creationDate>D5J中国设计秀
<author>Your Name</author>D5J中国设计秀
<name>YourLanguage</name>D5J中国设计秀
<authorEmail>D5J中国设计秀
yourmail@example.com This e-mail address is being protected from spambots. You need JavaScript enabled to view it </authorEmail>D5J中国设计秀
<authorUrl>http://www.example.com/</authorUrl>D5J中国设计秀
<copyright>Copyright (C) YYYY Copyright Owner. All rights reserved.</copyright>D5J中国设计秀
<license>LicenseType</license>D5J中国设计秀
<description>[Language name] translation for [extension_name]</description>D5J中国设计秀
<files>D5J中国设计秀
<filename>xx-XX.[extension_name].ini</filename>D5J中国设计秀
</files>D5J中国设计秀
<params />D5J中国设计秀
</install>

如代码所示,最好添加method="upgrade"参数,以使将来能够比较容易的安装新版本的语言包;如果该参数未指定,那么将来升级时,安装程序将无法覆盖旧的语言文件,导致出错。D5J中国设计秀

如果你也翻译了插件的前台页面,那么需要另外创建一个新的语言包。其中.xml文件(install.xml)的代码和上面的相同,只需将下面这行:D5J中国设计秀

    <install version="1.5" client="administrator" type="language" method="upgrade">

修改为:D5J中国设计秀

    <install version="1.5" client="site" type="language" method="upgrade">

在Joomla 1.5.4版本之后,用于某插件的管理后台和站点前台的语言包可以很容易的通过一个单一文件进行安装了;你可以通过以下的代码模板创建这样一个语言包安装器:D5J中国设计秀

 <?xml version="1.0" encoding="utf-8"?>D5J中国设计秀
<install version="1.5" type="language" client="both" method="upgrade">D5J中国设计秀
<name>YourLanguage</name>D5J中国设计秀
<tag>xx-XX</tag>D5J中国设计秀
<version>1.0</version>D5J中国设计秀
<creationDate>YYYY-MM-DD</creationDate>D5J中国设计秀
<author>Your Name</author>D5J中国设计秀
<authorEmail>youremail@example.com</authorEmail>D5J中国设计秀
<authorUrl>http://www.yoursite.com/</authorUrl>D5J中国设计秀
<copyright>Copyright (C) YYYY Copyright Owner. All rights reserved.</copyright>D5J中国设计秀
<license>License Type</license>D5J中国设计秀
<description>[Language name] translation for [extension_name]</description>D5J中国设计秀
<administration>D5J中国设计秀
<files folder="admin">D5J中国设计秀
<filename>xx-XX.[extension_name].ini</filename>D5J中国设计秀
</files>D5J中国设计秀
</administration>D5J中国设计秀
<site>D5J中国设计秀
<files folder="site">D5J中国设计秀
<filename>xx-XX.[extension_name].ini</filename>D5J中国设计秀
</files>D5J中国设计秀
</site>D5J中国设计秀
<params />D5J中国设计秀
</install>D5J中国设计秀

对于这样的语言包安装器,你需要创建名为"admin"和"site"的文件夹,分别包括前后台所需的语言文件;install.xml需要放在在 这两个文件夹外面。由于Joomla 1.5.6修正了一些关键性的错误,导致升级成为了必须,所以我们推荐使用这种单一语言包安装器的模式。D5J中国设计秀

我们可以为那些用于Joomla 1.5 native的,通过MVC模式进行开发的插件来创建这种类型的语言包。D5J中国设计秀

使用者可以在站点管理后台的扩展管理中的Install中安装这样的语言包;语言包中所包括的语言文件会自动被上传到正确的路径中。D5J中国设计秀

对于译者来说,这种方式可以允许他们在语言文件的头部加入译者信息,让使用者了解到如何与他们取得联系;对于插件开发者来说,他们不必再为那些用于Joomla 1.0的插件创建语言包安装功能了。D5J中国设计秀

本文引用地址:/site/article_63988.html
网站地图 | 关于我们 | 联系我们 | 网站建设 | 广告服务 | 版权声明 | 免责声明