Totara Learn Open Discussions

How to change default directory of language overrides

 
Peter Mayer
How to change default directory of language overrides
by Peter Mayer - Thursday, 26 May 2022, 8:35 AM
Group Partners

I want to overwrite some language strings locally. These overrides should be documented in git and stored as a submodule in e.g. lang/de_local. For this I set at moodle:

$CFG->langlocalroot = $CFG->dirroot . '/lang'; 

There you can find the folders with the language strings you want to overwrite. (e.g. de_local/hvp.php)

This has always worked great in moodle. Now I wanted to do the same in Totara and unfortunately it just doesn't work. Is there any special feature that I have to consider with Totara?

Craig Eves
Re: How to change default directory of language overrides
by Craig Eves (Totara Support) - Thursday, 26 May 2022, 3:21 PM
Group Totara

Hi Peter 

Are you using Totara 13 or later - there were some changes to folder structure  which may affect the location of the lang folder .

It looks like the lang folder is under the server folder

Regards



Peter Mayer
Re: How to change default directory of language overrides
by Peter Mayer - Friday, 27 May 2022, 11:13 AM
Group Partners

Hi Craig, 

thanks for your quick response. 

I'm on totara 15 and in another instance on totara 16.

I also had $CFG->langlocalroot = $CFG->dirroot . '/server/lang'; 

unfortunately also without success.


Many greetings

Peter

Chris Snyder
Re: How to change default directory of language overrides
by Chris Snyder - Monday, 30 May 2022, 6:55 PM
Group Totara

Hmm, did you purge caches after making the change?

The setting works for me locally -- or at least, I could break some custom translations by changing $CFG->langlocalroot to a non-existent directory. But I had to purge caches for the change to take effect.

Peter Mayer
Re: How to change default directory of language overrides
by Peter Mayer - Thursday, 9 June 2022, 2:21 PM
Group Partners

Hy Chris, 

I have since found the problem and was able to fix it. 

The problem is that $CFG->dirroot is not yet available in config.php. 

If I set $CFG->langlocalroot = __DIR__ . '/server/lang';

the logic works as expected.


Thanks a lot for your help!

Yours

Peter

Chris Snyder
Re: How to change default directory of language overrides
by Chris Snyder - Thursday, 9 June 2022, 4:33 PM
Group Totara

Ah, tricky one! Glad you figured it out and thanks for the followup.