[Koha] Set principal language

Stefano Bargioni bargioni at pusc.it
Thu Mar 31 03:36:40 NZDT 2011


Vitor, please try my (raw?) solution adding the following JS code to sysprefs opacuserjs and intranetuserjs.
Ensure you deleted cookie KohaOpacLanguage from your browser before testing it.

var lang = readCookie('KohaOpacLanguage');
if (!lang) {
	// no language specified, change to Italian
	setCookie('KohaOpacLanguage','it-IT',null,'/');
	window.location.href=location.href; // reload page
}

function setCookie(name, value, expires, path, domain, secure) {
	// set time, it's in milliseconds
	var today = new Date();
	today.setTime( today.getTime() );

	/*
	if the expires variable is set, make the correct expires time, the current script below will set
	it for x number of days, to make it for hours, delete * 24, for minutes, delete * 60 * 24
	*/
	if ( expires ) { expires = expires * 1000 * 60 * 60 * 24; }
	var expires_date = new Date( today.getTime() + (expires) );

	document.cookie = name + "=" +escape( value ) +
	( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) +
	( ( path ) ? ";path=" + path : "" ) +
	( ( domain ) ? ";domain=" + domain : "" ) +
	( ( secure ) ? ";secure" : "" );
}

Function readCookie is defined in tags.js, already loaded by Koha, while I'm not sure of something similar for setCookie. Maybe developers can tell us more, to avoid reinvent the wheel.
HTH. Stefano

On Mar 25, 2011, at 12:55 , Vitor Fernandes wrote:

> Hi there.
> 
> I've a Koha installation with portuguese and english languages
> installed, but by default the OPAC and Staff Client appears in english
> and then it's possible to change to Portuguese.
> There is anyway to set the default language of Koha?
> I want that OPAC and Staff Client appears in Portuguese and then can
> change to English.
> 
> Regards.
> Vitor Fernandes
> _______________________________________________
> Koha mailing list  http://koha-community.org
> Koha at lists.katipo.co.nz
> http://lists.katipo.co.nz/mailman/listinfo/koha
> 



More information about the Koha mailing list