OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



Adding articles into back issues with bilingual abstracts?

Are you an Editor, Author, or Journal Manager in need of help? Want to talk to us about workflow issues? This is your forum.

Moderators: jmacgreg, michael, vgabler, John

Forum rules
The Public Knowledge Project Support Forum is moving to http://forum.pkp.sfu.ca

This forum will be maintained permanently as an archived historical resource, but all new questions should be added to the new forum. Questions will no longer be monitored on this old forum after March 30, 2015.

Adding articles into back issues with bilingual abstracts?

Postby jasonzou » Thu Nov 24, 2005 7:21 am

Is there a way to add bilingual abstracts( one is in English, the other is in French)? I noticed that the abstract element has a local attribute. Is it for adding mutiligual stuff? If so, how can I do that?

Thanks,

Jason
jasonzou
 
Posts: 14
Joined: Thu Jun 02, 2005 7:52 am

Figured out a way...

Postby jasonzou » Thu Nov 24, 2005 9:56 am

There are a lot of files that I have changed to get this simple task done.
First of all, I changed the journal_setting table and add a row for 'alternateLocale1'. Then created another locale by myself. I just simply copied the en_US to fr_CA created for French version abstract.
Then add a line: 'fr_CA' => 'French' into ../locale/cache/locale.inc.php
By default, OJS system will display one abstract. So I modified the ../templates/article/article.tpl and added the following snippet:
{if $article->getAbstractAlt1()}
<h4>{translate key="article.abstract" locale='fr_CA'}</h4>
<br />
<div>{$article->getAbstractAlt1()|strip_unsafe_html|nl2br}</div>
<br />
{/if}

The final step is to change the TemplateManager::smartyTranslate(). I added the following code to support localization:
function smartyTranslate($params, &$smarty) {
if (isset($params) && !empty($params)) {
if (isset($params['key'])) {
$key = $params['key'];
unset($params['key']);

// the following lines are added by Qing Zou, qzou@lakeheadu.ca
$locale = Locale::getLocale();

if (isset($params['locale'])){
$locale = $params['locale'];
unset($params['locale']);
}
// end of modification.

if (isset($params['params'])) {
$paramsArray = $params['params'];
unset($params['params']);
$params = array_merge($params, $paramsArray);
}
return Locale::translate($key, $params, $locale);

} else {
return Locale::translate('');
}
}
}

I don't know whether there is a better way to do it. I hate to change the source code of OJS. Anyway, the trick works fine.

Enjoy OJS

Jason
jasonzou
 
Posts: 14
Joined: Thu Jun 02, 2005 7:52 am

Postby asmecher » Thu Nov 24, 2005 4:11 pm

Hi Jason,

We've been considering similar changes and may be adding something to the next release, OJS 2.1, to make this easier. We'll be supporting a few additional things like localizeable section titles.

You shouldn't have to add an alternateLocale1 field, however -- this data is already available. See the implementation of getArticleTitle for an example.

Regards,
Alec Smecher
Open Journal Systems Team
asmecher
 
Posts: 10015
Joined: Wed Aug 10, 2005 12:56 pm

Postby jasonzou » Fri Nov 25, 2005 8:37 am

Hi Alec,

I will check the implementation of getArticleTitle.

Thanks,

Jason
jasonzou
 
Posts: 14
Joined: Thu Jun 02, 2005 7:52 am

Postby asmecher » Fri Nov 25, 2005 1:31 pm

Hi Jason,

Currently, you'll need to install an additional locale to get this working. (The fr_CA locale you generated from en_US will work fine.)
  • As Site Administrator, go to the Languages panel and ensure that the fr_CA locale is installed and available for the journals to use.
  • As Journal Administrator, ensure that fr_CA is chosen as an Alternate Locale.
  • You should now be able to enter abstracts in multiple languages. (Up to two alternate locales are supported.)

By the way, you shouldn't be modifying the locale cache file; instead, add your locale to registry/locales.xml and the cache file will be generated automatically. (See docs/README for more information about locales and translation.)

Regards,
Alec Smecher
Open Journal Systems Team
asmecher
 
Posts: 10015
Joined: Wed Aug 10, 2005 12:56 pm

Postby jasonzou » Mon Nov 28, 2005 12:08 pm

Thanks!

For me, I just want to display abstract in English and French within one page. And it works fine.

By the way, I have changed the locale.xml in the registry folder.
jasonzou
 
Posts: 14
Joined: Thu Jun 02, 2005 7:52 am


Return to OJS Editorial Support and Discussion

Who is online

Users browsing this forum: No registered users and 2 guests