dqcwl02022 2016-07-26 08:50
浏览 41

Joomla不加载语言文件

I double- and triple-checked everything and I double- and triple-read the documentation, but my Joomla plugin refuses to read from the language files.

I have the xml file configured like this:

<files>
    <filename plugin="fruits">fruits.php</filename>
    <folder>language</folder>
</files>
<languages>
    <language tag="en-GB">language/en-GB/en-GB.plg_fruits.ini</language>
    <language tag="de-DE">language/de-DE/de-DE.plg_fruits.ini</language>
</languages>
<config>
  <fields name="params">
    <fieldset name="basic">
      <field
        name="default_fruits"
        type="integer"
        default="An Integer"
        label="JFIELD_PLG_FRUITS_DEFAULT_LABEL"
        description="JFIELD_PLG_FRUITS_DEFAULT_DESC"
        first="0"
        last="10"
        step="1"
      />
    </fieldset>
  </fields>
</config>

The version attribute on the <extension> is set to 3.6.

In the plugin directory I have a folder called "language" with two sub-folders ("de-DE" and "en-GB") and those folders hold the files de-DE.plg_fruits.ini and en-GB.plg_fruits.ini respectively.

Inside those files it respectively says: JFIELD_PLG_FRUITS_DEFAULT_LABEL="Apple" // "Apfel" JFIELD_PLG_FRUITS_DEFAULT_DESC="Text" // "Text"

As I said, I can't find the mistake. When I turn on Joomla's language debugger it tells me:

**Not loaded** : JROOT/administrator/language/en-GB/en-GB.plg_fruits_fruits.ini
**Not loaded** : JROOT/plugins/age/age/language/en-GB/en-GB.plg_fruits_fruits.ini

I don't get a parsing error, but when I renamed the files to en-GB.plg_fruits_fruits.ini it gave me a parse error for every line of the file, but at the same time tells me the files haven't been loaded.

I also tried protected $autoloadLanguage = true; in the php file (that is otherwise empty apart for the basic Joomla setup) and it didn't affect anything.

  • 写回答

1条回答 默认 最新

  • doumo2501 2016-07-26 10:49
    关注

    Joomla Language files should be saved using the UTF-8 encoding. You have to use a file editor that supports UTF-8 without BOM e.g notepad++ (Free) or any other editor. PHP ini parser allows you to omit the double quotes around the value but in Joomla you cannot omit double quotes. It is mandatory. Avoid comments in the language files. This link will be a good reference for you https://docs.joomla.org/Creating_a_language_definition_file

    评论

报告相同问题?

悬赏问题

  • ¥20 模型在y分布之外的数据上预测能力不好如何解决
  • ¥15 processing提取音乐节奏
  • ¥15 gg加速器加速游戏时,提示不是x86架构
  • ¥15 python按要求编写程序
  • ¥15 Python输入字符串转化为列表排序具体见图,严格按照输入
  • ¥20 XP系统在重新启动后进不去桌面,一直黑屏。
  • ¥15 opencv图像处理,需要四个处理结果图
  • ¥15 无线移动边缘计算系统中的系统模型
  • ¥15 深度学习中的画图问题
  • ¥15 java报错:使用mybatis plus查询一个只返回一条数据的sql,却报错返回了1000多条