Add localization resources.
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,4 +1,6 @@
|
||||
build/
|
||||
.kdev4/
|
||||
POD7.kdev4
|
||||
Resources/Lokalize/main.lqa
|
||||
Resources/Lokalize/fr/POD7.mo
|
||||
|
||||
|
||||
19
Resources/Lokalize/0_getstrings.sh
Executable file
19
Resources/Lokalize/0_getstrings.sh
Executable file
@@ -0,0 +1,19 @@
|
||||
#!/bin/bash
|
||||
if [ ! -x 0_getstrings.sh ]
|
||||
then
|
||||
echo "Wrong working directory. Please cd to the directory containing this script."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
APPNAME=POD7
|
||||
SRC=../../
|
||||
DOMAIN=fr
|
||||
DEST=$DOMAIN/$APPNAME.po
|
||||
[ ! -d $DOMAIN ] && mkdir $DOMAIN
|
||||
[ -f $DEST ] && JOIN="-j"
|
||||
[ -f $DEST ] && cp $DEST $DEST.bak-$(date +%F-%T)
|
||||
|
||||
xgettext --keyword=_ -d $DOMAIN $JOIN -o $DEST --c++ --from-code=UTF-8 $(find $SRC -maxdepth 1 -type f -name "*.cpp")
|
||||
#xgettext --keyword=_ -d $DOMAIN -j -o $DEST --c++ --from-code=UTF-8 $(find $SRC -maxdepth 1 -type f -name "*.h")
|
||||
|
||||
exit 0
|
||||
16
Resources/Lokalize/2_makemo.sh
Executable file
16
Resources/Lokalize/2_makemo.sh
Executable file
@@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
if [ ! -x 2_makemo.sh ]
|
||||
then
|
||||
echo "Wrong working directory. Please cd to the directory containing this script."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
APPNAME=POD7
|
||||
DOMAIN=fr
|
||||
|
||||
msgfmt $DOMAIN/$APPNAME.po -o $DOMAIN/$APPNAME.mo
|
||||
|
||||
# cp $DOMAIN/$APPNAME.mo /usr/local/share/locale/$DOMAIN/LC_MESSAGES/
|
||||
|
||||
exit 0
|
||||
|
||||
55
Resources/Lokalize/fr/POD7.po
Normal file
55
Resources/Lokalize/fr/POD7.po
Normal file
@@ -0,0 +1,55 @@
|
||||
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
||||
# This file is distributed under the same license as the PACKAGE package.
|
||||
#
|
||||
# Saleem EDAH-TALLY <set@nmset.info>, 2022.
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2022-10-16 16:17+0200\n"
|
||||
"PO-Revision-Date: 2022-10-16 16:22+0200\n"
|
||||
"Last-Translator: Saleem EDAH-TALLY <set@nmset.info>\n"
|
||||
"Language-Team: French <>\n"
|
||||
"Language: fr_FR\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"
|
||||
"X-Generator: Lokalize 22.08.2\n"
|
||||
|
||||
#: ../../main.cpp:49 ../../main.cpp:157
|
||||
msgid "Can't initialize HID library."
|
||||
msgstr "Ne peut initialiser la bibliothèque HID."
|
||||
|
||||
#: ../../main.cpp:57
|
||||
msgid "No hidraw devices found."
|
||||
msgstr "Aucun périphérique hidraw détecté."
|
||||
|
||||
#: ../../main.cpp:94
|
||||
msgid "Print help messages."
|
||||
msgstr "Afficher l'aide."
|
||||
|
||||
#: ../../main.cpp:102
|
||||
msgid "hidraw pedal device file (/dev/<file>)."
|
||||
msgstr "Périphérique hidraw détecté (/dev/<file>)."
|
||||
|
||||
#: ../../main.cpp:104
|
||||
msgid "Show some messages on stdout, namely, signaled pedal codes."
|
||||
msgstr ""
|
||||
"Affichage plus verbeux, en particulier, des codes emis par les pédales."
|
||||
|
||||
#: ../../main.cpp:129 ../../main.cpp:135
|
||||
msgid "Error : "
|
||||
msgstr "Erreur : "
|
||||
|
||||
#: ../../main.cpp:163
|
||||
msgid "Can't open "
|
||||
msgstr "Ne peur ouvrir "
|
||||
|
||||
#: ../../main.cpp:201
|
||||
msgid "Application exit."
|
||||
msgstr "Fin d'application."
|
||||
|
||||
#: ../../main.cpp:103
|
||||
msgid "List hidraw devices."
|
||||
msgstr "Énumérer les périphériques hidraw."
|
||||
5
Resources/Lokalize/index.lokalize
Normal file
5
Resources/Lokalize/index.lokalize
Normal file
@@ -0,0 +1,5 @@
|
||||
[General]
|
||||
LangCode=fr_FR
|
||||
MailingList=
|
||||
ProjectID=POD7-Lokalize
|
||||
TargetLangCode=fr_FR
|
||||
@@ -9,6 +9,14 @@
|
||||
#ifndef GLOBALS_H
|
||||
#define GLOBALS_H
|
||||
|
||||
#include <libintl.h>
|
||||
#include <string>
|
||||
using namespace std;
|
||||
|
||||
//https://www.labri.fr/perso/fleury/posts/programming/a-quick-gettext-tutorial.html
|
||||
#define _(STRING) gettext(STRING)
|
||||
|
||||
|
||||
#define _APPNAME_ "POD7" // Pedal events Over DBus
|
||||
#define _APP_DESCRIPTION_ "Send pedal events over DBus"
|
||||
#define _VERSION_ "2"
|
||||
|
||||
28
main.cpp
28
main.cpp
@@ -32,7 +32,7 @@ DBus::BusDispatcher g_dispatcher;
|
||||
void signalhandler(int sn)
|
||||
{
|
||||
if (g_verbose)
|
||||
cout << "Application signaled to exit." << endl;
|
||||
cout << "_(Application signaled to exit.)" << endl;
|
||||
hid_close(g_device);
|
||||
hid_exit();
|
||||
exit(0);
|
||||
@@ -46,7 +46,7 @@ bool ListDevices()
|
||||
{
|
||||
if (hid_init() != 0)
|
||||
{
|
||||
cout << "Can't initialize HID library." << endl;
|
||||
cout << _("Can't initialize HID library.") << endl;
|
||||
return false;
|
||||
}
|
||||
hid_device_info * devices;
|
||||
@@ -54,7 +54,7 @@ bool ListDevices()
|
||||
if (devices == NULL)
|
||||
{
|
||||
if (g_verbose)
|
||||
cout << "No HIDRaw devices found." << endl;
|
||||
cout << _("No hidraw devices found.") << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -91,7 +91,7 @@ bool ManageParams(int argc, char** argv)
|
||||
{
|
||||
po::options_description desc(_ABOUT_);
|
||||
desc.add_options()
|
||||
("help,h", "Print help messages.")
|
||||
("help,h", _("Print help messages."))
|
||||
/*
|
||||
* Use an udev rule to identify the hidraw device :
|
||||
* Ex :
|
||||
@@ -99,9 +99,9 @@ bool ManageParams(int argc, char** argv)
|
||||
* KERNEL=="hidraw[0-9]*", SYMLINK+="hidraw-vec", ATTRS{idVendor}=="05f3", ATTRS{idProduct}=="00ff", MODE="0660", GROUP="transcript"
|
||||
* Using /dev/hidraw-vec better control better control.
|
||||
*/
|
||||
("device,d", po::value<string>(&g_deviceFile), "HIDRaw pedal device file (/dev/<file>).")
|
||||
("list,l", "List HIDRaw devices.")
|
||||
("verbose,v", "Show some messages on stdout, namely, signaled pedal codes.");
|
||||
("device,d", po::value<string>(&g_deviceFile), _("hidraw pedal device file (/dev/<file>)."))
|
||||
("list,l", _("List hidraw devices."))
|
||||
("verbose,v", _("Show some messages on stdout, namely, signaled pedal codes."));
|
||||
|
||||
po::variables_map vm;
|
||||
po::variables_map vmc;
|
||||
@@ -126,13 +126,13 @@ bool ManageParams(int argc, char** argv)
|
||||
}
|
||||
catch (po::error& eb)
|
||||
{
|
||||
cerr << "Error : " << eb.what() << endl;
|
||||
cerr << _("Error : ") << eb.what() << endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (exception& e)
|
||||
{
|
||||
cerr << "Error : " << e.what() << endl;
|
||||
cerr << _("Error : ") << e.what() << endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -144,19 +144,23 @@ bool ManageParams(int argc, char** argv)
|
||||
*/
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (_APPNAME_, "/usr/local/share/locale"); // containing fr/LC_MESSAGES/
|
||||
textdomain (_APPNAME_);
|
||||
|
||||
if (!ManageParams(argc, argv))
|
||||
return 0;
|
||||
signal(SIGINT, signalhandler);
|
||||
signal(SIGTERM, signalhandler);
|
||||
if (hid_init() != 0)
|
||||
{
|
||||
cout << "Can't initialize HID library." << endl;
|
||||
cout << _("Can't initialize HID library.") << endl;
|
||||
return 0;
|
||||
}
|
||||
g_device = hid_open_path(g_deviceFile.c_str());
|
||||
if (!g_device)
|
||||
{
|
||||
cout << "Can't open " << g_device << _DOT_ << endl;
|
||||
cout << _("Can't open ") << g_device << _DOT_ << endl;
|
||||
hid_exit();
|
||||
return 0;
|
||||
}
|
||||
@@ -194,7 +198,7 @@ int main(int argc, char** argv)
|
||||
}
|
||||
|
||||
if (g_verbose)
|
||||
cout << "Application exit." << endl;
|
||||
cout << _("Application exit.") << endl;
|
||||
hid_close(g_device);
|
||||
hid_exit();
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user