summaryrefslogtreecommitdiffstats
path: root/poxml/swappo.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'poxml/swappo.cpp')
-rw-r--r--poxml/swappo.cpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/poxml/swappo.cpp b/poxml/swappo.cpp
new file mode 100644
index 00000000..94c308ae
--- /dev/null
+++ b/poxml/swappo.cpp
@@ -0,0 +1,38 @@
+#include <iostream>
+using namespace std;
+#include "GettextParser.hpp"
+#include <fstream>
+#include "GettextLexer.hpp"
+
+int main(int argc, char **argv)
+{
+ if ( argc != 2 ) {
+ qWarning( "usage: %s pofile", argv[0] );
+ return -1;
+ }
+
+ MsgList translated;
+
+ try {
+ ifstream s(argv[1]);
+ GettextLexer lexer(s);
+ GettextParser parser(lexer);
+ translated = parser.file();
+
+ } catch(exception& e) {
+ cerr << "exception: " << e.what() << endl;
+ return 1;
+ }
+
+ for (MsgList::ConstIterator it = translated.begin();
+ it != translated.end(); ++it)
+ {
+ if ( !( *it ).msgstr.isEmpty() ) {
+ outputMsg("msgid", (*it).msgstr);
+ outputMsg("msgstr", (*it).msgid);
+ cout << "\n";
+ }
+ }
+
+}
+