translate what we get from the schema and keytab files. For this make messages

creates a schemas.C file with the text out of them, so i18n() returns something
useful

svn path=/trunk/kdebase/konsole/; revision=39742
wilder-portage
Stephan Kulow 27 years ago
parent a6bd875923
commit a9ab69d32b
  1. 25
      src/Makefile.am
  2. 15
      src/keytrans.C
  3. 9
      src/schema.C

@ -18,14 +18,14 @@ OTHDIR = $(TOPDIR)/other
# set the include path for X, qt and KDE
INCLUDES = -I$(INCDIR) $(all_includes)
# you can add here more. This one gets installed
bin_PROGRAMS = konsole konsole_grantpty kwrited #kcmkonsole
# you can add here more. This one gets installed
bin_PROGRAMS = konsole konsole_grantpty kwrited #kcmkonsole
noinst_LIBRARIES = libkonsole.a
libkonsole_a_SOURCES = TEWidget.C TEmuVt102.C TEScreen.C TEmulation.C TEPty.C TEHistory.C keytrans.C
# libkonsole_a_LDFLAGS = -version-info `expr $(VERSION) + $(SUBVERS)`:$(RELEASE):$(SUBVERS)
# Which sources should be compiled for konsole.
kwrited_SOURCES = kwrited.C
@ -37,7 +37,7 @@ konsole_LDADD = libkonsole.a $(LIB_KIMGIO) $(LIB_KDEUI) $(LIBUTEMPTER)
konsole_LDFLAGS = $(all_libraries) $(KDE_RPATH)
# kcmkonsole_SOURCES = kcmkonsole.C schema.C
# kcmkonsole_LDADD = $(LIB_KIMGIO) $(LIB_KDEUI)
# kcmkonsole_LDADD = $(LIB_KIMGIO) $(LIB_KDEUI)
# kcmkonsole_LDFLAGS = $(all_libraries) $(KDE_RPATH)
konsole_grantpty_SOURCES = konsole_grantpty.c
@ -51,15 +51,24 @@ install-data-local:
# konsole_grantpty needs to be installed setuid root
install-exec-local: install-binPROGRAMS
@(chown root $(bindir)/konsole_grantpty && chmod 4755 $(bindir)/konsole_grantpty) || echo "Please make konsole_grandpty setuid root"
@(chown root $(bindir)/konsole_grantpty && chmod 4755 $(bindir)/konsole_grantpty) || echo "Please make konsole_grandpty setuid root"
# just to make sure, automake makes them
# just to make sure, automake makes them
METASOURCES = TEWidget.moc TEmuVt102.moc session.moc main.moc \
TEmulation.moc TEPty.moc kwrited.moc \
krootpixmap.moc
krootpixmap.moc
META_INCLUDES = $(srcdir)/../include
messages:
$(XGETTEXT) -C -ktranslate -kI18N_NOOP -ki18n -x $(includedir)/kde.pot $(konsole_SOURCES) && mv messages.po $(podir)/konsole.pot
rm -f schemas.C
for i in ../other/*.schema; do \
grep "^title" $$i | cut -d':' -f2- | sed -e 's#^title \(.*\)$$#i18n(\"\1\")#' >> schemas.C ;\
done
for i in ../other/*.Keytab ../other/*.keytab; do \
grep "^keyboard" $$i | sed -e 's#^keyboard \"\(.*\)\"$$#i18n(\"\1\")#' >> schemas.C ;\
done
$(XGETTEXT) -C -kI18N_NOOP -ki18n -x $(includedir)/kde.pot $(konsole_SOURCES) schemas.C -o $(podir)/konsole.pot
rm -f schemas.C

@ -31,6 +31,7 @@
#include <qfile.h>
#include <kglobal.h>
#include <kstddirs.h>
#include <klocale.h>
#include <stdio.h>
@ -152,10 +153,10 @@ static bool getSymbol(QIODevice &buf)
cc = buf.getch();
return TRUE; // eol
}
if (inRange('A',cc,'Z')||inRange('a',cc,'z')||inRange('0',cc,'9'))
if (inRange('A',cc,'Z')||inRange('a',cc,'z')||inRange('0',cc,'9'))
{
sym = SYMName;
while (inRange('A',cc,'Z') || inRange('a',cc,'z') || inRange('0',cc,'9'))
while (inRange('A',cc,'Z') || inRange('a',cc,'z') || inRange('0',cc,'9'))
{
res = res + (char)cc;
cc = buf.getch();
@ -280,9 +281,9 @@ Loop:
// syntax: ["key" KeyName { ("+" | "-") ModeName } ":" String/CommandName] ["#" Comment]
if (sym == SYMName && !strcmp(res.ascii(),"keyboard"))
{
getSymbol(buf);
getSymbol(buf);
if (sym != SYMString) goto ERROR; // header expected
kt->hdr = res;
kt->hdr = i18n(res);
getSymbol(buf);
if (sym != SYMEol) goto ERROR; // unexpected text
getSymbol(buf); // eoln
@ -291,13 +292,13 @@ Loop:
if (sym == SYMName && !strcmp(res.ascii(),"key"))
{
//printf("line %3d: ",startofsym);
getSymbol(buf);
getSymbol(buf);
// keyname
if (sym != SYMName) goto ERROR; // mode name expected
if (!syms.keysyms[res]) goto ERROR; // unknown key
int key = (int)syms.keysyms[res]-1;
//printf(" key %s (%04x)",res.ascii(),(int)keysyms[res]-1);
getSymbol(buf); // + - :
getSymbol(buf); // + - :
int mode = 0;
int mask = 0;
while (sym == SYMOpr && (!strcmp(res.ascii(),"+") || !strcmp(res.ascii(),"-")))
@ -599,7 +600,7 @@ void KeyTrans::loadAll()
{
defaultKeyTrans()->addKeyTrans();
QStringList lst = KGlobal::dirs()->findAllResources("appdata", "*.keytab");
for(QStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) {
KeyTrans* sc = KeyTrans::fromFile(*it);
if (sc) sc->addKeyTrans();

@ -15,6 +15,7 @@
#include <qdir.h>
#include <kstddirs.h>
#include <kglobal.h>
#include <klocale.h>
#define HERE printf("%s(%d): here\n",__FILE__,__LINE__)
@ -53,7 +54,7 @@ ColorSchema* ColorSchema::readSchema(const char* path)
{
if (!strncmp(line,"title",5))
{
res->title = line+6;
res->title = i18n(line+6);
}
if (!strncmp(line,"image",5))
{ char rend[100], path[100]; int attr = 1;
@ -158,8 +159,8 @@ static const ColorEntry default_table[TABLE_COLORS] =
ColorEntry( QColor(0x18,0xB2,0xB2), 0, 0 ), ColorEntry( QColor(0xB2,0xB2,0xB2), 0, 0 ), // Cyan, White
// intensive
ColorEntry( QColor(0x00,0x00,0x00), 0, 1 ), ColorEntry( QColor(0xFF,0xFF,0xFF), 1, 0 ),
ColorEntry( QColor(0x68,0x68,0x68), 0, 0 ), ColorEntry( QColor(0xFF,0x54,0x54), 0, 0 ),
ColorEntry( QColor(0x54,0xFF,0x54), 0, 0 ), ColorEntry( QColor(0xFF,0xFF,0x54), 0, 0 ),
ColorEntry( QColor(0x68,0x68,0x68), 0, 0 ), ColorEntry( QColor(0xFF,0x54,0x54), 0, 0 ),
ColorEntry( QColor(0x54,0xFF,0x54), 0, 0 ), ColorEntry( QColor(0xFF,0xFF,0x54), 0, 0 ),
ColorEntry( QColor(0x54,0x54,0xFF), 0, 0 ), ColorEntry( QColor(0xFF,0x54,0xFF), 0, 0 ),
ColorEntry( QColor(0x54,0xFF,0xFF), 0, 0 ), ColorEntry( QColor(0xFF,0xFF,0xFF), 0, 0 )
};
@ -185,7 +186,7 @@ void ColorSchema::loadAllSchemas()
defaultSchema()->addSchema();
schema_serial = 1;
QStringList lst = KGlobal::dirs()->findAllResources("appdata", "*.schema");
for(QStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) {
ColorSchema* sc = ColorSchema::readSchema(*it);
if (sc) sc->addSchema();

Loading…
Cancel
Save