0

如何使用 joomla 的内置语言功能创建多语言 Joomla MVC 组件。该翻译必须插入数据库,然后根据语言而不是预定义的.ini翻译输出到前端。

P/s:我已经可以在 joomla 中构建一个组件了

4

1 回答 1

1

You need to have a language column on your database tables and then you can do on the front in your model where you fetch the items

if (JLanguageMultilang::isEnabled())
{
    $query->where('a.language in (' . $db->quote(JFactory::getLanguage()->getTag()) . ',' . $db->quote('*') . ')');
}

The forms need to have a language field as well

<field name="language" type="contentlanguage"
    label="JFIELD_LANGUAGE_LABEL" description="JFIELD_LANGUAGE_DESC"
    class="inputbox">
    <option value="*">JALL</option>
</field>

The best is when you have a look how the com_content component did it.

于 2013-10-10T12:31:46.580 回答