Ext Extra language files

Need some custom code changes to the phpBB core simple enough that you feel doesn't require an extension? Then post your request here so that community members can provide some assistance.

NOTE: NO OFFICIAL SUPPORT IS PROVIDED IN THIS SUB-FORUM
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

NOTE: NO OFFICIAL SUPPORT IS PROVIDED IN THIS SUB-FORUM
Post Reply
hmaegaard
Registered User
Posts: 1
Joined: Thu Apr 08, 2021 2:56 pm

Ext Extra language files

Post by hmaegaard »

Hi,
I'm adding extra language files in order to change some wordings in the standard language files.
Ex. :
Event : 'core.user_setup' => 'load_language_on_setup',
public function load_language_on_setup($event){
global $language;
$language->add_lang('common', 'gruf/customize');
$language->add_lang('ucp', 'gruf/customize');
}

This works well for all templates utilizing common.php, but not for ucp templates, e.g.: ucp_reset_password.html

Any clues?
Last edited by HiFiKabin on Thu Apr 08, 2021 3:16 pm, edited 1 time in total.
Reason: Moved to Custom Coding
User avatar
kasimi
Former Team Member
Posts: 4900
Joined: Sat Sep 10, 2011 7:12 pm
Location: Germany
Contact:

Re: Ext Extra language files

Post by kasimi »

Don't call $user->add_lang_ext() or $language->add_lang() in the core.user_setup event handler. The $user object isn't fully initialized at that point.

Either you use the event core.user_setup and do this:

Code: Select all

$lang_set_ext = $event['lang_set_ext'];
$lang_set_ext[] = array(
	'ext_name'	=> 'gruf/customize',
	'lang_set'	=> 'common',
);
$event['lang_set_ext'] = $lang_set_ext;
Or you use an event that is triggered after the $user object is initialized, for example core.user_setup_after:

Code: Select all

$language->add_lang('common', 'gruf/customize');
Post Reply

Return to “phpBB Custom Coding”