Commit af446458 authored by Sven Langkamp's avatar Sven Langkamp

added i18n support for resouces. Thanks to David Faure and Nicolas Goutte.

svn path=/trunk/koffice/; revision=413815
parent f44df1b9
......@@ -45,6 +45,8 @@ dummy.cc:
messages: rc.cpp
$(EXTRACTRC) `find . -name \*.ui` >> rc.cpp
$(EXTRACTRC) `find . -name \*.rc` >> rc.cpp
$(XGETTEXT) rc.cpp `find . -name \*.cc -o -name \*.h` core/kis_aboutdata.h -o $(podir)/krita.pot
perl extracti18n.pl > i18ndata
$(XGETTEXT) i18ndata rc.cpp `find . -name \*.cc -o -name \*.h` core/kis_aboutdata.h -o $(podir)/krita.pot
rm -f i18ndata
kde_services_DATA = kritapart.desktop
......@@ -37,6 +37,7 @@
#include <qvaluevector.h>
#include <kdebug.h>
#include <klocale.h>
#include "kis_global.h"
#include "kis_brush.h"
......@@ -365,7 +366,7 @@ void KisBrush::ioResult(KIO::Job * /*job*/)
name = QString::fromAscii(&m_data[sizeof(GimpBrushHeader)], bh.header_size - sizeof(GimpBrushHeader));
}
setName(name);
setName(i18n(name.ascii()));
if (bh.width == 0 || bh.height == 0 || !m_img.create(bh.width, bh.height, 32)) {
emit ioFailed(this);
......
......@@ -31,6 +31,7 @@
#include <koColor.h>
#include <kdebug.h>
#include <klocale.h>
#include "kis_gradient.h"
......@@ -106,7 +107,7 @@ void KisGradient::ioResult(KIO::Job * /*job*/)
if (nameDefinition.startsWith("Name: ")) {
QString nameText = nameDefinition.right(nameDefinition.length() - 6);
setName(nameText);
setName(i18n(nameText.ascii()));
numSegmentsText = fileContent.readLine();
}
......
......@@ -33,6 +33,7 @@
#include <qvaluevector.h>
#include <kdebug.h>
#include <klocale.h>
#include "kis_global.h"
#include "kis_imagepipe_brush.h"
......@@ -166,7 +167,7 @@ void KisImagePipeBrush::ioResult(KIO::Job * /*job*/)
line1.append(m_data[i]);
i++;
}
setName(QString::fromUtf8(&line1[0], i));
setName(i18n(QString::fromUtf8(&line1[0], i).ascii()));
i++; // Skip past the first newline
......
......@@ -34,6 +34,7 @@
#include <qvaluevector.h>
#include <kdebug.h>
#include <klocale.h>
#include "kis_global.h"
#include "kis_palette.h"
......@@ -185,7 +186,7 @@ void KisPalette::ioResult(KIO::Job * /*job*/)
return;
}
setName(lines[1].mid(strlen("Name: ")).stripWhiteSpace());
setName(i18n(lines[1].mid(strlen("Name: ")).stripWhiteSpace().ascii()));
index = 2;
......
......@@ -33,6 +33,7 @@
#include <qmap.h>
#include <kdebug.h>
#include <klocale.h>
#include "kis_pattern.h"
#include "kis_layer.h"
......@@ -119,7 +120,7 @@ void KisPattern::ioResult(KIO::Job * /*job*/)
return;
}
setName(&name[0]);
setName(i18n(&name[0]));
if (bh.width == 0 || bh.height == 0 || !m_img.create(bh.width, bh.height, 32)) {
emit ioFailed(this);
......
#!/usr/bin/perl -w
# This file is part of Krita
#
# Copyright (c) 2005 Sven Langkamp <longamp@reallygood.de>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) 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 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.
use strict;
use warnings;
sub printi18n {
print "i18n(\"".$_[0]."\");\n";
}
my @filenames = glob("./data/gradients/*.ggr");
push( @filenames, glob("./data/palettes/*.gpl"));
push( @filenames, glob("./data/brushes/*.gih"));
push( @filenames, glob("./data/brushes/*.gbr"));
push( @filenames, glob("./data/patterns/*.pat"));
foreach my $filename (@filenames)
{
unless ( open(FILE, '<'.$filename) )
{
next;
}
if( $filename =~ /ggr/ || $filename =~ /gpl/ || $filename =~ /gih/ )
{
my @lines = <FILE>;
close(FILE);
if( $filename =~ /ggr/ || $filename =~ /gpl/ )
{
my @splited = split(/: /, $lines[1]);
my $name = $splited[1];
chomp($name);
printi18n $name;
}
else
{
my $name = $lines[0];
chomp($name);
printi18n $name;
}
}
else
{
if( $filename =~ /gbr/ )
{
read(FILE, my $bytes, 4);
my $size = unpack("N", $bytes);
read(FILE, $bytes, 4);
my $version = unpack("N", $bytes);
if( $version == 1 )
{
read(FILE, $bytes, 12);
read(FILE, my $name, $size - 21);
printi18n $name;
}
else
{
read(FILE, $bytes, 20);
read(FILE, my $name, $size - 29);
printi18n $name;
}
}
else
{
read(FILE, my $bytes, 4);
my $size = unpack("N", $bytes);
read(FILE, $bytes, 20);
read(FILE, my $name, $size - 25);
printi18n $name;
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment