Post by bruce » Sat Apr 19, 2008 4:56 pm

The following change will allow your store and admin to fall back on English language files if the file for a different language is not found. It does assume that you have not deleted the English language directories. English does not have to be enabled for this to work (I think)

For example if you install an extension and then add a new language, things can break. Sometimes with no easy way to recover.

Simply replace the load() function in library\language\language.php with the following. Please excuse the layout as displayed. The code contains a mixture of tabs and spaces. As always, backing up the original file beforehand is a good idea  ;)

Code: Select all

	function load($filename, $directory = DIR_LANGUAGE) 
    {
    	$file = $directory . $this->languages[$this->code]['directory'] . '/' . $filename;
    
    	if (file_exists($file)) 
        {
	  		$_ = array();
	  
	  		include($file);
	  
      		$this->data = array_merge($this->data, $_);
    	} 
        else 
        {
            // fall back to english language files... if they exist.
            $file = $directory . $this->languages['en']['directory'] . '/' . $filename;
        
            if (file_exists($file)) {
                  $_ = array();
          
                  include($file);
          
                  $this->data = array_merge($this->data, $_);
            }
            else
            {
                exit('Error: Language file ' . $file . ' not found!');
            } 
    	}
  	}

Active Member

Posts

Joined
Wed Dec 12, 2007 2:26 pm

Post by ried » Thu Aug 14, 2008 4:52 pm

does not work

Newbie

Posts

Joined
Wed Feb 13, 2008 5:45 pm

Post by Luvz2drv » Thu Aug 14, 2008 6:04 pm

more information then "DOES NOT WORK" would help understand

1) Why.
2) the error message...

so that it can be looked at and possibly corrected..

what version of opencart? pre 0.7.7, 0.7.7  or 0.7.8???

what does the error show?
what did you expect it to show?

Global Moderator

Posts

Joined
Fri Mar 21, 2008 10:58 am

Post by ried » Thu Aug 14, 2008 9:03 pm

0.7.8, some crash in line bla-bla... so i was tired and cheat the system :) i was create copy of english admin side lang, and rename it to russian. so the admin side is on english but it's not a big deal.

Newbie

Posts

Joined
Wed Feb 13, 2008 5:45 pm
Who is online

Users browsing this forum: No registered users and 4 guests