查看“如何进一步汉化FreePBX界面”的源代码
←
如何进一步汉化FreePBX界面
跳转至:
导航
、
搜索
因为以下原因,你没有权限编辑本页:
您所请求的操作仅限于该用户组的用户使用:用户
您可以查看并复制此页面的源代码:
'''Translating FreePBX Manually''' FreePBX began including the [http://www.gnu.org/software/gettext/ gettext] package for i18n since version 2.5. This makes translating (localization) to your desired language relatively simple using the following steps: ''' Translation files''' In each modules/<modulename>/i18n directory there is a <modulename>.pot file. This is a template file with all the strings needed for translation. Create a new language directory structure in the i18n directory and copy the <modulename>.pot file to ''lang_code''/LC_MESSAGES/<modulename>.po Replace ''lang_code'' with the proper language code for your translation (hint: see /usr/share/locale<nowiki>/locale.al</nowiki>ias). '''Note:''' core does not contain an i18n directory as all text for core is located in admin/i18n/''lang_code''/LC_MESSAGES<nowiki>/amp.po</nowiki> - <nowiki>amp.mo</nowiki> and the template file are in admin/i18n. '''Example''' You want to translate the backup module to Danish, First check the language code for Danish in <nowiki>locale.al</nowiki>ias. For Danish it is da_DK, then create the directory structure (backup/i18n/da_DK/LC_MESSAGES), then copy the i18n<nowiki>/backup.po</nowiki>t to da_DK/LC_MESSAGES<nowiki>/backup.po</nowiki>. '''Translating the File''' Continuing from our above example, in <nowiki>backup.po</nowiki> you will see several "msgid" and "msgstr" name/value pairs. "msgid" contains the string to be translated and "msgstr" will be where you put your translation for the given "msgid". Here's an example from the core module where we translate "Delete Route %s" to Spanish: <nowiki>#: amp_conf/htdocs/admin/modules/core/page.routing.php:275</nowiki> <nowiki>#: amp_conf/htdocs/admin/modules/core/page.did.php:141</nowiki> <nowiki>#, php-format</nowiki> msgid "Delete Route %s" msgstr "Agregar Usuario %s" If you are working in Linux there is a PO-editor called KBabel which you may prefer to use. Otherwise you may also want to check out the cross-platform (Linux/Mac/Windows) editor called [http://www.poedit.net/ Poedit]. '''Compiling your translation file''' The .po file needs to be compiled into an .mo file before it can be used. To do this, run: '''''Note:''''' ''If you are using KBabel or Poedit, the files are compiled with these programs and you don't have to do the next part'' msgfmt -v <module>.po -o <module>.mo For example, you have translated the <nowiki>backup.po</nowiki>, to compile it, run: msgfmt -v <nowiki>backup.po</nowiki> -o <nowiki>backup.mo</nowiki> You might have some errors to correct, which are usually a result of quoting problems or that you have not updated the header in the .po file. If you have no error and all is good, continue to the next step. '''Testing your Translation''' To see your translations at work, you need to update FreePBX's code to include your translation. The file that you'll need to edit is located at /var/www/html/admin/views/men<nowiki>u.ph</nowiki>p (on a default CentOS install), and you'll want to look for the code block shown below: '''/var/www/html/admin/views<nowiki>/menu.ph</nowiki>p''' <nowiki>if($amp_conf['SHOWLANGUAGE']) {</nowiki> $out .= '<a id="language-menu-button" ' . 'class="button-right ui-widget-content ui-state-default">' . _('Language') . '</a>'; $out .= '<ul id="fpbx_lang" style="display:none;">'; $out .= '<li data-lang="en_US"><a href="#">'. _('English') . '</a></li>'; $out .= '<li data-lang="bg_BG"><a href="#">' . _('Bulgarian') . '</a></li>'; $out .= '<li data-lang="zh_CN"><a href="#">' . _('Chinese') . '</a></li>'; $out .= '<li data-lang="de_DE"><a href="#">' . _('German') . '</a></li>'; $out .= '<li data-lang="fr_FR"><a href="#">' . _('French') . '</a></li>'; $out .= '<li data-lang="he_IL"><a href="#">' . _('Hebrew') . '</a></li>'; $out .= '<li data-lang="hu_HU"><a href="#">' . _('Hungarian') . '</a></li>'; $out .= '<li data-lang="it_IT"><a href="#">' . _('Italian') . '</a></li>'; $out .= '<li data-lang="pt_PT"><a href="#">' . _('Portuguese') . '</a></li>'; $out .= '<li data-lang="pt_BR"><a href="#">' . _('Portuguese (Brasil)') . '</a></li>'; $out .= '<li data-lang="ru_RU"><a href="#">' . _('Russian') . '</a></li>'; $out .= '<li data-lang="sv_SE"><a href="#">' . _('Swedish') . '</a></li>'; $out .= '<li data-lang="es_ES"><a href="#">' . _('Spanish') . '</a></li>'; $out .= '</ul>'; } Once you've located the code block, you'll want to add you code to above the line that shows: $out .= '</ul>'; For example, if you want to add Danish as the new language, you would add the following live above the code block above: $out .= '<li data-lang="da_DK"><a href="#">' . _('Danish') . '</a></li>'; Finally you can test your translations by refreshing your browser window and selecting your new language. If everything looks good, zip up your translated <modules>.po and <modules.>mo files and submit them by creating a New Ticket in our bug tracker. For information on how to do that, please see [file:///E:/display/FOP/Bug+Reporting Bug Reporting]. '''Determining Translation Status''' The '''languagestatus''' module provides developers insight into the translation status of core modules. To install the module, follow the steps below: * Click Admin * Choose Module Admin * Make sure Unsupported is checked * Check for Updates * Install languagestatus The module provides a menu option under Admin called '''Language Status. '''If you click on this, you will be greeted with a page that tells you to choose a language. If you do not have the language selection dropdown in the menu, complete the following: * Click Settings * Choose Advanced Settings * Set '''Show Language setting''' to True Choose a language other than English to see how well core modules are translated.
返回至
如何进一步汉化FreePBX界面
。
导航菜单
个人工具
登录
命名空间
页面
讨论
变种
视图
阅读
查看源代码
查看历史
更多
搜索
导航
首页
最近更改
合作伙伴
FreePBX官方
IPPBX软硬件
SIP 终端话机
SBC
语音网关,Sangoma语音板卡
工具
链入页面
相关更改
特殊页面
页面信息