Commit 90c7ace3 authored by sikeda's avatar sikeda
Browse files

[-dev] (r10623) Change naming & calling converntions.

git-svn-id: https://subversion.renater.fr/sympa/branches/sympa-6.2-branch@10625 05aa8bb8-cd2b-0410-b1d7-8918dfa770ce
parent 5636631f
......@@ -25,10 +25,9 @@
use lib '--modulesdir--';
use Conf;
use Language;
use Sympa::Language;
use tt2;
use Sympa::Constants;
use List;
use Log;
......@@ -194,7 +193,7 @@ foreach my $tpl (@templates) {
if ($dest_file =~ /^([\w\-]+)\.(\w+)\.tt2$/) {
my $lang = $2;
$dest_file =~ s/^([\w\-]+)\.(\w+)\.tt2$/$1\.tt2/;
$dest_path .= '/'.&Language::Lang2Locale($lang);
$dest_path .= '/' . Sympa::Language::lang2oldlocale($lang);
}
## If file has no extension
......
......@@ -46,7 +46,7 @@ use Fetch;
use WebAgent;
use tools;
use tt2;
use Language;
use Sympa::Language;
use Log;
use Conf;
use mail;
......@@ -422,7 +422,9 @@ sub merge_data {
);
$user->{'escaped_email'} = &URI::Escape::uri_escape($rcpt);
$user->{'friendly_date'} = gettext_strftime("%d %b %Y %H:%M", localtime($user->{'date'}));
my $language = Sympa::Language->instance;
$user->{'friendly_date'} = $language->gettext_strftime(
"%d %b %Y %H:%M", localtime($user->{'date'}));
# this method as been removed because some users may forward authentication link
# $user->{'fingerprint'} = &tools::get_fingerprint($rcpt);
......
......@@ -33,7 +33,7 @@ use Time::Local;
use MIME::EncWords;
use Conf;
use Language;
use Sympa::Language;
use Log;
use List;
use Message;
......@@ -67,6 +67,9 @@ my %comms = ('add' => 'add',
'ver|verify' => 'verify',
'whi|which|status' => 'which'
);
my $language = Sympa::Language->instance;
# command sender
my $sender = '';
# time of the process command
......@@ -186,9 +189,9 @@ sub help {
$data->{'is_owner'} = 1 if @owner;
$data->{'is_editor'} = 1 if @editor;
$data->{'user'} = Sympa::User->new($sender);
&Language::SetLang($data->{'user'}->lang)
$language->set_lang($data->{'user'}->lang)
if $data->{'user'}->lang;
$data->{'subject'} = gettext("User guide");
$data->{'subject'} = $language->gettext("User guide");
$data->{'auto_submitted'} = 'auto-replied';
unless(&List::send_global_file("helpfile", $sender, $robot, $data)){
......@@ -378,7 +381,7 @@ sub getfile {
return 'unknownlist';
}
&Language::SetLang($list->{'admin'}{'lang'});
$language->set_lang($list->{'admin'}{'lang'});
unless ($list->is_archived()) {
&report::reject_report_cmd('user','empty_archives',{},$cmd_line);
......@@ -439,7 +442,7 @@ sub last {
return 'unknownlist';
}
&Language::SetLang($list->{'admin'}{'lang'});
$language->set_lang($list->{'admin'}{'lang'});
unless ($list->is_archived()) {
&report::reject_report_cmd('user','empty_archives',{},$cmd_line);
......@@ -492,7 +495,7 @@ sub index {
return 'unknown_list';
}
&Language::SetLang($list->{'admin'}{'lang'});
$language->set_lang($list->{'admin'}{'lang'});
## Now check if we may send the list of users to the requestor.
## Check all this depending on the values of the Review field in
......@@ -550,7 +553,7 @@ sub review {
return 'unknown_list';
}
&Language::SetLang($list->{'admin'}{'lang'});
$language->set_lang($list->{'admin'}{'lang'});
$list->on_the_fly_sync_include('use_ttl' => 1);
......@@ -662,7 +665,7 @@ sub verify {
my $user;
&Language::SetLang($list->{'admin'}{'lang'});
$language->set_lang($list->{'admin'}{'lang'});
if ($sign_mod) {
&Log::do_log('info', 'VERIFY successfull from %s', $sender,time-$time_command);
......@@ -714,7 +717,7 @@ sub subscribe {
return 'unknown_list';
}
&Language::SetLang($list->{'admin'}{'lang'});
$language->set_lang($list->{'admin'}{'lang'});
## This is a really minimalistic handling of the comments,
## it is far away from RFC-822 completeness.
......@@ -899,7 +902,7 @@ sub info {
return 'unknown_list';
}
&Language::SetLang($list->{'admin'}{'lang'});
$language->set_lang($list->{'admin'}{'lang'});
my $auth_method = &get_auth_method('info','',{'type'=>'auth_failed',
'data'=>{},
......@@ -958,7 +961,7 @@ sub info {
if (defined $list->{'admin'}{'digest'}) {
foreach my $d (@{$list->{'admin'}{'digest'}{'days'}}) {
push @days, gettext_strftime("%A", localtime(0 + ($d +3) * (3600 * 24)));
push @days, $language->gettext_strftime("%A", localtime(0 + ($d +3) * (3600 * 24)));
}
$data->{'digest'} = join (',', @days).' '.$list->{'admin'}{'digest'}{'hour'}.':'.$list->{'admin'}{'digest'}{'minute'};
}
......@@ -1065,7 +1068,7 @@ sub signoff {
return 'unknown_list';
}
&Language::SetLang($list->{'admin'}{'lang'});
$language->set_lang($list->{'admin'}{'lang'});
$auth_method = &get_auth_method('signoff',$email,{'type'=>'wrong_email_confirm',
'data'=>{'command'=>'unsubscription'},
......@@ -1219,7 +1222,7 @@ sub add {
return 'unknown_list';
}
&Language::SetLang($list->{'admin'}{'lang'});
$language->set_lang($list->{'admin'}{'lang'});
my $auth_method = &get_auth_method('add',$email,{'type'=>'wrong_email_confirm',
'data'=>{'command'=>'addition'},
......@@ -1365,7 +1368,7 @@ sub invite {
return 'unknown_list';
}
&Language::SetLang($list->{'admin'}{'lang'});
$language->set_lang($list->{'admin'}{'lang'});
my $auth_method = &get_auth_method('invite',$email,{'type'=>'wrong_email_confirm',
'data'=>{'command'=>'invitation'},
......@@ -1554,7 +1557,7 @@ sub remind {
}else{
&Language::SetLang($list->{'admin'}{'lang'});
$language->set_lang($list->{'admin'}{'lang'});
$host = $list->{'admin'}{'host'};
......@@ -1641,7 +1644,7 @@ sub remind {
my %global_info;
my $count = 0 ;
$context{'subject'} = gettext("Subscription summary");
$context{'subject'} = $language->gettext("Subscription summary");
# this remind is a global remind.
my $all_lists = &List::get_lists($robot);
......@@ -1754,7 +1757,7 @@ sub del {
return 'unknown_list';
}
&Language::SetLang($list->{'admin'}{'lang'});
$language->set_lang($list->{'admin'}{'lang'});
my $auth_method = &get_auth_method('del',$who,{'type'=>'wrong_email_confirm',
'data'=>{'command'=>'delete'},
......@@ -1936,7 +1939,7 @@ sub set {
return 'unknown_list';
}
&Language::SetLang($list->{'admin'}{'lang'});
$language->set_lang($list->{'admin'}{'lang'});
## Check if we know this email on the list and remove it. Otherwise
## just reject the message.
......@@ -2029,7 +2032,7 @@ sub distribute {
return 'unknown_list';
}
&Language::SetLang($list->{'admin'}{'lang'});
$language->set_lang($list->{'admin'}{'lang'});
#read the moderation queue and purge it
my $modqueue = &Conf::get_robot_conf($robot,'queuemod') ;
......@@ -2170,7 +2173,7 @@ sub confirm {
my $msg = $message->{'msg'};
my $list = $message->{'list'};
&Language::SetLang($list->{'admin'}{'lang'});
$language->set_lang($list->{'admin'}{'lang'});
my $name = $list->{'name'};
my $bytes = -s $file;
......@@ -2328,7 +2331,7 @@ sub reject {
return 'unknown_list';
}
&Language::SetLang($list->{'admin'}{'lang'});
$language->set_lang($list->{'admin'}{'lang'});
my $name = "$list->{'name'}";
my $file;
......@@ -2434,7 +2437,7 @@ sub modindex {
return 'unknown_list';
}
&Language::SetLang($list->{'admin'}{'lang'});
$language->set_lang($list->{'admin'}{'lang'});
my $modqueue = &Conf::get_robot_conf($robot,'queuemod');
......
......@@ -74,6 +74,11 @@ my @more_data_sources = qw/
# All non-pluggable sources are in the admin user file
my %config_in_admin_user_file = map +($_ => 1), @sources_providing_listmembers;
# Language context
my $language = Sympa::Language->instance;
=encoding utf-8
=head1 CONSTRUCTOR
=item new( [PHRASE] )
......@@ -263,7 +268,7 @@ use IO::Scalar;
use Storable;
use Mail::Header;
use Archive;
use Language;
use Sympa::Language;
use Log;
use Conf;
use mail;
......@@ -898,10 +903,12 @@ sub save_config {
## Update management info
$self->{'admin'}{'serial'}++;
$self->{'admin'}{'update'} = {'email' => $email,
'date_epoch' => time,
'date' => gettext_strftime("%d %b %Y at %H:%M:%S", localtime time),
};
$self->{'admin'}{'update'} = {
'email' => $email,
'date_epoch' => time,
'date' => $language->gettext_strftime(
"%d %b %Y at %H:%M:%S", localtime time),
};
unless ($self->_save_list_config_file($config_file_name, $old_config_file_name)) {
&Log::do_log('info', 'unable to save config file %s', $config_file_name);
......@@ -1551,7 +1558,7 @@ sub distribute_msg {
# Identify default new From address
my $phraseMode = $self->{'admin'}{'dmarc_protection'}{'phrase'};
my $newAddr = '';
my $userName = gettext('Anonymous');
my $userName = $language->gettext('Anonymous');
my $newComment;
$anonaddr = $self->{'admin'}{'dmarc_protection'}{'other_email'};
$anonaddr = $name . '@' . $host if(!$anonaddr or $anonaddr !~/@/);
......@@ -1570,13 +1577,13 @@ sub distribute_msg {
# for the sender to obtain their name that way? Might be difficult.
$userName = $addresses[0]->address;
$userName =~ s/\@.*// unless($phraseMode eq 'name_and_email');
$userName = gettext('Anonymous') unless $userName =~ /\S/;
$userName = $language->gettext('Anonymous') unless $userName =~ /\S/;
}
if($phraseMode eq 'name_and_email') { # NAME (EMAIL)
;
} elsif($phraseMode eq 'name_via_list') { # NAME (via LIST Mailing List)
$newComment =
sprintf gettext('via %s Mailing List'), $name;
$language->gettext_sprintf('via %s Mailing List', $name);
} else { # default: NAME
undef $newComment;
}
......@@ -1587,7 +1594,7 @@ sub distribute_msg {
$newAddr = tools::addrencode(
(@anonFrom ? $anonFrom[0]->address : $anonaddr),
$userName, tools::lang2charset(Language::GetLang()),
$userName, tools::lang2charset($language->get_lang),
$newComment);
$hdr->add('X-Original-From',"$originalFromHeader");
......@@ -1695,7 +1702,7 @@ sub distribute_msg {
$subject_field = $before_tag . ' ' .
MIME::EncWords::encode_mimewords(
Encode::decode_utf8('[' . $parsed_tag . ']'),
Charset => tools::lang2charset(Language::GetLang()),
Charset => tools::lang2charset($language->get_lang),
Encoding => 'A',
Field => 'Subject'
) .
......@@ -1849,7 +1856,7 @@ sub send_msg_digest {
my $param = {'replyto' => $self->get_list_address('owner'),
'to' => $self->get_list_address(),
'table_of_content' => sprintf(gettext("Table of contents:")),
'table_of_content' => $language->gettext("Table of contents:"),
'boundary1' => '----------=_'.&tools::get_message_id($robot),
'boundary2' => '----------=_'.&tools::get_message_id($robot),
};
......@@ -1964,8 +1971,8 @@ sub send_msg_digest {
}
my @now = localtime(time);
$param->{'datetime'} = gettext_strftime("%a, %d %b %Y %H:%M:%S", @now);
$param->{'date'} = gettext_strftime("%a, %d %b %Y", @now);
$param->{'datetime'} = $language->gettext_strftime("%a, %d %b %Y %H:%M:%S", @now);
$param->{'date'} = $language->gettext_strftime("%a, %d %b %Y", @now);
## Split messages into groups of digest_max_size size
my @group_of_msg;
......@@ -2052,9 +2059,9 @@ sub send_global_file {
$data->{'user'} = Sympa::User::get_global_user($who) unless ($options->{'skip_db'});
$data->{'user'}{'email'} = $who unless (defined $data->{'user'});;
}
unless ($data->{'user'}{'lang'}) {
$data->{'user'}{'lang'} = $Language::default_lang;
}
## unless ($data->{'user'}{'lang'}) {
## $data->{'user'}{'lang'} = $Language::default_lang;
## }
unless ($data->{'user'}{'password'}) {
$data->{'user'}{'password'} = &tools::tmp_passwd($who);
......@@ -2160,12 +2167,12 @@ sub send_file {
$data->{'subscriber'} = $self->get_list_member($who);
if ($data->{'subscriber'}) {
$data->{'subscriber'}{'date'} = gettext_strftime("%d %b %Y", localtime($data->{'subscriber'}{'date'}));
$data->{'subscriber'}{'update_date'} = gettext_strftime("%d %b %Y", localtime($data->{'subscriber'}{'update_date'}));
$data->{'subscriber'}{'date'} = $language->gettext_strftime("%d %b %Y", localtime($data->{'subscriber'}{'date'}));
$data->{'subscriber'}{'update_date'} = $language->gettext_strftime("%d %b %Y", localtime($data->{'subscriber'}{'update_date'}));
if ($data->{'subscriber'}{'bounce'}) {
$data->{'subscriber'}{'bounce'} =~ /^(\d+)\s+(\d+)\s+(\d+)(\s+(.*))?$/;
$data->{'subscriber'}{'first_bounce'} = gettext_strftime("%d %b %Y", localtime $1);
$data->{'subscriber'}{'first_bounce'} = $language->gettext_strftime("%d %b %Y", localtime $1);
}
}
......@@ -5446,12 +5453,15 @@ sub _create_add_error_string {
my $self = shift;
$self->{'add_outcome'}{'errors'}{'error_message'} = '';
if ($self->{'add_outcome'}{'errors'}{'max_list_members_exceeded'}) {
$self->{'add_outcome'}{'errors'}{'error_message'} .= sprintf &gettext('Attempt to exceed the max number of members (%s) for this list.'), $self->{'admin'}{'max_list_members'} ;
$self->{'add_outcome'}{'errors'}{'error_message'} .=
$language->gettext_sprintf(
'Attempt to exceed the max number of members (%s) for this list.',
$self->{'admin'}{'max_list_members'});
}
if ($self->{'add_outcome'}{'errors'}{'unable_to_add_to_database'}) {
$self->{'add_outcome'}{'error_message'} .= ' '.&gettext('Attempts to add some users in database failed.');
$self->{'add_outcome'}{'error_message'} .= ' '. $language->gettext('Attempts to add some users in database failed.');
}
$self->{'add_outcome'}{'errors'}{'error_message'} .= ' '.sprintf &gettext('Added %s users out of %s required.'),$self->{'add_outcome'}{'added_members'},$self->{'add_outcome'}{'expected_number_of_added_users'};
$self->{'add_outcome'}{'errors'}{'error_message'} .= ' '. $language->gettext_sorintf('Added %s users out of %s required.'),$self->{'add_outcome'}{'added_members'},$self->{'add_outcome'}{'expected_number_of_added_users'});
}
## Adds a new list admin user, no overwrite.
......@@ -6107,12 +6117,12 @@ sub load_task_list {
my $titles = &List::_load_task_title ($file);
## Set the title in the current language
if (defined $titles->{&Language::GetLang()}) {
$list_of_task{$name}{'title'} = $titles->{&Language::GetLang()};
if (defined $titles->{$language->get_lang}) {
$list_of_task{$name}{'title'} = $titles->{$language->get_lang};
}elsif (defined $titles->{'gettext'}) {
$list_of_task{$name}{'title'} = gettext( $titles->{'gettext'});
$list_of_task{$name}{'title'} = $language->gettext( $titles->{'gettext'});
}elsif (defined $titles->{'us'}) {
$list_of_task{$name}{'title'} = gettext( $titles->{'us'});
$list_of_task{$name}{'title'} = $language->gettext( $titles->{'us'});
}else {
$list_of_task{$name}{'title'} = $name;
}
......@@ -9028,7 +9038,7 @@ sub load_topics {
}
## Set the title in the current language
my $lang = &Language::GetLang();
my $lang = $language->get_lang;
foreach my $top (keys %{$list_of_topics{$robot}}) {
my $topic = $list_of_topics{$robot}{$top};
$topic->{'current_title'} = $topic->{'title'}{$lang} || $topic->{'title'}{'default'} || $top;
......@@ -10187,10 +10197,10 @@ sub _urlize_part {
$parser->output_to_core(1);
my $new_part;
my $charset = tools::lang2charset(Language::GetLang());
my $charset = tools::lang2charset($language->get_lang);
my $tt2_include_path = tools::get_search_path(
$list, subdir => 'mail_tt2', lang => Language::GetLang());
$list, subdir => 'mail_tt2', lang => $language->get_lang);
&tt2::parse_tt2({'file_name' => $file_name,
'file_url' => $file_url,
......@@ -11032,7 +11042,7 @@ sub get_option_title {
}->{$type} || \%list_option;
my $t = $map->{$option} || {};
if ($t->{'gettext_id'}) {
my $ret = gettext($t->{'gettext_id'});
my $ret = $language->gettext($t->{'gettext_id'});
$ret =~ s/^\s+//;
$ret =~ s/\s+$//;
return sprintf '%s (%s)', $ret, $option if $withval;
......
......@@ -85,8 +85,12 @@
use MIME::Charset;
use HTML::TreeBuilder;
use HTML::FormatText;
use Language;
use Sympa::Language;
use Sympa::ListDef;
use tools;
my $language = Sympa::Language->instance;
sub plain_body_as_string {
......@@ -176,11 +180,14 @@
my $msgent = $topent->parts(0);
unless ($msgent) {
$outstring .= sprintf(gettext("----- Malformed message ignored -----\n\n"));
$outstring .=
$language->gettext("----- Malformed message ignored -----\n\n");
return undef;
}
my $from = $msgent->head->get('From') ? tools::decode_header($msgent, 'From') : gettext("[Unknown]");
my $from = $msgent->head->get('From')
? tools::decode_header($msgent, 'From')
: $language->gettext("[Unknown]");
my $subject = $msgent->head->get('Subject') ? tools::decode_header($msgent, 'Subject') : '';
my $date = $msgent->head->get('Date') ? tools::decode_header($msgent, 'Date') : '';
my $to = $msgent->head->get('To') ? tools::decode_header($msgent, 'To', ', ') : '';
......@@ -202,19 +209,22 @@
}
$name ||= $from;
$outstring .= gettext("\n[Attached message follows]\n-----Original message-----\n");
$outstring .= $language->gettext(
"\n[Attached message follows]\n-----Original message-----\n");
my $headers = '';
$headers .= sprintf(gettext("Date: %s\n") , $date) if $date;
$headers .= sprintf(gettext("From: %s\n"), $from) if $from;
$headers .= sprintf(gettext("To: %s\n"), $to) if $to;
$headers .= sprintf(gettext("Cc: %s\n"), $cc) if $cc;
$headers .= sprintf(gettext("Subject: %s\n"),$subject ) if $subject;
$headers .= $language->gettext_sprintf("Date: %s\n", $date) if $date;
$headers .= $language->gettext_sprintf("From: %s\n", $from) if $from;
$headers .= $language->gettext_sprintf("To: %s\n", $to) if $to;
$headers .= $language->gettext_sprintf("Cc: %s\n", $cc) if $cc;
$headers .= $language->gettext_sprintf("Subject: %s\n", $subject )
if $subject;
$headers .= "\n";
$outstring .= &tools::wrap_text($headers, '', ' ');
_do_toplevel ($msgent);
$outstring .= sprintf(gettext("-----End of original message from %s-----\n\n"), $name);
$outstring .= $language->gettext_sprintf(
"-----End of original message from %s-----\n\n", $name);
return 1;
}
......@@ -239,8 +249,10 @@
$thispart = $charset->encode($thispart);
};
if ($@) {
# mmm, what to do if it fails?
$outstring .= sprintf (gettext("** Warning: Message part using unrecognised character set %s\n Some characters may be lost or incorrect **\n\n"), $charset->as_string);
# mmm, what to do if it fails?
$outstring .= $language->gettext_sprintf(
"** Warning: Message part using unrecognised character set %s\n Some characters may be lost or incorrect **\n\n",
$charset->as_string);
$thispart =~ s/[^\x00-\x7F]/?/g;
}
......@@ -257,15 +269,19 @@
sub _do_other {
# just add a note that attachment was stripped.
my $entity = shift;
$outstring .= sprintf (gettext("\n[An attachment of type %s was included here]\n"), $entity->mime_type);
$outstring .= $language->gettext_sprintf(
"\n[An attachment of type %s was included here]\n",
$entity->mime_type);
return 1;
}
sub _do_dsn {
my $entity = shift;
$outstring .= sprintf (gettext("\n-----Delivery Status Report-----\n"));
$outstring .= $language->gettext("\n-----Delivery Status Report-----\n");
_do_text_plain ($entity);
$outstring .= sprintf (gettext("\n-----End of Delivery Status Report-----\n"));
$outstring .= $language->gettext("\n-----End of Delivery Status Report-----\n");
}
sub _do_text_html {
......@@ -273,9 +289,10 @@
my $entity = shift;
my $text;
my $have_mods = 1;
unless (defined $entity->bodyhandle) {
$outstring .= gettext("\n[** Unable to process HTML message part **]\n");
$outstring .= $language->gettext(
"\n[** Unable to process HTML message part **]\n");
return undef;
}
......@@ -292,8 +309,10 @@
if ($charset->decoder) {
$body = $charset->decode($body);
} else {
# mmm, what to do if it fails?
$outstring .= sprintf (gettext("** Warning: Message part using unrecognised character set %s\n Some characters may be lost or incorrect **\n\n"), $charset->as_string);
# mmm, what to do if it fails?
$outstring .= $language->gettext_sprintf(
"** Warning: Message part using unrecognised character set %s\n Some characters may be lost or incorrect **\n\n",
$charset->as_string);
$body =~ s/[^\x00-\x7F]/?/g;
}
my $tree = HTML::TreeBuilder->new->parse($body);
......@@ -304,11 +323,12 @@
$text = Encode::encode_utf8($text);
} ;
if ($@) {
$outstring .= gettext("\n[** Unable to process HTML message part **]\n");
$outstring .= $language->gettext(
"\n[** Unable to process HTML message part **]\n");
return 1;
}
$outstring .= sprintf(gettext ("[ Text converted from HTML ]\n"));
$outstring .= $language->gettext("[ Text converted from HTML ]\n");
# deal with 30 hyphens (RFC 1153)
$text =~ s/\n-{30}(\n|$)/\n -----------------------------\n/g;
......@@ -348,15 +368,22 @@
# This is a subclass of the HTML::FormatText object.
# This subclassing is done to allow internationalisation of some strings
@ISA = qw(HTML::FormatText);
use Language;
use strict;
use Sympa::Language;
sub img_start {
my($self,$node) = @_;
my $alt = Encode::encode_utf8($node->attr('alt'));
$self->out( Encode::decode_utf8(defined($alt) ? sprintf(gettext("[ Image%s ]"), ":" . $alt) : sprintf(gettext("[Image%s]"),"")));
$self->out(
Encode::decode_utf8(defined($alt)
? $language->gettext_sprintf("[ Image%s ]", ":" . $alt)
: $language->gettext_sprintf("[Image%s]"), "")
);
}
1;
......@@ -31,6 +31,7 @@ use Net::Netmask;
use Data::Dumper;
#use tools; # temporarily disabled to avoid dependency loop.
use Sympa::Language;
use List;
use Log;
use Conf;
......@@ -175,7 +176,7 @@ sub _parse_scenario {
next;
}elsif ($current_rule =~ /^\s*title\.(\S+)\s+(.*)\s*$/i) {
my ($lang, $title) = ($1, $2);
my $locale = Language::Lang2Locale($lang) || $lang;
my $locale = Sympa::Language::lang2oldlocale($lang) || $lang;
$structure->{'title'}{$locale} = $title;
next;
} elsif ($current_rule =~ /^\s*title\s+(.*)\s*$/i) {
......@@ -1461,11 +1462,13 @@ sub dump_all_scenarios {
sub get_current_title {
my $self = shift;
my $locale = Language::Lang2Locale(Language::GetLang());
my $language = Sympa::Language->instance;
my $locale = Sympa::Language::lang2oldlocale($language->get_lang);
if (defined $self->{'title'}{$locale}) {
return $self->{'title'}{$locale};
} elsif (defined $self->{'title'}{'gettext'}) {
return Language::gettext($self->{'title'}{'gettext'});
return $language->gettext($self->{'title'}{'gettext'});
} elsif (defined $self->{'title'}{'default'}) {
return $self->{'title'}{'default'};
} else {
......
......@@ -28,6 +28,7 @@ use strict;
use warnings;
use Carp qw(carp croak);
use Sympa::Language;
use Log;
use SDM;
use tools;
......@@ -82,7 +83,7 @@ sub new {
# ## Canonicalize lang if possible
# $values{'lang'} =
# Language::CanonicLang($values{'lang'}) || $values{'lang'}
# Sympa::Language::canonic_lang($values{'lang'}) || $values{'lang'}