OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



Locale::translate() error

Are you responsible for making OJS work -- installing, upgrading, migrating or troubleshooting? Do you think you've found a bug? Post in this forum.

Moderators: jmacgreg, btbell, michael, bdgregg, barbarah, asmecher

Forum rules
What to do if you have a technical problem with OJS:

1. Search the forum. You can do this from the Advanced Search Page or from our Google Custom Search, which will search the entire PKP site. If you are encountering an error, we especially recommend searching the forum for said error.

2. Check the FAQ to see if your question or error has already been resolved.

3. Post a question, but please, only after trying the above two solutions. If it's a workflow or usability question you should probably post to the OJS Editorial Support and Discussion subforum; if you have a development question, try the OJS Development subforum.

Locale::translate() error

Postby jwtlake » Mon Jul 29, 2013 10:17 am

Hello. I don't suppose anyone can give me a hint? Our team member who setup the site is no longer with us so I'm trying to learn as i go. Any help or nudges in the right direction would be greatly appreciated!

We are getting the following error on both our "Theme Plugins Manager" and "Customizing the Look" pages.

Fatal error: Call to undefined method Locale::translate() in plugins/themes/custom/CustomThemePlugin.inc.php on line 45

So the Locale class doesn't seem to have the translate function. I tried following the code upstream but it started to get complicated. A lot of class extensions. So I thought Id ask here before I start breaking things. ;)

This error occurred after a site rebuild and update. This was quite awhile back before I was working here so I don't know all the specifics. The site is functioning properly except for this error so the issue was ignored until now when we wanted to change the text on the main page. Which of course we can't do because the customization page breaks before it can render the save/submit button. Haha :)

Thanks.
~Jonathan
jwtlake
 
Posts: 8
Joined: Mon Jul 29, 2013 8:58 am

Re: Locale::translate() error

Postby asmecher » Mon Jul 29, 2013 12:12 pm

Hi Jonathan,

What version of OJS are you using? The "Locale" class was renamed to "AppLocale" a few releases ago to avoid clashing with a Locale class that's included in recent versions of PHP; I suspect some of your code is still referring to the old class name for some reason.

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 8345
Joined: Wed Aug 10, 2005 12:56 pm

Re: Locale::translate() error

Postby jwtlake » Mon Jul 29, 2013 1:28 pm

I think...
Open Journal Systems 2.3.7.0

*Found from: Home > About the Journal > About this Publishing System
jwtlake
 
Posts: 8
Joined: Mon Jul 29, 2013 8:58 am

Re: Locale::translate() error

Postby asmecher » Mon Jul 29, 2013 2:09 pm

Hi Jonathan,

OJS 2.3.7 shouldn't contain any references to the Locale class; I suspect you've got some older code e.g. from a previous version there. What does plugins/themes/custom/CustomThemePlugin.inc.php line 45 read?

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 8345
Joined: Wed Aug 10, 2005 12:56 pm

Re: Locale::translate() error

Postby jwtlake » Mon Jul 29, 2013 3:18 pm

return Locale::translate('plugins.theme.custom.name');

Gotcha. Perhaps after the update was finished the old pluggins were used in hopes of restoring our themes. So can I update all instances of Locale:: with AppLocale:: or is this more extensive? (within the plugins/themes/custom/ directory that is.)

~Jon
jwtlake
 
Posts: 8
Joined: Mon Jul 29, 2013 8:58 am

Re: Locale::translate() error

Postby asmecher » Mon Jul 29, 2013 4:53 pm

Hi Jon,

That will address this problem -- but beware of indiscriminately using old code with a newer install. You may run into other problems.

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 8345
Joined: Wed Aug 10, 2005 12:56 pm

Re: Locale::translate() error

Postby jwtlake » Thu Aug 01, 2013 11:34 am

Thanks for all the help! It worked!

I downloaded OJS 2.3.7 and used the CustomThemePlugin.inc.php file from that.

The call used in this version is "return __('plugins.theme.custom.name');"

Figured id just stick with this to get things closer to the original intended setup.

~JL
jwtlake
 
Posts: 8
Joined: Mon Jul 29, 2013 8:58 am


Return to OJS Technical Support

Who is online

Users browsing this forum: Google [Bot] and 2 guests