PHP Joomla! 6 Joomla! 5 Joomla! 3 (Legacy) Helper / API Basic

Load a Language (.ini) File Manually and Translate with Text::_()

Loads .ini translation constants from another component, module or template so Text::_() and Text::sprintf() resolve cleanly.

Updated on 24 November 2026 40 copies 144 views
templates/seu_template/html/mod_articles/default.php
<?php

declare(strict_types=1);

use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;

$lang = Factory::getApplication()->getLanguage();
$lang->load('com_pmsnippets', JPATH_SITE);

echo Text::_('COM_PMSNIPPETS_LIBRARY_TITLE');
echo Text::sprintf('COM_PMSNIPPETS_RESULTS_SUMMARY', 12, 100);
Always save .ini files as UTF-8 without BOM with full parity across site languages.
templates/seu_template/html/mod_articles/default.php
<?php
$lang = JFactory::getLanguage();
$lang->load('com_example', JPATH_SITE);

echo JText::_('COM_EXAMPLE_TITLE');
Legacy Joomla 3 snippet via JFactory::getLanguage() and JText.

Technical explanation and best practices

Whenever a module, plugin or override needs language keys defined in another extension, load that extension language domain explicitly via $app->getLanguage()->load().

Direct Engineering

Have a Joomla project or technical challenge in mind?

From architectural diagnosis to production deployment, directly with the engineer.