OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



Localize Sponsor Information

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

Moderators: jmacgreg, michael, John

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

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. Please note that this FAQ is OJS-centric, but most issues are applicable to both platforms.

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 OCS Conference Support and Discussion subforum; if you have a development question, try the OCS Development subforum.

Localize Sponsor Information

Postby joelproko » Tue Jul 23, 2013 6:43 am

Dear all
I'm currently setting up an OCS site for a conference, with the Swiss Linguistic Society (SSG) as main sponsor. All sponsors have different names depending on what language is used (as do a number of cities they reside in).
So far I tried this:
- Change
Code: Select all
$sponsors = $conference->getSetting('sponsors');
to
Code: Select all
$sponsors = $conference->getLocalizedSetting('sponsors');
in /pages/about/AboutHandler.inc.php
- Adjusting the database:
Previously:
Code: Select all
mysql> SELECT * FROM sched_conf_settings WHERE setting_name="sponsors";
+---------------+--------+--------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------+
| sched_conf_id | locale | setting_name | setting_value                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 | setting_type |
+---------------+--------+--------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------+
|             1 |        | sponsors     | a:3:{i:0;a:3:{s:11:"institution";s:68:"Schweizerische Akademie der Geistes- und Sozialwissenschaften (SAGW)";s:7:"address";s:65:"SAGW<br />Hirschengraben 11<br />Postfach 8160<br />CH-3001 Berne";s:3:"url";s:18:"http://www.sagw.ch";}i:1;a:3:{s:11:"institution";s:57:"Schweizerische Sprachwissenschaftliche Gesellschaft (SSG)";s:7:"address";s:136:"Prof. Jacques Moeschler<br /> Universit� de Gen�ve<br /> D�partement de linguistique<br /> 2, rue de Candolle<br /> CH-1211 Gen�ve 4";s:3:"url";s:23:"http://www.sagw.ch/ssg/";}i:2;a:3:{s:11:"institution";s:42:"Hochschulstiftung der Universit�t Z�rich";s:7:"address";s:0:"";s:3:"url";s:45:"http://www.prof.uzh.ch/hochschulstiftung.html";}} | object       |

Now (content temporary and only 2 locales to test):
Code: Select all
mysql> SELECT * FROM sched_conf_settings WHERE setting_name="sponsors";+---------------+--------+--------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------+
| sched_conf_id | locale | setting_name | setting_value                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | setting_type |
+---------------+--------+--------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------+
|             1 | en_US  | sponsors     | a:3:{i:0;a:3:{s:11:"institution";s:47:"Swiss Academy of Humanities and Social Sciences";s:7:"address";s:64:"SAGW<br />Hirschengraben 11<br />Postfach 8160<br />CH-3001 Bern";s:3:"url";s:18:"http://www.sagw.ch";}i:1;a:3:{s:11:"institution";s:57:"Schweizerische Sprachwissenschaftliche Gesellschaft (SSG)";s:7:"address";s:160:"Prof. Jacques Moeschler<br /> Universit&eacute; de Gen&egrave;ve<br /> D&eacute;partement de linguistique<br /> 2, rue de Candolle<br /> CH-1211 Gen&egrave;ve 4";s:3:"url";s:23:"http://www.sagw.ch/ssg/";}i:2;a:3:{s:11:"institution";s:50:"Hochschulstiftung der Universit&auml;t Z&uuml;rich";s:7:"address";s:0:"";s:3:"url";s:45:"http://www.prof.uzh.ch/hochschulstiftung.html";}}                      | object       |
|             1 | de_DE  | sponsors     | a:3:{i:0;a:3:{s:11:"institution";s:68:"Schweizerische Akademie der Geistes- und Sozialwissenschaften (SAGW)";s:7:"address";s:64:"SAGW<br />Hirschengraben 11<br />Postfach 8160<br />CH-3001 Bern";s:3:"url";s:18:"http://www.sagw.ch";}i:1;a:3:{s:11:"institution";s:57:"Schweizerische Sprachwissenschaftliche Gesellschaft (SSG)";s:7:"address";s:160:"Prof. Jacques Moeschler<br /> Universit&eacute; de Gen&egrave;ve<br /> D&eacute;partement de linguistique<br /> 2, rue de Candolle<br /> CH-1211 Gen&egrave;ve 4";s:3:"url";s:23:"http://www.sagw.ch/ssg/";}i:2;a:3:{s:11:"institution";s:50:"Hochschulstiftung der Universit&auml;t Z&uuml;rich";s:7:"address";s:0:"";s:3:"url";s:45:"http://www.prof.uzh.ch/hochschulstiftung.html";}} | object       |
+---------------+--------+--------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------+

This resulted in no sponsors showing at all at /index.php/chling/no8/about/organizingTeam

I then tried to change templates/about/conferenceSponsorship.tpl
Previously:
Code: Select all
   {foreach from=$sponsors item=sponsor}
   {if $sponsor.institution}
      {if $sponsor.url}
         <li><a href="{$sponsor.url|escape}">{$sponsor.institution|escape}</a></li>
      {else}
         <li>{$sponsor.institution|escape}</li>
      {/if}
   {/if}
   {/foreach}
Now:
Code: Select all
   {foreach from=$sponsors item=sponsor}
         <li><a href="{translate key="sponsor.url"}">{translate key="sponsor.institution"}</a></li>
   {/foreach}

This resulted in two (why not 3?) ## sponsor.institution ## entries at /index.php/chling/no8/about/organizingTeam.

I think I need some help here :?

PS: I have yet to see where the mailing addresses of the sponsors are being shown to visitors. I assume I'd have to localize that page too.
PPS: I've avoided scripting around the conference manager for now, since that's way too complex for me, I'm getting lost at _delegateToRouter() at the latest.
joelproko
 
Posts: 11
Joined: Tue Jul 02, 2013 5:25 am

Re: Localize Sponsor Information

Postby asmecher » Tue Jul 23, 2013 10:47 am

Hi joelproko,

You're on the right track -- I suspect you're getting hit by an out-of-date cache file. When you modify conference settings by hand in the database, make sure you flush your data cache, or OCS will continue to use the cache file. To do this, delete all .php files from cache/ (or use the Administrator's web interface to flush the caches).

PS: I have yet to see where the mailing addresses of the sponsors are being shown to visitors. I assume I'd have to localize that page too.

Hmm, I've just checked, and that field is never displayed! The sponsor information is otherwise displayed in templates/about/conferenceSponsorship.tpl, so adding the address there would be best. Meanwhile, I've filed this omission in http://pkp.sfu.ca/bugzilla/show_bug.cgi?id=8326.

PPS: I've avoided scripting around the conference manager for now, since that's way too complex for me, I'm getting lost at _delegateToRouter() at the latest.

What would you like to do? Fortunately, it shouldn't be necessary to know your way around the router code to make changes.

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

Re: Localize Sponsor Information

Postby joelproko » Tue Aug 13, 2013 5:46 am

Thanks for the reply.

I'm always flushing the cache after every change I make; didn't help, sadly.

As for what I'd like to with the conference manager: I'd like to reflect the change that the sponsor information is now localized.
joelproko
 
Posts: 11
Joined: Tue Jul 02, 2013 5:25 am

Re: Localize Sponsor Information

Postby asmecher » Thu Aug 15, 2013 12:22 pm

Hi joelproko,

Can you look at your scheduled conference settings cache file (e.g. cache/fc-schedConfSettings-1.php) and tell me what you get for the "sponsors" setting?

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

Re: Localize Sponsor Information

Postby joelproko » Tue Sep 24, 2013 4:28 am

Sorry for taking so long to reply. I checked if everything is still set up how I described it, re-uploaded the relevant changed files just to be sure, cleared the cache again, and re-checked the result. Still
Sponsors

##sponsor.institution##
##sponsor.institution##


This is the "sponsors" setting in cache/fc-schedConfSettings-1.php you asked for:
Code: Select all
  'sponsors' =>
  array (
    'en_US' =>
    array (
      0 =>
      array (
        'institution' => 'Swiss Academy of Humanities and Social Sciences',
        'address' => 'SAGW<br />Hirschengraben 11<br />Postfach 8160<br />CH-3001 Bern',
        'url' => 'http://www.sagw.ch',
      ),
      1 =>
      array (
        'institution' => 'Schweizerische Sprachwissenschaftliche Gesellschaft (SSG)',
        'address' => 'Prof. Jacques Moeschler<br /> Universit&eacute; de Gen&egrave;ve<br /> D&eacute;partement de linguistique<br /> 2, rue de Candolle<br /> CH-1211 Gen&egrave;ve 4',
        'url' => 'http://www.sagw.ch/ssg/',
      ),
      2 =>
      array (
        'institution' => 'Hochschulstiftung der Universit&auml;t Z&uuml;rich',
        'address' => '',
        'url' => 'http://www.prof.uzh.ch/hochschulstiftung.html',
      ),
    ),
    'de_DE' =>
    array (
      0 =>
      array (
        'institution' => 'Schweizerische Akademie der Geistes- und Sozialwissenschaften (SAGW)',
        'address' => 'SAGW<br />Hirschengraben 11<br />Postfach 8160<br />CH-3001 Bern',
        'url' => 'http://www.sagw.ch',
      ),
      1 =>
      array (
        'institution' => 'Schweizerische Sprachwissenschaftliche Gesellschaft (SSG)',
        'address' => 'Prof. Jacques Moeschler<br /> Universit&eacute; de Gen&egrave;ve<br /> D&eacute;partement de linguistique<br /> 2, rue de Candolle<br /> CH-1211 Gen&egrave;ve 4',
        'url' => 'http://www.sagw.ch/ssg/',
      ),
      2 =>
      array (
        'institution' => 'Hochschulstiftung der Universit&auml;t Z&uuml;rich',
        'address' => '',
        'url' => 'http://www.prof.uzh.ch/hochschulstiftung.html',
      ),
    ),
  ),


EDIT: I copied the English entry to the other two used locales, thinking the problem might lie in not having localizations for all used locales. It didn't fix the problem, but I noticed something. As you see in the quote above, there were two localization errors, despite there being 3 sponsors. I had assumed the third had errored out and thus not displayed, but with 4 localizations (en_US, de_DE, it_IT, fr_CA), there are now four localization errors, so the problem must lie in not going deep enough into the array:
Sponsors

##sponsor.institution##
##sponsor.institution##
##sponsor.institution##
##sponsor.institution##
joelproko
 
Posts: 11
Joined: Tue Jul 02, 2013 5:25 am

Re: Localize Sponsor Information

Postby joelproko » Tue Sep 24, 2013 6:40 am

Problem solved! Solution coming in some minutes.

Edit:
Here are instructions for anyone who wants to localize Sponsors:

Code changes:
pages/about/AboutHandler.inc.php: Only 2 lines changed, should be easy to find.
Code: Select all
      if($conference) {
         $contributorNote = $conference->getLocalizedSetting('contributorNote');
         $contributors = $conference->getSetting('contributors');
         if (!is_array($contributors)) $contributors = array();

         $sponsorNote = $conference->getLocalizedSetting('sponsorNote');
         $sponsors = $conference->getLocalizedSetting('sponsors'); // changed to localize
         if (!is_array($sponsors)) $sponsors = array();
      }

      if($schedConf) {
         $contributorNote = $schedConf->getLocalizedSetting('contributorNote');
         $eventContributors = $schedConf->getSetting('contributors');
         if (is_array($eventContributors)) $contributors = array_merge($contributors, $eventContributors);

         $sponsorNote = $schedConf->getLocalizedSetting('sponsorNote');
         $eventSponsors = $schedConf->getLocalizedSetting('sponsors'); // changed to localize
         if (is_array($eventSponsors)) $sponsors = array_merge($sponsors, $eventSponsors);
      }


templates/about/conferenceSponsorship.tpl: Turns out this doesn't need to be changed at all.

Necessary changes to database:
Unedited, 'SELECT * FROM sched_conf_settings WHERE setting_name="sponsors";' yields one result, with "locale" empty. Make a new, identical entry for every locale you're going to use, except with "locale" set to the corresponding locale key. The content of "setting_value" is a serialized variable. I suggest you get the original with php, unserialize it, and var_dump the resulting variable to look at it. Then make a copy, change what you want to change, serialize it, and insert that as the new localized sponsors entry. I strongly suggest you use &eacute; etc. instead of é et al.; you avoid possible encoding issues that way.
OCS not only checks $sched_conf, it also checks $conferences. In our database, I haven't found any setting called "sponsors" anywhere outside of sched_conf_settings, but I assume that the relevant setting would be in conference_settings, if it were defined. So if you have set sponsors that apply to every scheduled conference in a conference series, you should probably do the same as above with conference_settings WHERE setting_name="sponsors".

I didn't get into changing anything in the admin area, so until the PKP team decides to implement these changes and reflect them in the admin area, any sponsor information will have to be changed and created manually with SQL commands instead of via the content management system.

I hope this post helps anyone looking for a solution for localizing sponsors.
joelproko
 
Posts: 11
Joined: Tue Jul 02, 2013 5:25 am

Re: Localize Sponsor Information

Postby asmecher » Tue Sep 24, 2013 8:58 am

Hi joelproko,

Thanks for posting!

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

Re: Localize Sponsor Information

Postby joelproko » Tue Oct 01, 2013 8:23 am

A word of caution about entering stuff directly via mysql: For some reason, non-ASCII characters became a problem for me. Both ISO-8859-1 nor UTF-8 were rejected by the system ($sponsors arrived empty in AboutHandler.inc.php whenever there was a non-ASCII character of either encoding inside any sponsor information).

I also tried the following in pages/about/Abouthandler.inc.php to enable &eacute;, &uuml; etc. instead:
Code: Select all
      if($schedConf) {
         $contributorNote = $schedConf->getLocalizedSetting('contributorNote');
         $eventContributors = $schedConf->getSetting('contributors');
         if (is_array($eventContributors)) $contributors = array_merge($contributors, $eventContributors);

         $sponsorNote = $schedConf->getLocalizedSetting('sponsorNote');
         $eventSponsors = $schedConf->getLocalizedSetting('sponsors');
         if (is_array($eventSponsors)) $sponsors = array_merge($sponsors, $eventSponsors);
      }
      
      //Make usage of HTML-Entities in Sponsor Information possible
      foreach ($sponsors as &$sponsor_tmp)
      {
         foreach ($sponsor_tmp as $sponsor_tmp_key => &$sponsor_tmp_value)
         {
            if ($sponsor_tmp_key!="url")
               $sponsor_tmp_value = html_entity_decode($sponsor_tmp_value);
         }
      }

      $templateMgr->assign_by_ref('contributorNote', $contributorNote);
      $templateMgr->assign_by_ref('contributors', $contributors);
      $templateMgr->assign('sponsorNote', $sponsorNote);
      $templateMgr->assign_by_ref('sponsors', $sponsors);

This results in the correct number of bulletpoints under the Sponsors heading on the About>Organizing Team page, but whatever is changed by this snippet ends up empty. In my case, the last of three sponsors has non-ascii characters in its institution name. The first two sponsors are perfectly fine, the last one would technically have a working link (the correct link is in the href attribute), but the text (the institution) is missing. I tried to find the culprit, but as far as I can tell, this text goes directly to the Smarty engine. The text itself, before it hits my snippet, is still "raw", as in untouched by any htmlentities()/html_specialchars() call.

PS: I also tried entering it via the manager, then copying the resulting no-locale database entry to all locales (to test), then deleting the no-locale entry from the database. Same difference. $sponsors arrives empty in AboutHandler.inc.php
joelproko
 
Posts: 11
Joined: Tue Jul 02, 2013 5:25 am


Return to OCS Technical Support

Who is online

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

cron