CodeIgniter Forums
Nesting [extending] of language files - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Nesting [extending] of language files (/showthread.php?tid=11329)



Nesting [extending] of language files - El Forum - 09-04-2008

[eluser]Unknown[/eluser]
I extended CI_Validation class and it's not possible to do the same with corresponding language file in the same way (i.e. by placing a file which extends basic language data).

I think it should be possible to extend default language files.

Steps to reproduce:
When I place a file with name validation_lang.php into directory system\application\language\english\ this file's content replaces content of original system\language\english\validation_lang.php

Expected result:
First, load system\language\english\validation_lang.php
Second, load system\application\language\english\validation_lang.php if exists


Nesting [extending] of language files - El Forum - 09-04-2008

[eluser]xwero[/eluser]
The application directory file doesn't overwrite the system directory file. The application directory file is loaded that is all.
Code:
// system/libraries/Language.php snippet
if (file_exists(APPPATH.'language/'.$idiom.'/'.$langfile))
        {
            include(APPPATH.'language/'.$idiom.'/'.$langfile);
        }
        else
        {
            if (file_exists(BASEPATH.'language/'.$idiom.'/'.$langfile))
            {
                include(BASEPATH.'language/'.$idiom.'/'.$langfile);
            }
So extending the language files isn't part of the framework yet. But here is the feature request with a solution.


Nesting [extending] of language files - El Forum - 09-04-2008

[eluser]Unknown[/eluser]
Thank you for the solution. I think it must be used in next versions as part of core.