Gossamer Forum
Home : Products : Gossamer Links : Discussions :

paging and language file

Quote Reply
paging and language file
Hi would it be possible to have the paging title information (title="Next Page") in the language file in order to make it easier for sites that aren't in English to translate it without having to modify core code ?

At the moment they are (hard) coded in the Utils.pm file...

style_next "..." paging-next.gif" alt=">" title="Next Page" />|,


Thanks, John
Significant Media
Quote Reply
Re: [Jag] paging and language file In reply to
Oops, I tried to make everything work by passing in options, but it looks like i missed some. That should be fixed before the final release.

Adrian
Quote Reply
Re: [Jag] paging and language file In reply to
Actually, for those titles, you'll have to override the style_* options to replace the titles. Specifying the titles separately makes the paging code difficult, and doesn't make that much sense because style_* doesn't necessarily have to be an image. However, overriding options currently involves changing it in 18 places - that will be fixed in the next release.

Adrian
Quote Reply
Re: [brewt] paging and language file In reply to
Hi Adrian,

I'm not sure exactly what you mean by / or where I would 'override' style options. Obviously as you say the title="action" is an interesting element on the page since it can provide extra information for users whether it's used on images or on href type links etc.
It will however be an issue fro owners of Links that either have a language specific version or who have translated it into another language (like myself) if they are stuck with English indications.
My first reaction was to simply modify the Utils.pm file but this is not a great idea especially in view of the new update system that will most probably wipe out this type of modification ?

Thanks for your explanations,

John
Significant Media
Quote Reply
Re: [Jag] paging and language file In reply to
If you take a look at the header of the function Links::Utils::paging, it describes all the options you can pass into it (note that paging will change a bit in the next release). To change the language in the title attributes, you'll have to pass in the style_* options to override the defaults. Currently, this means changing it in 18 places in 9 templates, but in the next release, you can just change it in the globals.

Making those override changes in the current release actually isn't too fun, so I'll just show you how it will most likely work in the next release. The options to paging are prioritised in the following order (first options override later ones): options passed in as arguments, options taken from the paging_options global, and the defaults inside the paging function (which no one should really be changing).

Options passed in as arguments would be any options you passed in when you call paging:
Code:
<%Links::Utils::paging(max_pages => 100, boundary_pages => 5)%>
By default, no arguments are passed in, with the exception for the bottom toolbar on the page, where the button_id is changed.

The paging_options global is a code reference which returns a hash reference that, by default, looks like this:
Code:
sub {
return {
max_pages => 25,
boundary_pages => 1,
style => 1,
};
}

So if you wanted to change the language of the titles, all you would need to do is modify the paging_options global to add in the extra options:
Code:
sub {
my %vars = %{GT::Template->vars};
return {
max_pages => 25,
boundary_pages => 1,
style => 1,
style_next => qq|<img src="$CFG->{build_images_url}/$vars{t}/paging-next.gif" alt="&gt;" title="Next Page" />|,
lang_of => 'of', # You'll probably want to change these as well
lang_button => 'Go',
};
}

Adrian
Quote Reply
Re: [brewt] paging and language file In reply to
Hi Adrian,
Thanks for taking the time to explain this. I've got a clearer idea of how things will work, looks very interesting the possibilities that this will provide Links users with !

Thanks, John
Significant Media