mirror of https://github.com/nirenjan/libx52.git
Add internationalization support for x52test
This change updates x52test to use the gettext APIs. This also adds a fake message catalogue to verify that the code is converted correctly and the translations are displayed. The fake message catalogue translates the English strings into Pig Latin, which makes it easy enough for a maintainer to verify that the changes have been made correctly. Finally, this also adds some documentation to tell the maintainer or translator how to make the relevant changes.debian-packaging
parent
db8629a6a9
commit
97743d4ebd
|
@ -7,6 +7,9 @@ The format is based upon [Keep a Changelog].
|
|||
## [Unreleased]
|
||||
### Added
|
||||
- USB Hotplug support to libx52 and libusbx52
|
||||
- Internationalization for the following:
|
||||
* libx52
|
||||
* x52test
|
||||
|
||||
### Changed
|
||||
- x52test moves the LED tests to execute after all other tests. See
|
||||
|
|
11
Makefile.am
11
Makefile.am
|
@ -13,7 +13,16 @@ endif
|
|||
SUBDIRS = $(po_SUBDIRS) lib utils tests
|
||||
|
||||
# Extra files that need to be in the distribution
|
||||
EXTRA_DIST = config.rpath ABOUT-NLS gettext.h AUTHORS ChangeLog.md README.md LICENSE Doxyfile.in
|
||||
EXTRA_DIST = \
|
||||
ABOUT-NLS \
|
||||
AUTHORS \
|
||||
ChangeLog.md \
|
||||
Doxyfile.in \
|
||||
LICENSE \
|
||||
README.md \
|
||||
config.rpath \
|
||||
gettext.h \
|
||||
po/README.md
|
||||
|
||||
# Doxygen support
|
||||
if HAVE_DOXYGEN
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
xx_PL
|
|
@ -1,2 +1,8 @@
|
|||
# List of source files which contain translatable strings.
|
||||
lib/libx52/x52_strerror.c
|
||||
|
||||
utils/test/x52_test.c
|
||||
utils/test/x52_test_clock.c
|
||||
utils/test/x52_test_common.h
|
||||
utils/test/x52_test_led.c
|
||||
utils/test/x52_test_mfd.c
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
Notes for translators
|
||||
=====================
|
||||
|
||||
x52pro-linux is slowly being migrated to use the GNU gettext library to support
|
||||
internationalization (i18n). Contributions are welcome to both update the
|
||||
existing code to use `gettext`, and to add new translations.
|
||||
|
||||
# xx_PL
|
||||
|
||||
xx_PL is a translation of English strings into [Pig
|
||||
Latin](https://en.wikipedia.org/wiki/Pig_Latin) that is used in lieu of any real
|
||||
translations. This file is used to test that the translation functionality is
|
||||
working as expected.
|
||||
|
||||
# Adding new code to i18n (maintainers)
|
||||
|
||||
Most code should be using the `_("...")` format to refer to a translatable
|
||||
string. Some strings can be left untranslated, but these are mostly just
|
||||
whitespace, such as line breaks.
|
||||
|
||||
Once you add new strings to be translated, update `po/POTFILES.in` to include
|
||||
any new files that have to be translated. The file path is relative to the root
|
||||
of the project.
|
||||
|
||||
The next step is to rebuild the translation template `x52pro-linux.pot`. To do
|
||||
this, run `make -C po update-po` from your build directory (where you ran
|
||||
`configure`). This also updates any translation files (with `.po` extension) to
|
||||
include the new source strings.
|
||||
|
||||
# Adding new languages (translators)
|
||||
|
||||
Run `msginit -l <language-code> x52pro-linux.pot` to generate a new `.po` file
|
||||
for that language. Language code is a 2 letter
|
||||
[ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) code with an
|
||||
optional [ISO-3166-1](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) region
|
||||
suffix. Edit this file to add your translation, and add the new language to
|
||||
`po/LINGUAS`.
|
||||
|
||||
`po/LINGUAS` must be in alphabetical order.
|
||||
|
||||
# Testing the i18n functionality
|
||||
|
||||
TODO
|
||||
|
|
@ -8,7 +8,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: x52pro-linux 0.2.1\n"
|
||||
"Report-Msgid-Bugs-To: https://github.com/nirenjan/x52pro-linux/issues\n"
|
||||
"POT-Creation-Date: 2020-05-19 08:00-0700\n"
|
||||
"POT-Creation-Date: 2020-05-20 03:17-0700\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
|
@ -89,3 +89,235 @@ msgstr ""
|
|||
#, c-format
|
||||
msgid "Unknown error %d"
|
||||
msgstr ""
|
||||
|
||||
#: utils/test/x52_test.c:87
|
||||
msgid "Test brightness scale (~ 1m)"
|
||||
msgstr ""
|
||||
|
||||
#: utils/test/x52_test.c:88
|
||||
msgid "Test MFD string display (~ 30s)"
|
||||
msgstr ""
|
||||
|
||||
#: utils/test/x52_test.c:89
|
||||
msgid "Test MFD displays all characters (~ 2m 15s)"
|
||||
msgstr ""
|
||||
|
||||
#: utils/test/x52_test.c:90
|
||||
msgid "Test the blink and shift commands (< 10s)"
|
||||
msgstr ""
|
||||
|
||||
#: utils/test/x52_test.c:91
|
||||
msgid "Test the clock commands (~1m)"
|
||||
msgstr ""
|
||||
|
||||
#: utils/test/x52_test.c:92
|
||||
msgid "Test LED states (~ 45s)"
|
||||
msgstr ""
|
||||
|
||||
#: utils/test/x52_test.c:116
|
||||
msgid ""
|
||||
"x52test is a suite of tests to write to the X52 Pro device\n"
|
||||
"and test the extra functionality available in the LEDs and MFD\n"
|
||||
msgstr ""
|
||||
|
||||
#: utils/test/x52_test.c:120
|
||||
msgid "These tests take roughly 6 minutes to run"
|
||||
msgstr ""
|
||||
|
||||
#: utils/test/x52_test.c:122
|
||||
msgid "Press Enter to begin the tests, press Ctrl-C to abort anytime"
|
||||
msgstr ""
|
||||
|
||||
#: utils/test/x52_test.c:128
|
||||
#, c-format
|
||||
msgid "Unable to initialize X52 library: %s\n"
|
||||
msgstr ""
|
||||
|
||||
#: utils/test/x52_test.c:143
|
||||
msgid "All tests completed successfully"
|
||||
msgstr ""
|
||||
|
||||
#: utils/test/x52_test.c:145
|
||||
#, c-format
|
||||
msgid "Got error %s\n"
|
||||
msgstr ""
|
||||
|
||||
#: utils/test/x52_test.c:147
|
||||
#, c-format
|
||||
msgid "Received %s signal, quitting...\n"
|
||||
msgstr ""
|
||||
|
||||
#: utils/test/x52_test.c:166
|
||||
msgid ""
|
||||
"These are the available tests with a description and\n"
|
||||
"approximate runtime. Not specifying any tests will run\n"
|
||||
"all the tests\n"
|
||||
msgstr ""
|
||||
|
||||
#: utils/test/x52_test.c:170
|
||||
msgid "List of tests:"
|
||||
msgstr ""
|
||||
|
||||
#: utils/test/x52_test.c:220
|
||||
#, c-format
|
||||
msgid ""
|
||||
"Usage: %s [list of tests]\n"
|
||||
"\n"
|
||||
msgstr ""
|
||||
|
||||
#: utils/test/x52_test.c:234
|
||||
#, c-format
|
||||
msgid ""
|
||||
"Unrecognized test identifier: %s\n"
|
||||
"\n"
|
||||
msgstr ""
|
||||
|
||||
#: utils/test/x52_test.c:247
|
||||
msgid "Not running any tests"
|
||||
msgstr ""
|
||||
|
||||
#: utils/test/x52_test_clock.c:30
|
||||
msgid "Clock"
|
||||
msgstr ""
|
||||
|
||||
#: utils/test/x52_test_clock.c:31
|
||||
msgid "This tests the clock display"
|
||||
msgstr ""
|
||||
|
||||
#: utils/test/x52_test_clock.c:36
|
||||
msgid ""
|
||||
"\n"
|
||||
"Testing clock time minute display for 90 minutes"
|
||||
msgstr ""
|
||||
|
||||
#: utils/test/x52_test_clock.c:42
|
||||
msgid ""
|
||||
"\n"
|
||||
"Testing clock time hour display for 36 hours, 12 hour mode"
|
||||
msgstr ""
|
||||
|
||||
#: utils/test/x52_test_clock.c:45
|
||||
msgid ""
|
||||
"\n"
|
||||
"Testing clock time hour display for 36 hours, 24 hour mode"
|
||||
msgstr ""
|
||||
|
||||
#: utils/test/x52_test_clock.c:50
|
||||
msgid ""
|
||||
"\n"
|
||||
"Testing clock date display for 31 days, dd-mm-yy"
|
||||
msgstr ""
|
||||
|
||||
#: utils/test/x52_test_clock.c:54
|
||||
msgid ""
|
||||
"\n"
|
||||
"Testing clock date display for 31 days, mm-dd-yy"
|
||||
msgstr ""
|
||||
|
||||
#: utils/test/x52_test_clock.c:58
|
||||
msgid ""
|
||||
"\n"
|
||||
"Testing clock date display for 31 days, yy-mm-dd"
|
||||
msgstr ""
|
||||
|
||||
#: utils/test/x52_test_common.h:25
|
||||
#, c-format
|
||||
msgid ""
|
||||
"\n"
|
||||
"%s(%s) failed with %d(%s)\n"
|
||||
msgstr ""
|
||||
|
||||
#: utils/test/x52_test_common.h:31
|
||||
#, c-format
|
||||
msgid ""
|
||||
"\n"
|
||||
"update failed with %d(%s)\n"
|
||||
msgstr ""
|
||||
|
||||
#: utils/test/x52_test_led.c:17
|
||||
#, c-format
|
||||
msgid "LED %s - %s\n"
|
||||
msgstr ""
|
||||
|
||||
#: utils/test/x52_test_led.c:23 utils/test/x52_test_led.c:30
|
||||
#, c-format
|
||||
msgid ""
|
||||
"\n"
|
||||
"Testing LED %s\n"
|
||||
msgstr ""
|
||||
|
||||
#: utils/test/x52_test_led.c:40
|
||||
msgid "LEDs"
|
||||
msgstr ""
|
||||
|
||||
#: utils/test/x52_test_led.c:41
|
||||
msgid "This cycles the LEDs through all possible states"
|
||||
msgstr ""
|
||||
|
||||
#: utils/test/x52_test_led.c:59
|
||||
#, c-format
|
||||
msgid ""
|
||||
"\n"
|
||||
"Testing %s\n"
|
||||
msgstr ""
|
||||
|
||||
#: utils/test/x52_test_led.c:70
|
||||
msgid "Blink & Shift"
|
||||
msgstr ""
|
||||
|
||||
#: utils/test/x52_test_led.c:71
|
||||
msgid "This tests the blink indicator and shift functionality"
|
||||
msgstr ""
|
||||
|
||||
#: utils/test/x52_test_mfd.c:22
|
||||
msgid "Brightness"
|
||||
msgstr ""
|
||||
|
||||
#: utils/test/x52_test_mfd.c:24
|
||||
msgid "This test cycles through the MFD and LED brightness scales"
|
||||
msgstr ""
|
||||
|
||||
#: utils/test/x52_test_mfd.c:27
|
||||
msgid ""
|
||||
"\n"
|
||||
"MFD: "
|
||||
msgstr ""
|
||||
|
||||
#: utils/test/x52_test_mfd.c:34
|
||||
msgid ""
|
||||
"\n"
|
||||
"LED: "
|
||||
msgstr ""
|
||||
|
||||
#: utils/test/x52_test_mfd.c:53
|
||||
msgid "MFD text"
|
||||
msgstr ""
|
||||
|
||||
#: utils/test/x52_test_mfd.c:54
|
||||
msgid "This test tests the character displays of the MFD\n"
|
||||
msgstr ""
|
||||
|
||||
#: utils/test/x52_test_mfd.c:58
|
||||
#, c-format
|
||||
msgid "Writing characters %s\n"
|
||||
msgstr ""
|
||||
|
||||
#: utils/test/x52_test_mfd.c:80
|
||||
msgid "MFD display"
|
||||
msgstr ""
|
||||
|
||||
#: utils/test/x52_test_mfd.c:81
|
||||
msgid ""
|
||||
"This test checks if the display elements can display all characters\n"
|
||||
"You should see the display cycling through each character, with every\n"
|
||||
"cell displaying the same character\n"
|
||||
msgstr ""
|
||||
|
||||
#: utils/test/x52_test_mfd.c:86
|
||||
#, c-format
|
||||
msgid "Testing character 0x%02x..."
|
||||
msgstr ""
|
||||
|
||||
#: utils/test/x52_test_mfd.c:94
|
||||
msgid "OK"
|
||||
msgstr ""
|
||||
|
|
|
@ -0,0 +1,363 @@
|
|||
# Language xx translations for x52pro-linux package.
|
||||
# Copyright (C) 2020 Nirenjan Krishnan
|
||||
# This file is distributed under the same license as the x52pro-linux package.
|
||||
# Nirenjan Krishnan <nirenjan@gmail.com>, 2020.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: x52pro-linux 0.2.1\n"
|
||||
"Report-Msgid-Bugs-To: https://github.com/nirenjan/x52pro-linux/issues\n"
|
||||
"POT-Creation-Date: 2020-05-20 03:17-0700\n"
|
||||
"PO-Revision-Date: 2020-05-19 17:03-0700\n"
|
||||
"Last-Translator: Nirenjan Krishnan <nirenjan@gmail.com>\n"
|
||||
"Language-Team: Dummy Language for testing i18n\n"
|
||||
"Language: xx_PL\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: lib/libx52/x52_strerror.c:24
|
||||
msgid "Success"
|
||||
msgstr "UccessSAy"
|
||||
|
||||
#: lib/libx52/x52_strerror.c:27
|
||||
msgid "Initialization failure"
|
||||
msgstr "Initializationay ailurefay"
|
||||
|
||||
#: lib/libx52/x52_strerror.c:30
|
||||
msgid "Insufficient memory"
|
||||
msgstr "Insufficientay emorymay"
|
||||
|
||||
#: lib/libx52/x52_strerror.c:33
|
||||
msgid "Invalid parameter"
|
||||
msgstr "Invaliday arameterpay"
|
||||
|
||||
#: lib/libx52/x52_strerror.c:36
|
||||
msgid "Operation not supported"
|
||||
msgstr "Operationay otnay upportedsay"
|
||||
|
||||
#: lib/libx52/x52_strerror.c:39
|
||||
msgid "Try again"
|
||||
msgstr "Rytay againay"
|
||||
|
||||
#: lib/libx52/x52_strerror.c:42
|
||||
msgid "Input parameter out of range"
|
||||
msgstr "Inputay arameterpay outay ofay angeray"
|
||||
|
||||
#: lib/libx52/x52_strerror.c:45
|
||||
msgid "USB transaction failure"
|
||||
msgstr "USBay ransactiontay ailurefay"
|
||||
|
||||
#: lib/libx52/x52_strerror.c:48
|
||||
msgid "USB input/output error"
|
||||
msgstr "USBay inputay/outputay erroray"
|
||||
|
||||
#: lib/libx52/x52_strerror.c:51
|
||||
msgid "Access denied"
|
||||
msgstr "Accessay eniedday"
|
||||
|
||||
#: lib/libx52/x52_strerror.c:54
|
||||
msgid "No such device"
|
||||
msgstr "Onay uchsay eviceday"
|
||||
|
||||
#: lib/libx52/x52_strerror.c:57
|
||||
msgid "Entity not found"
|
||||
msgstr "Entityay notnay oundfay"
|
||||
|
||||
#: lib/libx52/x52_strerror.c:60
|
||||
msgid "Resource busy"
|
||||
msgstr "Esourceray usybay"
|
||||
|
||||
#: lib/libx52/x52_strerror.c:63
|
||||
msgid "Operation timeout"
|
||||
msgstr "Operationay imeouttay"
|
||||
|
||||
#: lib/libx52/x52_strerror.c:66
|
||||
msgid "Overflow"
|
||||
msgstr "Overfloway"
|
||||
|
||||
#: lib/libx52/x52_strerror.c:69
|
||||
msgid "Pipe error"
|
||||
msgstr "Ipepay erroray"
|
||||
|
||||
#: lib/libx52/x52_strerror.c:72
|
||||
msgid "System call interrupted"
|
||||
msgstr "Ystemsay allcay interrupteday"
|
||||
|
||||
#: lib/libx52/x52_strerror.c:76
|
||||
#, c-format
|
||||
msgid "Unknown error %d"
|
||||
msgstr "Unknownay erroray %d"
|
||||
|
||||
#: utils/test/x52_test.c:87
|
||||
msgid "Test brightness scale (~ 1m)"
|
||||
msgstr "Esttay rightnessbay calesay (~ 1m)"
|
||||
|
||||
#: utils/test/x52_test.c:88
|
||||
msgid "Test MFD string display (~ 30s)"
|
||||
msgstr "Esttay MFDay tringsay isplayday (~ 30s)"
|
||||
|
||||
#: utils/test/x52_test.c:89
|
||||
msgid "Test MFD displays all characters (~ 2m 15s)"
|
||||
msgstr "Esttay MFDay isplaysday allay haracterscay (~ 2m 15s)"
|
||||
|
||||
#: utils/test/x52_test.c:90
|
||||
msgid "Test the blink and shift commands (< 10s)"
|
||||
msgstr "Esttay hetay linkbay anday hiftsay ommandscay (< 10s)"
|
||||
|
||||
#: utils/test/x52_test.c:91
|
||||
msgid "Test the clock commands (~1m)"
|
||||
msgstr "Esttay hetay lockcay ommandscay (~1m)"
|
||||
|
||||
#: utils/test/x52_test.c:92
|
||||
msgid "Test LED states (~ 45s)"
|
||||
msgstr "Esstay EDLay tatessay (~ 45s)"
|
||||
|
||||
#: utils/test/x52_test.c:116
|
||||
msgid ""
|
||||
"x52test is a suite of tests to write to the X52 Pro device\n"
|
||||
"and test the extra functionality available in the LEDs and MFD\n"
|
||||
msgstr ""
|
||||
"x52test isay ay uitesay ofay eststay otay riteway otay hetay\n"
|
||||
"X52 Pro eviceday anday esttay hetay extray unctionalityfay\n"
|
||||
"availableay inay hetay EDsLay anday FDMay\n"
|
||||
|
||||
#: utils/test/x52_test.c:120
|
||||
msgid "These tests take roughly 6 minutes to run"
|
||||
msgstr "Hesetay eststay aketay oughlyray 6 inutesmay otay unray"
|
||||
|
||||
#: utils/test/x52_test.c:122
|
||||
msgid "Press Enter to begin the tests, press Ctrl-C to abort anytime"
|
||||
msgstr ""
|
||||
"Resspay Enteray otay eginbay hetay eststay, resspay Ctrl-C otay abortay "
|
||||
"anytimeay"
|
||||
|
||||
#: utils/test/x52_test.c:128
|
||||
#, c-format
|
||||
msgid "Unable to initialize X52 library: %s\n"
|
||||
msgstr "Unableay otay initializeay X52 ibrarylay: %s\n"
|
||||
|
||||
#: utils/test/x52_test.c:143
|
||||
msgid "All tests completed successfully"
|
||||
msgstr "Allay eststay ompletedcay uccessfullysay"
|
||||
|
||||
#: utils/test/x52_test.c:145
|
||||
#, c-format
|
||||
msgid "Got error %s\n"
|
||||
msgstr "Otgay erroray %s\n"
|
||||
|
||||
#: utils/test/x52_test.c:147
|
||||
#, c-format
|
||||
msgid "Received %s signal, quitting...\n"
|
||||
msgstr "Eceivedray %s ignalsay, uittingqay...\n"
|
||||
|
||||
#: utils/test/x52_test.c:166
|
||||
msgid ""
|
||||
"These are the available tests with a description and\n"
|
||||
"approximate runtime. Not specifying any tests will run\n"
|
||||
"all the tests\n"
|
||||
msgstr ""
|
||||
"Hesetay areay hetay availableay eststay ithway\n"
|
||||
"escriptionday anday approximateay untimeray. Otnay\n"
|
||||
"pecifyingsay anyay eststay illway unray allay hetay\n"
|
||||
"eststay\n"
|
||||
|
||||
#: utils/test/x52_test.c:170
|
||||
msgid "List of tests:"
|
||||
msgstr "Istlay ofay eststay:"
|
||||
|
||||
#: utils/test/x52_test.c:220
|
||||
#, c-format
|
||||
msgid ""
|
||||
"Usage: %s [list of tests]\n"
|
||||
"\n"
|
||||
msgstr "Usageay: %s [istlay ofay eststay]\n"
|
||||
|
||||
#: utils/test/x52_test.c:234
|
||||
#, c-format
|
||||
msgid ""
|
||||
"Unrecognized test identifier: %s\n"
|
||||
"\n"
|
||||
msgstr ""
|
||||
"Unrecognizeday esttay identifieray: %s\n"
|
||||
"\n"
|
||||
|
||||
#: utils/test/x52_test.c:247
|
||||
msgid "Not running any tests"
|
||||
msgstr "Otnay unningray anyay eststay"
|
||||
|
||||
#: utils/test/x52_test_clock.c:30
|
||||
msgid "Clock"
|
||||
msgstr "Lockcay"
|
||||
|
||||
#: utils/test/x52_test_clock.c:31
|
||||
msgid "This tests the clock display"
|
||||
msgstr "Histay eststay hetay lockcay isplayday"
|
||||
|
||||
#: utils/test/x52_test_clock.c:36
|
||||
msgid ""
|
||||
"\n"
|
||||
"Testing clock time minute display for 90 minutes"
|
||||
msgstr ""
|
||||
"\n"
|
||||
"Estingtay lockcay imetay inutemay isplayday orfay 90 inutesmay"
|
||||
|
||||
#: utils/test/x52_test_clock.c:42
|
||||
msgid ""
|
||||
"\n"
|
||||
"Testing clock time hour display for 36 hours, 12 hour mode"
|
||||
msgstr ""
|
||||
"\n"
|
||||
"Estingtay lockcay imetay ourhay isplayday orfay 36 ourshay, 12 ourhay odemay"
|
||||
|
||||
#: utils/test/x52_test_clock.c:45
|
||||
msgid ""
|
||||
"\n"
|
||||
"Testing clock time hour display for 36 hours, 24 hour mode"
|
||||
msgstr ""
|
||||
"\n"
|
||||
"Estingtay lockcay imetay ourhay isplayday orfay 36 ourshay, 24 ourhay odemay"
|
||||
|
||||
#: utils/test/x52_test_clock.c:50
|
||||
msgid ""
|
||||
"\n"
|
||||
"Testing clock date display for 31 days, dd-mm-yy"
|
||||
msgstr ""
|
||||
"\n"
|
||||
"Estingtay lockcay ateday isplayday orfay 31 aysday, dd-mm-yy"
|
||||
|
||||
#: utils/test/x52_test_clock.c:54
|
||||
msgid ""
|
||||
"\n"
|
||||
"Testing clock date display for 31 days, mm-dd-yy"
|
||||
msgstr ""
|
||||
"\n"
|
||||
"Estingtay lockcay ateday isplayday orfay 31 aysday, mm-dd-yy"
|
||||
|
||||
#: utils/test/x52_test_clock.c:58
|
||||
msgid ""
|
||||
"\n"
|
||||
"Testing clock date display for 31 days, yy-mm-dd"
|
||||
msgstr ""
|
||||
"\n"
|
||||
"Estingtay lockcay ateday isplayday orfay 31 aysday, yy-mm-dd"
|
||||
|
||||
#: utils/test/x52_test_common.h:25
|
||||
#, c-format
|
||||
msgid ""
|
||||
"\n"
|
||||
"%s(%s) failed with %d(%s)\n"
|
||||
msgstr ""
|
||||
"\n"
|
||||
"%s(%s) ailedfay ithway %d(%s)\n"
|
||||
|
||||
#: utils/test/x52_test_common.h:31
|
||||
#, c-format
|
||||
msgid ""
|
||||
"\n"
|
||||
"update failed with %d(%s)\n"
|
||||
msgstr ""
|
||||
"\n"
|
||||
"updateay ailedfay ithway %d(%s)\n"
|
||||
|
||||
#: utils/test/x52_test_led.c:17
|
||||
#, c-format
|
||||
msgid "LED %s - %s\n"
|
||||
msgstr "EDLay %s - %s\n"
|
||||
|
||||
#: utils/test/x52_test_led.c:23 utils/test/x52_test_led.c:30
|
||||
#, c-format
|
||||
msgid ""
|
||||
"\n"
|
||||
"Testing LED %s\n"
|
||||
msgstr ""
|
||||
"\n"
|
||||
"Estingtay EDLay %s\n"
|
||||
|
||||
#: utils/test/x52_test_led.c:40
|
||||
msgid "LEDs"
|
||||
msgstr "EDsLay"
|
||||
|
||||
#: utils/test/x52_test_led.c:41
|
||||
msgid "This cycles the LEDs through all possible states"
|
||||
msgstr "Histay yclescay hetay EDsLay hroughtay allay ossiblepay tatessay"
|
||||
|
||||
#: utils/test/x52_test_led.c:59
|
||||
#, c-format
|
||||
msgid ""
|
||||
"\n"
|
||||
"Testing %s\n"
|
||||
msgstr ""
|
||||
"\n"
|
||||
"Estingtay %s\n"
|
||||
|
||||
#: utils/test/x52_test_led.c:70
|
||||
msgid "Blink & Shift"
|
||||
msgstr "Linkbay & Hiftsay"
|
||||
|
||||
#: utils/test/x52_test_led.c:71
|
||||
msgid "This tests the blink indicator and shift functionality"
|
||||
msgstr "Histay eststay hetay linkbay indicatoray anday hiftsay unctionalityfay"
|
||||
|
||||
#: utils/test/x52_test_mfd.c:22
|
||||
msgid "Brightness"
|
||||
msgstr "Rightnessbay"
|
||||
|
||||
#: utils/test/x52_test_mfd.c:24
|
||||
msgid "This test cycles through the MFD and LED brightness scales"
|
||||
msgstr ""
|
||||
"Histay esttay yclescay hroughtay hetay FDMay anday EDLay rightnessbay "
|
||||
"calessay"
|
||||
|
||||
#: utils/test/x52_test_mfd.c:27
|
||||
msgid ""
|
||||
"\n"
|
||||
"MFD: "
|
||||
msgstr ""
|
||||
"\n"
|
||||
"FDMay: "
|
||||
|
||||
#: utils/test/x52_test_mfd.c:34
|
||||
msgid ""
|
||||
"\n"
|
||||
"LED: "
|
||||
msgstr ""
|
||||
"\n"
|
||||
"EDLay: "
|
||||
|
||||
#: utils/test/x52_test_mfd.c:53
|
||||
msgid "MFD text"
|
||||
msgstr "FDMay exttay"
|
||||
|
||||
#: utils/test/x52_test_mfd.c:54
|
||||
msgid "This test tests the character displays of the MFD\n"
|
||||
msgstr "Histay esttay eststay hetay haractercay isplaysday ofay the FDMay\n"
|
||||
|
||||
#: utils/test/x52_test_mfd.c:58
|
||||
#, c-format
|
||||
msgid "Writing characters %s\n"
|
||||
msgstr "Ritingway haracterscay %s\n"
|
||||
|
||||
#: utils/test/x52_test_mfd.c:80
|
||||
msgid "MFD display"
|
||||
msgstr "FDMay isplayday"
|
||||
|
||||
#: utils/test/x52_test_mfd.c:81
|
||||
msgid ""
|
||||
"This test checks if the display elements can display all characters\n"
|
||||
"You should see the display cycling through each character, with every\n"
|
||||
"cell displaying the same character\n"
|
||||
msgstr ""
|
||||
"Histay esttay heckscay ifay hetay isplayday lementseay ancay isplayday\n"
|
||||
"allay haracterscay.Ouyay houldsay eesay hetay isplayday yclingcay\n"
|
||||
"hroughtay eachay haractercay, ithway everyay ellcay isplayingday hetay\n"
|
||||
"amesay haractercay\n"
|
||||
|
||||
#: utils/test/x52_test_mfd.c:86
|
||||
#, c-format
|
||||
msgid "Testing character 0x%02x..."
|
||||
msgstr "Estingtay haractercay 0x%02x..."
|
||||
|
||||
#: utils/test/x52_test_mfd.c:94
|
||||
msgid "OK"
|
||||
msgstr "OKay"
|
|
@ -10,7 +10,7 @@ bin_PROGRAMS = x52test
|
|||
|
||||
# Test utility that exercises all the library functions
|
||||
x52test_SOURCES = x52_test.c x52_test_mfd.c x52_test_led.c x52_test_clock.c
|
||||
x52test_CFLAGS = @X52_INCLUDE@
|
||||
x52test_CFLAGS = @X52_INCLUDE@ -I $(top_srcdir) -DLOCALEDIR=\"$(localedir)\"
|
||||
x52test_LDADD = ../../lib/libx52/libx52.la
|
||||
|
||||
# Extra files that need to be in the distribution
|
||||
|
|
|
@ -84,12 +84,12 @@ static void signal_handler(int sig)
|
|||
}
|
||||
|
||||
#define TESTS \
|
||||
X(brightness, bri, "Test brightness scale (~ 1m)") \
|
||||
X(mfd_text, mfd1, "Test MFD string display (~ 30s)") \
|
||||
X(mfd_display, mfd2, "Test MFD displays all characters (~ 2m 15s)") \
|
||||
X(blink_n_shift, blink, "Test the blink and shift commands (< 10s)") \
|
||||
X(clock, clock, "Test the clock commands (~1m)") \
|
||||
X(leds, led, "Test LED states (~ 45s)")
|
||||
X(brightness, bri, gettext_noop("Test brightness scale (~ 1m)")) \
|
||||
X(mfd_text, mfd1, gettext_noop("Test MFD string display (~ 30s)")) \
|
||||
X(mfd_display, mfd2, gettext_noop("Test MFD displays all characters (~ 2m 15s)")) \
|
||||
X(blink_n_shift, blink, gettext_noop("Test the blink and shift commands (< 10s)")) \
|
||||
X(clock, clock, gettext_noop("Test the clock commands (~1m)")) \
|
||||
X(leds, led, gettext_noop("Test LED states (~ 45s)"))
|
||||
|
||||
enum {
|
||||
#define X(en, kw, desc) TEST_BIT_ ## en,
|
||||
|
@ -113,19 +113,19 @@ static int run_tests(int test_set)
|
|||
|
||||
int rc = 0;
|
||||
|
||||
puts("x52test is a suite of tests to write to the X52 Pro device");
|
||||
puts("and test the extra functionality available in the LEDs and MFD\n");
|
||||
puts(_("x52test is a suite of tests to write to the X52 Pro device\n"
|
||||
"and test the extra functionality available in the LEDs and MFD\n"));
|
||||
|
||||
if (test_set == TEST_ALL) {
|
||||
puts("These tests take roughly 6 minutes to run");
|
||||
puts(_("These tests take roughly 6 minutes to run"));
|
||||
}
|
||||
puts("Press Enter to begin the tests, press Ctrl-C to abort anytime");
|
||||
puts(_("Press Enter to begin the tests, press Ctrl-C to abort anytime"));
|
||||
|
||||
getc(stdin);
|
||||
|
||||
rc = libx52_init(&dev);
|
||||
if (rc != LIBX52_SUCCESS) {
|
||||
fprintf(stderr, "Unable to connect to X52 Pro Joystick!\n");
|
||||
fprintf(stderr, _("Unable to initialize X52 library: %s\n"), libx52_strerror(rc));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -140,11 +140,11 @@ static int run_tests(int test_set)
|
|||
} while (0);
|
||||
|
||||
if (rc == LIBX52_SUCCESS) {
|
||||
puts("All tests completed successfully");
|
||||
puts(_("All tests completed successfully"));
|
||||
} else if (rc > 0) {
|
||||
fprintf(stderr, "Got error %s\n", libx52_strerror(rc));
|
||||
fprintf(stderr, _("Got error %s\n"), libx52_strerror(rc));
|
||||
} else {
|
||||
fprintf(stderr, "Received %s signal, quitting...\n", strsignal(-rc));
|
||||
fprintf(stderr, _("Received %s signal, quitting...\n"), strsignal(-rc));
|
||||
}
|
||||
|
||||
if (rc >= 0) test_cleanup();
|
||||
|
@ -152,14 +152,22 @@ static int run_tests(int test_set)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void underline(const char *msg) {
|
||||
int i;
|
||||
puts(msg);
|
||||
for (i = 0; i < strlen(msg); i++) {
|
||||
putchar('=');
|
||||
}
|
||||
putchar('\n');
|
||||
}
|
||||
|
||||
void usage(void)
|
||||
{
|
||||
puts("These are the available tests with a description and");
|
||||
puts("approximate runtime. Not specifying any tests will run");
|
||||
puts("all the tests\n");
|
||||
puts(_("These are the available tests with a description and\n"
|
||||
"approximate runtime. Not specifying any tests will run\n"
|
||||
"all the tests\n"));
|
||||
|
||||
puts("List of tests:");
|
||||
puts("==============");
|
||||
underline(_("List of tests:"));
|
||||
|
||||
#define X(en, cmd, desc) puts("\t" #cmd "\t" desc);
|
||||
TESTS
|
||||
|
@ -186,6 +194,13 @@ int main(int argc, char **argv)
|
|||
const struct test_map *test;
|
||||
int found;
|
||||
|
||||
/* Initialize gettext */
|
||||
#if ENABLE_NLS
|
||||
setlocale(LC_ALL, "");
|
||||
bindtextdomain(PACKAGE, LOCALEDIR);
|
||||
textdomain(PACKAGE);
|
||||
#endif
|
||||
|
||||
/* Usage: x52test [list of tests] */
|
||||
if (argc == 1) {
|
||||
/* Run all tests, if none specified */
|
||||
|
@ -202,7 +217,7 @@ int main(int argc, char **argv)
|
|||
!strcmp(argv[i], "--help")) {
|
||||
|
||||
/* Display help string and exit */
|
||||
printf("Usage: %s [list of tests]\n\n", argv[0]);
|
||||
printf(_("Usage: %s [list of tests]\n\n"), argv[0]);
|
||||
usage();
|
||||
return 0;
|
||||
} else {
|
||||
|
@ -216,7 +231,7 @@ int main(int argc, char **argv)
|
|||
}
|
||||
|
||||
if (found == 0) {
|
||||
printf("Unrecognized test identifier: %s\n\n", argv[i]);
|
||||
printf(_("Unrecognized test identifier: %s\n\n"), argv[i]);
|
||||
usage();
|
||||
return 1;
|
||||
}
|
||||
|
@ -229,7 +244,7 @@ int main(int argc, char **argv)
|
|||
if (test_list) {
|
||||
i = run_tests(test_list);
|
||||
} else {
|
||||
puts("Not running any tests");
|
||||
puts(_("Not running any tests"));
|
||||
}
|
||||
|
||||
return i;
|
||||
|
|
|
@ -27,35 +27,35 @@ int test_clock(void)
|
|||
} \
|
||||
} while (0)
|
||||
|
||||
print_banner("Clock");
|
||||
puts("This tests the clock display");
|
||||
print_banner(_("Clock"));
|
||||
puts(_("This tests the clock display"));
|
||||
|
||||
/* Start from midnight Jan 1 2015 GMT */
|
||||
start = 1420070400;
|
||||
|
||||
puts("\nTesting clock time minute display for 90 minutes");
|
||||
puts(_("\nTesting clock time minute display for 90 minutes"));
|
||||
end = start + 90 * 60;
|
||||
TEST(clock_format, LIBX52_CLOCK_1, LIBX52_CLOCK_FORMAT_12HR);
|
||||
TEST_CLOCK_LOOP(60);
|
||||
|
||||
end = start + 36 * 60 * 60;
|
||||
puts("\nTesting clock time hour display for 36 hours, 12 hour mode");
|
||||
puts(_("\nTesting clock time hour display for 36 hours, 12 hour mode"));
|
||||
TEST_CLOCK_LOOP(3600);
|
||||
|
||||
puts("\nTesting clock time hour display for 36 hours, 24 hour mode");
|
||||
puts(_("\nTesting clock time hour display for 36 hours, 24 hour mode"));
|
||||
TEST(clock_format, LIBX52_CLOCK_1, LIBX52_CLOCK_FORMAT_24HR);
|
||||
TEST_CLOCK_LOOP(3600);
|
||||
|
||||
end = start + 31 * 24 * 60 * 60;
|
||||
puts("\nTesting clock date display for 31 days, dd-mm-yy");
|
||||
puts(_("\nTesting clock date display for 31 days, dd-mm-yy"));
|
||||
TEST(date_format, LIBX52_DATE_FORMAT_DDMMYY);
|
||||
TEST_CLOCK_LOOP(86400);
|
||||
|
||||
puts("\nTesting clock date display for 31 days, mm-dd-yy");
|
||||
puts(_("\nTesting clock date display for 31 days, mm-dd-yy"));
|
||||
TEST(date_format, LIBX52_DATE_FORMAT_MMDDYY);
|
||||
TEST_CLOCK_LOOP(86400);
|
||||
|
||||
puts("\nTesting clock date display for 31 days, yy-mm-dd");
|
||||
puts(_("\nTesting clock date display for 31 days, yy-mm-dd"));
|
||||
TEST(date_format, LIBX52_DATE_FORMAT_YYMMDD);
|
||||
TEST_CLOCK_LOOP(86400);
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include <stdio.h>
|
||||
#include <stdbool.h>
|
||||
#include "libx52.h"
|
||||
#include "gettext.h"
|
||||
|
||||
extern libx52_device *dev;
|
||||
extern int test_exit;
|
||||
|
@ -21,18 +22,21 @@ extern bool nodelay;
|
|||
int rc; \
|
||||
rc = ( libx52_set_ ## tst (dev, __VA_ARGS__) ); \
|
||||
if (rc) { \
|
||||
fprintf(stderr, "\n%s(%s) failed with %d(%s)\n", #tst, #__VA_ARGS__, rc, libx52_strerror(rc)); \
|
||||
fprintf(stderr, _("\n%s(%s) failed with %d(%s)\n"), #tst, #__VA_ARGS__, rc, libx52_strerror(rc)); \
|
||||
return rc; \
|
||||
} \
|
||||
if (test_exit) return test_exit; \
|
||||
rc = libx52_update(dev); \
|
||||
if (rc) { \
|
||||
fprintf(stderr, "\nupdate failed with %d(%s)\n", rc, libx52_strerror(rc)); \
|
||||
fprintf(stderr, _("\nupdate failed with %d(%s)\n"), rc, libx52_strerror(rc)); \
|
||||
return rc; \
|
||||
} \
|
||||
if (test_exit) return test_exit; \
|
||||
} while (0)
|
||||
|
||||
/* For i18n */
|
||||
#define _(x) gettext(x)
|
||||
|
||||
void test_cleanup(void);
|
||||
|
||||
void print_banner(const char *message);
|
||||
|
|
|
@ -14,20 +14,20 @@
|
|||
#include "x52_test_common.h"
|
||||
|
||||
#define TEST_LED(name, state) do { \
|
||||
puts("LED " #name " - " #state); \
|
||||
printf(_("LED %s - %s\n"), #name, #state); \
|
||||
TEST(led_state, LIBX52_LED_ ## name, LIBX52_LED_STATE_ ## state); \
|
||||
if (!nodelay) usleep(500000); \
|
||||
} while(0)
|
||||
|
||||
#define TEST_LED_MONO(name) do { \
|
||||
puts("\nTesting LED " #name); \
|
||||
printf(_("\nTesting LED %s\n"), #name); \
|
||||
if (!nodelay) sleep(2); \
|
||||
TEST_LED(name, OFF); \
|
||||
TEST_LED(name, ON); \
|
||||
} while(0)
|
||||
|
||||
#define TEST_LED_COLOR(name) do {\
|
||||
puts("\nTesting LED " #name); \
|
||||
printf(_("\nTesting LED %s\n"), #name); \
|
||||
if (!nodelay) sleep(2); \
|
||||
TEST_LED(name, OFF); \
|
||||
TEST_LED(name, RED); \
|
||||
|
@ -37,8 +37,8 @@
|
|||
|
||||
int test_leds(void)
|
||||
{
|
||||
print_banner("LEDs");
|
||||
puts("This cycles the LEDs through all possible states");
|
||||
print_banner(_("LEDs"));
|
||||
puts(_("This cycles the LEDs through all possible states"));
|
||||
|
||||
TEST_LED_MONO(FIRE);
|
||||
TEST_LED_COLOR(A);
|
||||
|
@ -56,7 +56,7 @@ int test_leds(void)
|
|||
}
|
||||
|
||||
#define TEST_BLINK_OR_SHIFT(type) do { \
|
||||
puts("\nTesting " #type); \
|
||||
printf(_("\nTesting %s\n"), #type); \
|
||||
if (!nodelay) sleep(1); \
|
||||
puts(#type " ON"); \
|
||||
TEST(type, 1); \
|
||||
|
@ -67,8 +67,8 @@ int test_leds(void)
|
|||
|
||||
int test_blink_n_shift(void)
|
||||
{
|
||||
print_banner("Blink & Shift");
|
||||
puts("This tests the blink indicator and shift functionality");
|
||||
print_banner(_("Blink & Shift"));
|
||||
puts(_("This tests the blink indicator and shift functionality"));
|
||||
|
||||
TEST_BLINK_OR_SHIFT(blink);
|
||||
TEST_BLINK_OR_SHIFT(shift);
|
||||
|
|
|
@ -19,19 +19,19 @@ int test_brightness(void)
|
|||
{
|
||||
int i;
|
||||
|
||||
print_banner("Brightness");
|
||||
print_banner(_("Brightness"));
|
||||
|
||||
puts("This test cycles through the MFD and LED brightness scales");
|
||||
puts(_("This test cycles through the MFD and LED brightness scales"));
|
||||
|
||||
fputs("\n |+---+---+---+---+---+---+---+---+|", stdout);
|
||||
fputs("\nMFD: ", stdout);
|
||||
fputs(_("\nMFD: "), stdout);
|
||||
for (i = 0; i < 129; i++) {
|
||||
if (!(i & 3)) fputs("#", stdout);
|
||||
fflush(stdout);
|
||||
TEST_BRIGHTNESS(1, i);
|
||||
if (!nodelay) usleep(250000);
|
||||
}
|
||||
fputs("\nLED: ", stdout);
|
||||
fputs(_("\nLED: "), stdout);
|
||||
for (i = 0; i < 129; i++) {
|
||||
if (!(i & 3)) fputs("#", stdout);
|
||||
fflush(stdout);
|
||||
|
@ -50,12 +50,12 @@ int test_mfd_text(void)
|
|||
int j;
|
||||
char str[32];
|
||||
|
||||
print_banner("MFD text");
|
||||
puts("This test tests the character displays of the MFD\n");
|
||||
print_banner(_("MFD text"));
|
||||
puts(_("This test tests the character displays of the MFD\n"));
|
||||
|
||||
for (i = 0; i < 256; i += 16) {
|
||||
j = snprintf(str, 16, "0x%02x - 0x%02x", i, i + 0xf);
|
||||
printf("Writing characters %s\n", str);
|
||||
printf(_("Writing characters %s\n"), str);
|
||||
TEST(text, 0, str, j);
|
||||
|
||||
memset(str, ' ', 32);
|
||||
|
@ -77,13 +77,13 @@ int test_mfd_display(void)
|
|||
int i;
|
||||
char str[16];
|
||||
|
||||
print_banner("MFD display");
|
||||
puts("This test checks if the display elements can display all characters");
|
||||
puts("You should see the display cycling through each character, with every");
|
||||
puts("cell displaying the same character\n");
|
||||
print_banner(_("MFD display"));
|
||||
puts(_("This test checks if the display elements can display all characters\n"
|
||||
"You should see the display cycling through each character, with every\n"
|
||||
"cell displaying the same character\n"));
|
||||
|
||||
for (i = 0; i < 256; i++) {
|
||||
printf("Testing character 0x%02x...", i);
|
||||
printf(_("Testing character 0x%02x..."), i);
|
||||
|
||||
memset(str, i, 16);
|
||||
|
||||
|
@ -91,7 +91,7 @@ int test_mfd_display(void)
|
|||
TEST(text, 1, str, 16);
|
||||
TEST(text, 2, str, 16);
|
||||
|
||||
puts("OK");
|
||||
puts(_("OK"));
|
||||
if (!nodelay) usleep(500000);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue