OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



A quick fix for bilinguism in OSC2... ?

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.

A quick fix for bilinguism in OSC2... ?

Postby nicolaspayette » Fri Oct 05, 2007 1:38 pm

Hi!

I know you guys are planning a better integration of bilingualism in the next OCS2 release, but unless you tell me it's going to be out next week, I'm looking for a quick fix. Nothing too fancy: just being able to show the announcements in the users language would do the trick.

I'm thinking of loading a different CSS file depending on the user's language. E.g., for a French user, you would have:

div.english { display: none; }

in the CSS, and vice versa. Then, in each announcement, I would use divs like:

<div class='english'>Some text in English.</div>
<div class='french'>Du texte en français.</div>

Do you think that could work? And could you point me to the PHP file where the <link rel="stylesheet" href=".../common.css" type="text/css" /> line is generated and tell me which variable to check against for the user's language?

And if you have any other suggestions, they would be more then welcome.

Merci d'avance!

Nicolas
nicolaspayette
 
Posts: 5
Joined: Tue Oct 02, 2007 12:18 pm

Re: A quick fix for bilinguism in OSC2... ?

Postby asmecher » Fri Oct 05, 2007 2:48 pm

Hi nicolas,

The $currentLocale variable should be available to all templates, and it'll tell you what language the user is currently browsing with. The common header for almost all pages is templates/common/header.tpl; I'd suggest adding the CSS file there based on the value of the $currentLocale variable.

We're just finishing off OJS 2.2, which will contain vast improvements to multilingual support; after that's finished, we'll polish off the same additions for OCS 2.1, which we hope to release in December. The multilingual support already exists in CVS for OJS 2.x, but I don't think it's stable enough at the moment to use.

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

Re: A quick fix for bilinguism in OSC2... ?

Postby nicolaspayette » Mon Oct 08, 2007 12:38 pm

Thanks Alec.

I'll try something along these lines and keep you posted.

Nicolas
nicolaspayette
 
Posts: 5
Joined: Tue Oct 02, 2007 12:18 pm

Re: A quick fix for bilinguism in OSC2... ?

Postby nicolaspayette » Mon Oct 08, 2007 2:14 pm

I found a (very simple) way to do it without loading a different CSS file.

I added:
Code: Select all
<div id="{$currentLocale}">

at the top of the <body> in header.tpl (and the corresponding </div> at the end of footer.tpl).

Then, in common.css:
Code: Select all
#fr_FR .en {
  display: none;
}

#en_US .fr {
  display: none;
}

Works great.

Thanks again for your help, Alec!

Nicolas
nicolaspayette
 
Posts: 5
Joined: Tue Oct 02, 2007 12:18 pm


Return to OCS Technical Support

Who is online

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