diff options
Diffstat (limited to 'lib/CatDap')
-rw-r--r-- | lib/CatDap/Controller/register.pm | 31 | ||||
-rw-r--r-- | lib/CatDap/I18N/.tx/config | 8 | ||||
-rwxr-xr-x[-rw-r--r--] | lib/CatDap/I18N/ro.po | 0 |
3 files changed, 5 insertions, 34 deletions
diff --git a/lib/CatDap/Controller/register.pm b/lib/CatDap/Controller/register.pm index 889aabe..c53881d 100644 --- a/lib/CatDap/Controller/register.pm +++ b/lib/CatDap/Controller/register.pm @@ -25,7 +25,8 @@ Catalyst Controller. sub index :Path :Args(0) : Form { my ( $self, $c ) = @_; - my $lang = choose_language($c); + my $langs = join ',',@{$c->languages}; + $c->log->debug("Languages: $langs, default: " . $c->language . ", saving: " . ${$c->languages}[0]); #my $form = Catalyst::Controller::HTML::FormFu->form(); #$c->response->body('Matched CatDap::Controller::register in register.'); @@ -113,8 +114,8 @@ sub check : Local { my $ug = Data::UUID->new; my $password = $ug->create_str(); my $cn = $c->request->params->{gn} . " " . $c->request->params->{sn}; - my $lang = choose_language($c); $c->log->info("Creating account for user $username"); + $c->log->debug("Preferred language: " . ${$c->languages}[0]); $mesg = $c->model('Proxy')->add($dn, attr => [ objectclass => [ 'inetOrgPerson' ], @@ -124,7 +125,7 @@ sub check : Local { mail => $email, pwdReset => 'TRUE', userPassword => $password, - preferredLanguage => $lang, + preferredLanguage => ${$c->languages}[0], ] ); if ($mesg->code) { @@ -162,29 +163,7 @@ sub captcha : Local { return $c->create_captcha(); } -sub choose_language : Private { - my $c = shift; - my $langs = join ',',@{$c->languages}; - # FIXME heuristic for correcting languages, we may want a different strategy - # in future in conjunction with server-side constraints with slapo-constraint. - # E.g. we could have a languages container with mapping from browser locale - # codes (preferredLanguage, which is multi-valued), to a single value - # (e.g. mageiaselectedLanguage, or similar). Then use a uri-based constraint on - # with mageiaSelectedLanguage as the attribute - # Also to be considered, pushing all the languages to preferredLanguage, but - # then do we use ordering? - my $lang = ${$c->languages}[0]; - if ($lang !~ /^\w\w\w?(-\w+)?$/) { - $lang = 'en'; - } - # Partial list of lang-variant locales where localisation is different - if ($lang !~ /^(en-gb|en-us|pt-br|no-\w+|zh-\w+)$/) { - $lang =~ s/^(\w+)-\w+$/$1/; - } - $c->log->debug("Browser languages: $langs,using preferred language: $lang"); - $c->log->debug("Selected language $lang not default " . $c->language) if $lang ne $c->language; - return $lang; -} + =head1 AUTHOR diff --git a/lib/CatDap/I18N/.tx/config b/lib/CatDap/I18N/.tx/config deleted file mode 100644 index 73fe3eb..0000000 --- a/lib/CatDap/I18N/.tx/config +++ /dev/null @@ -1,8 +0,0 @@ -[main] -host = https://www.transifex.com - -[mageia.identity-catdap] -file_filter = <lang>.po -source_file = messages.pot -source_lang = en -type = PO diff --git a/lib/CatDap/I18N/ro.po b/lib/CatDap/I18N/ro.po index 460abc8..460abc8 100644..100755 --- a/lib/CatDap/I18N/ro.po +++ b/lib/CatDap/I18N/ro.po |