Translation
Making translation to Eprints3 is similar to that of earlier versions. Here only some of the differences are pointed out.
Contents
Phrases
Other configuration files
Subject list
Patches
Apart from translating the language dependent phrase files, some other modification might be useful for a multilanguage repository:
- user names could be rendered depending on the language
- expiration time for the pin codes (e.g. when registering)
- generation time for the browse pages
- proper utf-8 encoding for outgoing e-mails
Here are some ideas what to do.
Rendering user names
All fields can have their separate rendering routine. This routine should be given as the value of the render_single_value attribute. In our case modify the top of cfg.d/user_fields.pl file which contains the definition of the user fields as follows:
$c->{fields}->{user} = [ { 'name' => 'name', 'type' => 'name', 'render_order' => 'gf', 'render_single_value' => \&my_namefield_rendering, }, ...
and insert the definition of my_namefield_rendering e.g. at the end of the same file:
sub my_namefield_rendering { my ($session,$field,$value,$object)=@_; my $langid = $session->{lang}->{id}; my $format = { # format: f, g - first, given; h - honourific, l - lineage 'en' => 'hfl,g', 'hu' => 'hlfg', # Further lines should be added for other used languages } -> {$langid} my $all=""; foreach my $fmtchar ( split //, $format ) { my $insert=""; if( $fmtchar eq "l" ) {$insert = $value->{lineage}; } elsif( $fmtchar eq "f" ) { $insert = $value->{family}; } elsif( $fmtchar eq "g" ) { $insert = $value->{given}; } elsif( $fmtchar eq "h" ) { $insert = $value->{honourific}; } elsif( $all ){ $all .= $fmtchar; } next if( ! $insert ); $all .= $insert; } my $span=$session->make_element("span",class=>"person_name"); $span->appendChild($session->make_text($all)); $return $span; }