OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



How to provide unique URL for diferent language localization

OJS development discussion, enhancement requests, third-party patches and plug-ins.

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

Forum rules
Developer Resources:

Documentation: The OJS Technical Reference and the OJS API Reference are both available from the OJS Documentation page.

Git: You can access our public Git Repository here. Comprehensive Git usage instructions are available on the wiki.

Bugzilla: You can access our Bugzilla report tracker here.

Search: You can use our Google Custom Search to search across our main website, the support forum, and Bugzilla.

Questions and discussion are welcome, but if you have a workflow or usability question you should probably post to the OJS Editorial Support and Discussion subforum; if you have a technical support question, try the OJS Technical Support subforum.

How to provide unique URL for diferent language localization

Postby radap » Thu Feb 07, 2013 2:53 pm

Hi,

Our journal (radap.kpi.ua) publish paper on three languages Ukrainian, Russian and English, because we use in OJS three localization. But search engines could index only one localization that by default.

I found that in head tag there is metadatas on three languages, but it seems that only google scolar recognize their, rest of engines (include common google) not pick up this metedata.

Is it possible to provide unique URL for different language localization? May be by use mod_rewrite

Thanks a lot,
Vitaliy
radap
 
Posts: 5
Joined: Thu Feb 07, 2013 1:02 pm
Location: radap.kpi.ua

Re: How to provide unique URL for diferent language localiza

Postby angevent » Mon Jul 22, 2013 3:18 am

Up :)
angevent
 
Posts: 29
Joined: Tue Jun 11, 2013 1:12 pm

Re: How to provide unique URL for diferent language localiza

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

Hi all,

See http://pkp.sfu.ca/bugzilla/show_bug.cgi?id=8353#c7. There's a couple of patches linked there that will permit a "uiLocale" URL parameter to override the locale for any page. You can use mod_rewrite to affix that parameter to URLs going into OJS according to whatever scheme you like.

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

Re: How to provide unique URL for diferent language localiza

Postby Looted » Thu Mar 20, 2014 5:17 pm

Hello,
I have a problem with the patches provided:
In the github version
Code: Select all
$locale = Request::getUserVar('uiLocale');
   if (empty($locale) || !in_array($locale, array_keys(AppLocale::getSupportedLocales()))) $locale = Request::getCookieVar('currentLocale');
   } else {
   $sessionManager =& SessionManager::getManager();
   $session =& $sessionManager->getUserSession();
   $locale = Request::getUserVar('setLocale');

the uiLocale parameter does not work at all (appending it to url doesn't change the language). When I put $locale = Request::getUserVar('uiLocale') after $locale = Request::getUserVar('setLocale') it does work. However, it breaks the language toggle (changing language in the toggle does nothing). Is this supposed to work like that? I want to provide URLs for different language versions (especially that Google Scholar indexes resources in one language only), but with provided solution, when someone gets to the page using the link with additional language parameter, he won't be able to change the language.
Looted
 
Posts: 13
Joined: Tue Oct 29, 2013 10:06 am

Re: How to provide unique URL for diferent language localiza

Postby Looted » Fri Mar 21, 2014 6:34 am

I did work out a solution to the problem:

Code: Select all
if ($session->getSessionVar('currentLocale')) {
$locale = $session->getSessionVar('currentLocale');
}
else {
if (Request::getUserVar('uiLocale')){
$locale = Request::getUserVar('uiLocale');}
}


Now the uiLocale parameter decides what is the page locale, but it is overwritten when a user changes locale using the language toggle. As long as user doesn't touch the toggle (or session expires), the uiLocale parameter works. Now I have a single question, maybe someone know the answer: do bots use sessions or click on the forms (like language toggle)? The problem so far was, that bots indexed my page only in default locale (english), which led to a serious problem in Google Scholar - polish articles god indexed with their english titles, and now Google doesn't count the citations in their original title (they appear as having no citations).
My idea of resolving a problem was initially adding a rule, that metadata is generated in the original language (not the site current locale), but it isn't a perfect solution (normal google still indexes either polish, or english page, not both). So came the idea of generating language specific links, so the bots could index both. The original solution, pushed to github, broke the language toggle block, so while the bots would get both the versions of the article, the user following that link wouldn't be able to change language.
I think such functinality is an important area that needs improvement in OJS for multilangual journals - so that the site gets indexed in all supplied languages, and not only the default one. Classic Google search does even support such translation parameters in webmaster tools; Google Scholar doesn't, so it's even more important to provide multiple links for each version. If anyone has any idea on how to approach the issue with indexing, I'd be glad to hear it.
Looted
 
Posts: 13
Joined: Tue Oct 29, 2013 10:06 am


Return to OJS Development

Who is online

Users browsing this forum: No registered users and 1 guest