Changeset 1549


Ignore:
Timestamp:
12/28/15 17:45:18 (8 years ago)
Author:
nanardon
Message:

Fix I18N

Location:
trunk
Files:
2 added
1 deleted
9 edited
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/LATMOS-Accounts-Web/lib/LATMOS/Accounts/Web/I18N/fr.po

    r1546 r1549  
     1# SOME DESCRIPTIVE TITLE. 
     2# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER 
     3# This file is distributed under the same license as the PACKAGE package. 
     4# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. 
     5# 
     6#, fuzzy 
     7msgid "" 
     8msgstr "" 
     9"Project-Id-Version: 1\n" 
     10"POT-Creation-Date: YEAR-MO-DA HO:MI+ZONE\n" 
     11"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 
     12"Last-Translator: Olivier Thauvin <olivier.thauvin@latmos.ipsl.fr\n" 
     13"Language-Team: LANGUAGE <LL@li.org>\n" 
     14"Language: \n" 
     15"MIME-Version: 1.0\n" 
     16"Content-Type: text/plain; charset=UTF-8\n" 
     17"Content-Transfer-Encoding: 8bit\n" 
     18 
    119#: root/html/includes/wrapper.tt:47 
    220msgid "IT management" 
  • trunk/LATMOS-Accounts-Web/lib/LATMOS/Accounts/Web/Model/AttrForms.pm

    r1530 r1549  
    323323    if ($label) { 
    324324        return $label; 
    325     } elsif (my $hash = LATMOS::Accounts::Web->config->{attrs}{$attr}) { 
    326         return $hash->{label}; 
    327325    } else { 
    328        return $attr; 
     326        my $oattr = $self->base->attribute($self->otype, $attr);  
     327        return $oattr->{label} ? $oattr->{label}->() : $attr; 
    329328    }  
    330329} 
  • trunk/LATMOS-Accounts-Web/lib/LATMOS/Accounts/Web/Model/AttrFormsA.pm

    r1530 r1549  
    8989        ($hint ? sprintf('title="%s"', $self->escape($hint)) : ''), 
    9090        $self->escape($self->htmlname), 
    91         $self->escape($self->hconfig('label') || $self->htmlname), 
     91        $self->escape($self->{label} || $self->htmlname), 
    9292    ); 
    9393} 
  • trunk/LATMOS-Accounts/MANIFEST

    r1547 r1549  
    104104lib/LATMOS/Accounts/Cli.pm 
    105105lib/LATMOS/Accounts/I18N.pm 
    106 lib/LATMOS/Accounts/I18N/fr.po 
    107 lib/LATMOS/Accounts/I18N/messages.pot 
    108106lib/LATMOS/Accounts/Log.pm 
    109107lib/LATMOS/Accounts/Mail.pm 
     
    145143man/man8/latmos-accounts.pod 
    146144patchset/no_useless_load.patch 
     145po/fr.po 
     146po/messages.pot 
    147147sample/allowed_values.ini 
    148148sample/la-allowed-values.ini 
  • trunk/LATMOS-Accounts/Makefile.PL

    r1546 r1549  
    9898sub postamble { 
    9999 
    100     my @po = map { m:lib/LATMOS/Accounts/I18N/([^\.]+)\.po$:; $1 } 
    101             glob('lib/LATMOS/Accounts/I18N/*.po'); 
    102  
    103     my $makepo = join("\n\n", map { 
    104         " 
    105 lib/LATMOS/Accounts/I18N/$_.po: lib/LATMOS/Accounts/I18N/messages.pot 
    106 \t[ -f lib/LATMOS/Accounts/I18N/$_.po ] || msginit --no-translator --input=lib/LATMOS/Accounts/I18N/messages.pot --output= --locale=$_ 
    107 \tmsgmerge -U lib/LATMOS/Accounts/I18N/$_.po lib/LATMOS/Accounts/I18N/messages.pot 
    108  
    109         " 
    110         } @po 
    111     ); 
    112  
    113     $makepo .= "\n\npo: " . join(' ', map { "lib/LATMOS/Accounts/I18N/$_.po" } @po) . "\n"; 
     100    my $makepo = ''; 
     101    my @po; 
     102 
     103    foreach (glob('po/*.po')) { 
     104        my ($po) = $_ =~  m:([^/\.]+)\.po$:; 
     105        push (@po, $po); 
     106 
     107        $makepo .= 
     108 
     109" 
     110po/$po.po: po/messages.pot 
     111\t[ -f po/$po.po ] || msginit --no-translator --input=po/messages.pot --output= --locale=$_ 
     112\tmsgmerge -U po/$po.po po/messages.pot 
     113 
     114po/$po/LC_MESSAGES/linkaccounts.mo: po/$po.po 
     115\tinstall -d po/$po/LC_MESSAGES 
     116\tmsgfmt -o \$@ \$< 
     117\n" 
     118    } 
     119 
     120    $makepo .= "\n\npo: " . join(' ', map { "po/$_.po" } @po) . "\n"; 
     121    $makepo .= "\n\nmo: " . join(' ', map { "po/$_/LC_MESSAGES/linkaccounts.mo" } @po) . "\n"; 
    114122 
    115123    <<EOF; 
    116 #.PHONY .= svnmanifest 
    117  
    118 pot: lib/LATMOS/Accounts/I18N/messages.pot 
    119  
    120 lib/LATMOS/Accounts/I18N/messages.pot: 
    121 \tcat MANIFEST | egrep '^(lib|bin)' | xargs xgettext.pl -o lib/LATMOS/Accounts/I18N/messages.pot 
     124.PHONY: po/messages.pot 
     125 
     126pot: po/messages.pot 
     127 
     128po/messages.pot: 
     129\tcat MANIFEST | egrep '^(lib|bin)' | xargs xgettext.pl -o po/messages.pot 
    122130 
    123131$makepo 
     
    182190    my $section = $self->SUPER::install(); 
    183191 
    184     $section =~ s/(^install ::.*)/$1 install_config install_templates install_data install_po/m; 
     192    $section =~ s/(^install ::.*)/$1 install_config install_templates install_data install_mo/m; 
    185193    $section =~ s/\$\(INST_BIN\) \$\(DESTINSTALL(\w*)BIN\)/$& \$(INST_MAN5DIR) \$(DESTINSTALLMAN5DIR) \$(INST_MAN8DIR) \$(DESTINSTALLMAN8DIR)/g; 
    186194 
     
    204212            $(DESTDIR)$(DATADIR) 
    205213 
    206 install_po :: 
    207         install -d $(DESTDIR)$(LOCALEDIR)/LATMOS::Accounts 
    208         $(ABSPERLRUN) -MExtUtils::Install -e 'install({ "lib/LATMOS/Accounts/I18N" => @ARGV })' \\ 
    209         $(DESTDIR)$(LOCALEDIR)/LATMOS::Accounts 
     214install_mo: mo 
     215        install -d $(DESTDIR)$(LOCALEDIR) 
     216        for i in po/*/LC_MESSAGES/linkaccounts.mo; do \\ 
     217                install -d po/$$i $(DESTDIR)$(LOCALEDIR)/$$i; \\ 
     218        done 
    210219]; 
    211220   
  • trunk/LATMOS-Accounts/bin/la-query

    r1546 r1549  
    116116my $LA = LATMOS::Accounts->new($config, noacl => 1); 
    117117my $labase = $LA->base($base); 
    118 $labase && $labase->load or die N("Cannot load base %s\n", $base); 
     118$labase && $labase->load or die l("Cannot load base %s\n", $base); 
    119119 
    120120$labase->unexported($nounexp ? 0 : 1); 
  • trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases.pm

    r1546 r1549  
    384384    my ($self, $otype, $id, %data) = @_; 
    385385    "$id" or do { 
    386         $self->log(LA_ERR, _("Cannot create %s object with empty id"), 
     386        $self->log(LA_ERR, l("Cannot create %s object with empty id"), 
    387387            $otype); 
    388388        return; 
  • trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql/User.pm

    r1526 r1549  
    1313use DateTime::TimeZone; 
    1414use base qw(LATMOS::Accounts::Bases::Sql::objects); 
     15use LATMOS::Accounts::I18N; 
    1516 
    1617our $VERSION = (q$Rev$ =~ /^Rev: (\d+) /)[0]; 
     
    194195                formopts => { rawvalue => 1, }, 
    195196                monitored => 1, 
     197                label => sub { l('Locked') }, 
    196198            }, 
    197199            expire        => { 
     
    493495            }, 
    494496            manager => { 
     497                label => l('Manager'), 
    495498                reference => 'user', 
    496499                ro => 1, 
  • trunk/LATMOS-Accounts/lib/LATMOS/Accounts/I18N.pm

    r1548 r1549  
    1919 
    2020@ISA = qw(Exporter); 
    21 @EXPORT = qw(N); 
    22 @EXPORT_OK = qw(N); 
     21@EXPORT = 'l'; 
     22@EXPORT_OK = 'l'; 
    2323 
    2424my $init; 
    2525 
    2626if (!$init) { 
    27     POSIX::setlocale(POSIX::LC_ALL(), ""); 
    28     Locale::gettext::bind_textdomain_codeset('LATMOS::Accounts', 'UTF-8'); 
     27    #POSIX::setlocale(POSIX::LC_ALL(), ""); 
     28    if (-d 'po') { 
     29        Locale::gettext::bindtextdomain('linkaccounts', 'po') 
     30    } 
     31    Locale::gettext::bind_textdomain_codeset('linkaccounts', 'UTF-8'); 
    2932    $init = 1; 
    3033} 
     
    3235=head1 FUNCTIONS 
    3336 
    34 =head2 N($text, @args) 
     37=head2 l($text, @args) 
    3538 
    3639Return the translate messsage, using printf. 
     
    3841=cut 
    3942 
     43sub l {  
     44    my ($text, @args) = @_; 
     45    my $trans = Locale::gettext::dgettext('linkaccounts', $text || ''); 
    4046 
    41 sub N {  
    42     my ($text, @args) = @_; 
    43     my $trans = Locale::gettext::dgettext('LATMOS::Accounts', $text || ''); 
    4447    return sprintf($trans || $text, @args); 
    4548} 
  • trunk/LATMOS-Accounts/po/messages.pot

    r1548 r1549  
    77msgid "" 
    88msgstr "" 
    9 "Project-Id-Version: PACKAGE VERSION\n" 
    10 "POT-Creation-Date: YEAR-MO-DA HO:MI+ZONE\n" 
     9"Project-Id-Version: 1\n" 
     10"POT-Creation-Date: 2015-12-28 17:00+01\n" 
    1111"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 
    12 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" 
     12"Last-Translator: Olivier Thauvin <olivier.thauvin@latmos.ipsl.fr\n" 
    1313"Language-Team: LANGUAGE <LL@li.org>\n" 
    1414"MIME-Version: 1.0\n" 
    15 "Content-Type: text/plain; charset=CHARSET\n" 
     15"Content-Type: text/plain; charset=UTF-8\n" 
    1616"Content-Transfer-Encoding: 8bit\n" 
    1717 
     
    1919msgid "Cannot create %s object with empty id" 
    2020msgstr "" 
     21 
     22#. ($base) 
     23#: bin/la-query:117 
     24msgid "Cannot load base %s\n" 
     25msgstr "" 
     26 
     27#: lib/LATMOS/Accounts/Bases/Sql/User.pm:197 
     28msgid "Locked" 
     29msgstr "" 
     30 
     31#: lib/LATMOS/Accounts/Bases/Sql/User.pm:497 
     32msgid "Manager" 
     33msgstr "" 
Note: See TracChangeset for help on using the changeset viewer.