Translated the Keyboard project
This commit is contained in:
parent
31f1dc7fea
commit
7506cee30d
8
Makefile
8
Makefile
|
@ -1,6 +1,6 @@
|
|||
PACKAGE = Keyboard
|
||||
VERSION = 0.2.0
|
||||
SUBDIRS = data include src tools
|
||||
SUBDIRS = data include po src tools
|
||||
RM ?= rm -f
|
||||
LN ?= ln -f
|
||||
TAR ?= tar -czvf
|
||||
|
@ -27,6 +27,11 @@ dist:
|
|||
$(PACKAGE)-$(VERSION)/include/Keyboard.h \
|
||||
$(PACKAGE)-$(VERSION)/include/Makefile \
|
||||
$(PACKAGE)-$(VERSION)/include/project.conf \
|
||||
$(PACKAGE)-$(VERSION)/po/Makefile \
|
||||
$(PACKAGE)-$(VERSION)/po/gettext.sh \
|
||||
$(PACKAGE)-$(VERSION)/po/POTFILES \
|
||||
$(PACKAGE)-$(VERSION)/po/fr.po \
|
||||
$(PACKAGE)-$(VERSION)/po/project.conf \
|
||||
$(PACKAGE)-$(VERSION)/src/callbacks.c \
|
||||
$(PACKAGE)-$(VERSION)/src/common.c \
|
||||
$(PACKAGE)-$(VERSION)/src/key.c \
|
||||
|
@ -49,6 +54,7 @@ dist:
|
|||
$(PACKAGE)-$(VERSION)/COPYING \
|
||||
$(PACKAGE)-$(VERSION)/Makefile \
|
||||
$(PACKAGE)-$(VERSION)/config.h \
|
||||
$(PACKAGE)-$(VERSION)/config.sh \
|
||||
$(PACKAGE)-$(VERSION)/project.conf
|
||||
$(RM) -- $(PACKAGE)-$(VERSION)
|
||||
|
||||
|
|
5
config.sh
Normal file
5
config.sh
Normal file
|
@ -0,0 +1,5 @@
|
|||
PACKAGE="Keyboard"
|
||||
VERSION="0.2.0"
|
||||
|
||||
PREFIX="/usr/local"
|
||||
LIBDIR="${PREFIX}/lib"
|
2
po/.cvsignore
Normal file
2
po/.cvsignore
Normal file
|
@ -0,0 +1,2 @@
|
|||
Keyboard.pot
|
||||
fr.mo
|
30
po/Makefile
Normal file
30
po/Makefile
Normal file
|
@ -0,0 +1,30 @@
|
|||
TARGETS = Keyboard.pot fr.mo
|
||||
PREFIX = /usr/local
|
||||
DESTDIR =
|
||||
RM ?= rm -f
|
||||
LN ?= ln -f
|
||||
MKDIR ?= mkdir -p
|
||||
INSTALL ?= install
|
||||
|
||||
|
||||
all: $(TARGETS)
|
||||
|
||||
Keyboard.pot: POTFILES
|
||||
./gettext.sh -P "$(PREFIX)" -- "Keyboard.pot"
|
||||
|
||||
fr.mo: Keyboard.pot fr.po
|
||||
./gettext.sh -P "$(PREFIX)" -- "fr.mo"
|
||||
|
||||
clean:
|
||||
$(RM) -- $(Keyboard.pot_OBJS) $(fr.mo_OBJS)
|
||||
|
||||
distclean: clean
|
||||
$(RM) -- $(TARGETS)
|
||||
|
||||
install: $(TARGETS)
|
||||
./gettext.sh -P "$(DESTDIR)$(PREFIX)" -i -- "fr.mo"
|
||||
|
||||
uninstall:
|
||||
./gettext.sh -P "$(DESTDIR)$(PREFIX)" -u -- "fr.mo"
|
||||
|
||||
.PHONY: all clean distclean install uninstall
|
2
po/POTFILES
Normal file
2
po/POTFILES
Normal file
|
@ -0,0 +1,2 @@
|
|||
../src/keyboard.c
|
||||
../src/main.c
|
45
po/fr.po
Normal file
45
po/fr.po
Normal file
|
@ -0,0 +1,45 @@
|
|||
# $Id$
|
||||
# Copyright (c) 2012 Pierre Pronchery <khorben@defora.org>
|
||||
# This file is distributed under the same license as the Keyboard package.
|
||||
# Pierre Pronchery <khorben@defora.org>, 2012.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Keyboard 0.2.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2012-05-20 14:38+0200\n"
|
||||
"PO-Revision-Date: 2012-05-20 14:32+0200\n"
|
||||
"Last-Translator: Pierre Pronchery <khorben@defora.org>\n"
|
||||
"Language-Team: French\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
|
||||
|
||||
#: ../src/keyboard.c:97
|
||||
msgid "_Close"
|
||||
msgstr "_Fermer"
|
||||
|
||||
#: ../src/keyboard.c:105 ../src/keyboard.c:107
|
||||
msgid "_About"
|
||||
msgstr "À propos"
|
||||
|
||||
#: ../src/keyboard.c:114
|
||||
msgid "_File"
|
||||
msgstr "_Fichier"
|
||||
|
||||
#: ../src/keyboard.c:115
|
||||
msgid "_Help"
|
||||
msgstr "_Aide"
|
||||
|
||||
#: ../src/keyboard.c:488
|
||||
msgid "Keyboard"
|
||||
msgstr "Clavier"
|
||||
|
||||
#: ../src/keyboard.c:592
|
||||
msgid "Virtual keyboard for the DeforaOS desktop"
|
||||
msgstr "Clavier virtuel pour l'environnement DeforaOS"
|
||||
|
||||
#: ../src/main.c:46
|
||||
msgid "Usage: keyboard [-d|-p|-w|-x][-f font][-m monitor]\n"
|
||||
msgstr "Usage: keyboard [-d|-p|-w|-x][-f police][-m moniteur]\n"
|
160
po/gettext.sh
Executable file
160
po/gettext.sh
Executable file
|
@ -0,0 +1,160 @@
|
|||
#!/bin/sh
|
||||
#$Id$
|
||||
#Copyright (c) 2011 Pierre Pronchery <khorben@defora.org>
|
||||
#
|
||||
#Redistribution and use in source and binary forms, with or without
|
||||
#modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice, this
|
||||
# list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions and the following disclaimer in the documentation
|
||||
# and/or other materials provided with the distribution.
|
||||
#
|
||||
#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
#AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
#IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
#DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
#FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
#DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
#SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
#CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
#OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
#OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
|
||||
#variables
|
||||
PREFIX="/usr/local"
|
||||
. "../config.sh"
|
||||
DEBUG="_debug"
|
||||
INSTALL="install -m 0644"
|
||||
LOCALEDIR="$PREFIX/share/locale"
|
||||
MKDIR="mkdir -p"
|
||||
MSGFMT="msgfmt"
|
||||
MSGINIT="msginit"
|
||||
MSGMERGE="msgmerge"
|
||||
RM="rm -f"
|
||||
POTFILES="POTFILES"
|
||||
XGETTEXT="xgettext --force-po"
|
||||
|
||||
|
||||
#functions
|
||||
#debug
|
||||
_debug()
|
||||
{
|
||||
echo $@
|
||||
$@
|
||||
}
|
||||
|
||||
|
||||
#usage
|
||||
_usage()
|
||||
{
|
||||
echo "Usage: gettext.sh [-i|-u][-P prefix] <target>" 1>&2
|
||||
return 1
|
||||
}
|
||||
|
||||
|
||||
#gettext_mo
|
||||
_gettext_mo()
|
||||
{
|
||||
package="$1"
|
||||
lang="$2"
|
||||
|
||||
_gettext_po "$package" "$lang" || return 1
|
||||
$DEBUG $MSGFMT -c -v -o "$lang.mo" "$lang.po" || return 1
|
||||
}
|
||||
|
||||
|
||||
#gettext_po
|
||||
_gettext_po()
|
||||
{
|
||||
package="$1"
|
||||
lang="$2"
|
||||
|
||||
if [ -f "$lang.po" ]; then
|
||||
$DEBUG $MSGMERGE -U "$lang.po" "$package.pot" || return 1
|
||||
else
|
||||
$DEBUG $MSGINIT -l "$lang" -o "$lang.po" -i "$package.pot" \
|
||||
|| return 1
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
#gettext_pot
|
||||
_gettext_pot()
|
||||
{
|
||||
package="$1"
|
||||
|
||||
$DEBUG $XGETTEXT -d "$package" -o "$package.pot" --keyword="_" \
|
||||
--keyword="N_" -f "$POTFILES" || return 1
|
||||
}
|
||||
|
||||
|
||||
#main
|
||||
install=0
|
||||
uninstall=0
|
||||
while getopts iuP: name; do
|
||||
case "$name" in
|
||||
i)
|
||||
uninstall=0
|
||||
install=1
|
||||
;;
|
||||
u)
|
||||
install=0
|
||||
uninstall=1
|
||||
;;
|
||||
P)
|
||||
PREFIX="$2"
|
||||
;;
|
||||
?)
|
||||
_usage
|
||||
exit $?
|
||||
;;
|
||||
esac
|
||||
done
|
||||
shift $(($OPTIND - 1))
|
||||
if [ $# -eq 0 ]; then
|
||||
_usage
|
||||
exit $?
|
||||
fi
|
||||
|
||||
LOCALEDIR="$PREFIX/share/locale"
|
||||
while [ $# -gt 0 ]; do
|
||||
target="$1"
|
||||
lang="${target%%.mo}"
|
||||
lang="${lang%%.po}"
|
||||
shift
|
||||
|
||||
#uninstall
|
||||
if [ "$uninstall" -eq 1 ]; then
|
||||
$DEBUG $RM "$LOCALEDIR/$lang/LC_MESSAGES/$PACKAGE.mo" \
|
||||
|| exit 2
|
||||
continue
|
||||
fi
|
||||
|
||||
#create
|
||||
case "$target" in
|
||||
*.mo)
|
||||
_gettext_mo "$PACKAGE" "$lang" || exit 2
|
||||
;;
|
||||
*.po)
|
||||
_gettext_po "$PACKAGE" "$lang" || exit 2
|
||||
;;
|
||||
*.pot)
|
||||
_gettext_pot "${target%%.pot}" || exit 2
|
||||
;;
|
||||
*)
|
||||
exit 2
|
||||
;;
|
||||
esac
|
||||
|
||||
#install
|
||||
if [ "$install" -eq 1 ]; then
|
||||
$DEBUG $MKDIR "$LOCALEDIR/$lang/LC_MESSAGES" || exit 2
|
||||
$DEBUG $INSTALL "$target" \
|
||||
"$LOCALEDIR/$lang/LC_MESSAGES/$PACKAGE.mo" \
|
||||
|| exit 2
|
||||
fi
|
||||
done
|
13
po/project.conf
Normal file
13
po/project.conf
Normal file
|
@ -0,0 +1,13 @@
|
|||
targets=Keyboard.pot,fr.mo
|
||||
dist=Makefile,gettext.sh,POTFILES,fr.po
|
||||
|
||||
[Keyboard.pot]
|
||||
type=script
|
||||
script=./gettext.sh
|
||||
depends=POTFILES
|
||||
|
||||
[fr.mo]
|
||||
type=script
|
||||
script=./gettext.sh
|
||||
install=
|
||||
depends=Keyboard.pot,fr.po
|
|
@ -1,6 +1,6 @@
|
|||
package=Keyboard
|
||||
version=0.2.0
|
||||
|
||||
subdirs=data,include,src,tools
|
||||
config=h
|
||||
dist=COPYING,Makefile,config.h
|
||||
subdirs=data,include,po,src,tools
|
||||
config=h,sh
|
||||
dist=COPYING,Makefile,config.h,config.sh
|
||||
|
|
|
@ -23,6 +23,7 @@ static char const _license[] =
|
|||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <libintl.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <gdk/gdkkeysyms.h>
|
||||
#include <Desktop.h>
|
||||
|
@ -34,6 +35,8 @@ static char const _license[] =
|
|||
#include "layout.h"
|
||||
#include "keyboard.h"
|
||||
#include "../config.h"
|
||||
#define _(string) gettext(string)
|
||||
#define N_(string) (string)
|
||||
|
||||
|
||||
/* Keyboard */
|
||||
|
@ -91,7 +94,7 @@ static char const * _authors[] =
|
|||
|
||||
static const DesktopMenu _keyboard_menu_file[] =
|
||||
{
|
||||
{ "_Close", G_CALLBACK(on_file_close), GTK_STOCK_CLOSE,
|
||||
{ N_("_Close"), G_CALLBACK(on_file_close), GTK_STOCK_CLOSE,
|
||||
GDK_CONTROL_MASK, GDK_KEY_W },
|
||||
{ NULL, NULL, NULL, 0, 0 }
|
||||
};
|
||||
|
@ -99,17 +102,17 @@ static const DesktopMenu _keyboard_menu_file[] =
|
|||
static const DesktopMenu _keyboard_menu_help[] =
|
||||
{
|
||||
#if GTK_CHECK_VERSION(2, 6, 0)
|
||||
{ "_About", G_CALLBACK(on_help_about), GTK_STOCK_ABOUT, 0, 0 },
|
||||
{ N_("_About"), G_CALLBACK(on_help_about), GTK_STOCK_ABOUT, 0, 0 },
|
||||
#else
|
||||
{ "_About", G_CALLBACK(on_help_about), NULL, 0, 0 },
|
||||
{ N_("_About"), G_CALLBACK(on_help_about), NULL, 0, 0 },
|
||||
#endif
|
||||
{ NULL, NULL, NULL, 0, 0 }
|
||||
};
|
||||
|
||||
static const DesktopMenubar _keyboard_menubar[] =
|
||||
{
|
||||
{ "_File", _keyboard_menu_file },
|
||||
{ "_Help", _keyboard_menu_help },
|
||||
{ N_("_File"), _keyboard_menu_file },
|
||||
{ N_("_Help"), _keyboard_menu_help },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
|
@ -482,7 +485,7 @@ static void _new_mode_windowed(Keyboard * keyboard)
|
|||
gtk_window_set_icon_name(GTK_WINDOW(keyboard->window),
|
||||
"input-keyboard");
|
||||
#endif
|
||||
gtk_window_set_title(GTK_WINDOW(keyboard->window), "Keyboard");
|
||||
gtk_window_set_title(GTK_WINDOW(keyboard->window), _("Keyboard"));
|
||||
g_signal_connect_swapped(G_OBJECT(keyboard->window), "delete-event",
|
||||
G_CALLBACK(on_keyboard_delete_event), keyboard);
|
||||
}
|
||||
|
@ -586,7 +589,7 @@ void keyboard_show_about(Keyboard * keyboard)
|
|||
GTK_WINDOW(keyboard->window));
|
||||
desktop_about_dialog_set_authors(keyboard->ab_window, _authors);
|
||||
desktop_about_dialog_set_comments(keyboard->ab_window,
|
||||
"Virtual keyboard for the DeforaOS desktop");
|
||||
_("Virtual keyboard for the DeforaOS desktop"));
|
||||
desktop_about_dialog_set_copyright(keyboard->ab_window, _copyright);
|
||||
desktop_about_dialog_set_logo_icon_name(keyboard->ab_window,
|
||||
"input-keyboard");
|
||||
|
|
24
src/main.c
24
src/main.c
|
@ -1,5 +1,5 @@
|
|||
/* $Id$ */
|
||||
/* Copyright (c) 2010 Pierre Pronchery <khorben@defora.org> */
|
||||
/* Copyright (c) 2010-2012 Pierre Pronchery <khorben@defora.org> */
|
||||
/* This file is part of DeforaOS Desktop Keyboard */
|
||||
/* 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
|
||||
|
@ -19,8 +19,24 @@
|
|||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <locale.h>
|
||||
#include <libintl.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include "keyboard.h"
|
||||
#include "../config.h"
|
||||
#define _(string) gettext(string)
|
||||
|
||||
|
||||
/* constants */
|
||||
#ifndef PREFIX
|
||||
# define PREFIX "/usr/local"
|
||||
#endif
|
||||
#ifndef DATADIR
|
||||
# define DATADIR PREFIX "/share"
|
||||
#endif
|
||||
#ifndef LOCALEDIR
|
||||
# define LOCALEDIR DATADIR "/locale"
|
||||
#endif
|
||||
|
||||
|
||||
/* private */
|
||||
|
@ -28,7 +44,8 @@
|
|||
/* usage */
|
||||
static int _usage(void)
|
||||
{
|
||||
fputs("Usage: keyboard [-d|-p|-w|-x][-f font][-m monitor]\n", stderr);
|
||||
fputs(_("Usage: keyboard [-d|-p|-w|-x][-f font][-m monitor]\n"),
|
||||
stderr);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -43,6 +60,9 @@ int main(int argc, char * argv[])
|
|||
KeyboardPrefs prefs;
|
||||
char * p;
|
||||
|
||||
setlocale(LC_ALL, "");
|
||||
bindtextdomain(PACKAGE, LOCALEDIR);
|
||||
textdomain(PACKAGE);
|
||||
memset(&prefs, 0, sizeof(prefs));
|
||||
gtk_init(&argc, &argv);
|
||||
while((o = getopt(argc, argv, "df:m:pwx")) != -1)
|
||||
|
|
Loading…
Reference in New Issue
Block a user