Re: Changed 3 Simplify Chinese language files

Udo Bretz <[email protected]> Wed, 16 Mar 2011 11:53:09 +0100
Newsgroups gmane.comp.otrs.internationalization
Message-ID <[email protected]>
Hi Martin(s) :-),

yes, of course. But it is a little complicated, I've been through this 
before...

Here is how it works:

You need to have a fresh OTRS 3.0 system and link it with the attached 
link,pl script to just one module at a time(!!!) the one which you want 
to translate. This would not work wel if you used the installed 
packages, because you would then have the ITSM basic module (General 
Catalog and ITSMCore) also in your system.

And then, you can use the script otrs.CreateTranslationFile from your 
OTRS bin folder:

Translating Extension Modules
=============================

   Make sure that you have a clean system with a current configuration. 
The module
   that needs to be translated has to be installed or linked into the 
system, but
   only this one!

     otrs.CreateTranslationFile -l <Language> -m <module_directory>


If you want to translate another module after that, the first linked 
module one has to be removed with the remove_links.pl script.

Best regards,
Udo



On 16.03.2011 09:27, Martin Gruner wrote:
> Udo,
>
> can we not use the translation file update script to add the missing
> entries to the ITSM translation files? IMO that would be much better
> than the manual process you described.
>
> Regards, mg
>
> Am 14.03.11 18:54, schrieb Udo Bretz:
>> Hi Martin,
>>
>> thanks for your contribution! It would be cool if you could take the
>> german translation files in each ITSM module (de_....) as a template
>> for the translation. There have a been added some more translations
>> recently, so it is really up to date.
>>
>> Thanks in advance,
>> Udo
>>
>>
>>
>> On 08.03.2011 17:15, Martin Liu wrote:
>>> Hi List,
>>>
>>> This is the fist time to translate for otrs.
>>> I modify some old translatation words and add a new word for ITSM
>>> module.
>>>
>>> Attached please find files.
>>>
>>> I hope I could see this update to otrs.org<http://otrs.org>  soon.
>>>
>>> --
>>> Regards,
>>>
>>> 刘征 Martin Liu
>>> ----------------------------------
>>> Blog: http://martinliu.cn
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> OTRS mailing list: i18n - Webpage: http://otrs.org/
>>> Archive: http://lists.otrs.org/pipermail/i18n
>>> To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/i18n
>>
>> ---------------------------------------------------------------------
>> OTRS mailing list: i18n - Webpage: http://otrs.org/
>> Archive: http://lists.otrs.org/pipermail/i18n
>> To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/i18n
>

---------------------------------------------------------------------
OTRS mailing list: i18n - Webpage: http://otrs.org/
Archive: http://lists.otrs.org/pipermail/i18n
To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/i18n
link.pl (text/x-perl-script, 4.4 KB)
#!/usr/bin/perl -w
# --
# module-tools/link.pl
#   - script for linking OTRS modules into framework root
# Copyright (C) 2001-2009 OTRS AG, http://otrs.org/
# --
# $Id: link.pl,v 1.14 2009/07/09 10:52:30 bes Exp $
# --
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU AFFERO General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
# or see http://www.gnu.org/licenses/agpl.txt.
# --

=head1 NAME

link.pl - script for linking OTRS modules into framework root

=head1 SYNOPSIS

link.pl -h

link.pl <source-module-folder> <otrs-folder>

=head1 DESCRIPTION

This script installs a given OTRS module into the OTRS framework by creating
appropriate links.
Beware that code from the .sopm file is not executed.

Existing files are backupped by adding the extension '.old'.
So this script can be used for an already installed module, when linking
files from CVS checkout directory.

Please send any questions, suggestions & complaints to <[email protected]>

=head1 TODO

When running the scripts twice, the '.old' files might be overwritten.

=cut

use strict;
use warnings;

use Getopt::Long;
use Pod::Usage;
use File::Spec    ();

# get options
my ($OptHelp);
GetOptions( 'h'   => \$OptHelp ) || pod2usage( -verbose => 1, message => 'invalid params' );

if ( $OptHelp ) {
    pod2usage( -verbose => 2 );   # this will exit the script
}

# Now get the work done

my $Source = shift || die "Need Application CVS location as ARG0";
$Source = File::Spec->rel2abs( $Source );
if (! -d $Source) {
    die "ERROR: invalid Application CVS directory '$Source'";
}

my $Dest = shift || die "Need Framework-Root location as ARG1";
$Dest = File::Spec->rel2abs( $Dest );
if (! -d $Dest) {
    die "ERROR: invalid Framework-Root directory '$Dest'";
}

my @Dirs;
my $Start = $Source;
R($Start);

sub R {
    my $In = shift;
    my @List = glob("$In/*");
    foreach my $File (@List) {
        $File =~ s/\/\//\//g;
        # recurse into subdirectories
        if (-d $File) {
            # skip CVS directories
            if ($File !~ /\/CVS$/) {
                R($File);
            }
        }
        else {
            my $OrigFile = $File;
            $File =~ s/$Start//;
            # check directory of location (in case create a directory)
            if ("$Dest/$File" =~ /^(.*)\/(.+?|)$/)
            {
                my $Directory = $1;
                my @Directories = split(/\//, $Directory);
                my $DirectoryCurrent = '';
                foreach my $Directory (@Directories) {
                    $DirectoryCurrent .= "/$Directory";
                    if ($DirectoryCurrent && ! -d $DirectoryCurrent) {
                        if (mkdir $DirectoryCurrent) {
                            print STDERR "NOTICE: Create Directory $DirectoryCurrent\n";
                        }
                        else {
                            die "ERROR: can't create directory $DirectoryCurrent: $!";
                        }
                    }
                }
            }
            if (-l "$Dest/$File") {
                unlink ("$Dest/$File") || die "ERROR: Can't unlink symlink: $Dest/$File";
            }
            if (-e "$Dest/$File") {
                if (rename("$Dest/$File", "$Dest/$File.old")) {
                    print "NOTICE: Backup orig file: $Dest/$File.old\n";
                }
                else {
                    die "ERROR: Can't rename $Dest/$File to $Dest/$File.old: $!";
                }
            }
            if (!-e $Dest) {
                die "ERROR: No such directory: $Dest";
            }
            elsif (!-e $OrigFile) {
                die "ERROR: No such orig file: $OrigFile";
            }
            elsif (!symlink ($OrigFile, "$Dest/$File")) {
                die "ERROR: Can't $File link: $!";
            }
            else {
                print "NOTICE: Link: $OrigFile -> \n";
                print "NOTICE:       $Dest/$File\n";
            }
        }
    }
}
remove_links.pl (text/x-perl-script, 1.2 KB)
#!/usr/bin/perl -w

# $Id: remove_links.pl,v 1.2 2010/06/17 13:43:19 reb Exp $

use strict;

my $Dest = shift || die "Need Application-Root location as ARG1";
if ( !-d $Dest ) {
    die "ERROR: invalid Application-Root directory '$Dest'";
}

if ( !( -e $Dest . '/Kernel' && -e $Dest . '/Kernel/System' ) ) {
    print <<"WARNING";
Can't find $Dest/Kernel and $Dest/Kernel/System, so I assume it's not a
root directory of an OTRS instance. Remove links anyway? [y/N]
WARNING

    chomp( my $Answer = <STDIN> );

    if ( $Answer !~ m{ ^ y $ }xi ) {
        exit;
    }
}

my @Dirs  = ();
my $Start = $Dest;
R($Start);

sub R {
    my $In   = shift;
    my @List = glob("$In/*");
    foreach my $File (@List) {
        $File =~ s/\/\//\//g;
        if ( -d $File ) {
            R($File);

            #            $File =~ s/$Start//;
            #            print "Directory: $File\n";
        }
        else {
            my $OrigFile = $File;
            $File =~ s/$Start//;

            #            print "File: $File\n";
            #            my $Dir =~ s/^(.*)\//$1/;
            if ( -l $OrigFile ) {
                print "Unlink Symlink: $File\n";
                unlink $OrigFile || die $!;
            }
        }
    }
}