Line | |
---|
1 | #include <QFile>
|
---|
2 | #include <QRegExp>
|
---|
3 | #include <stdio.h>
|
---|
4 |
|
---|
5 | int main( int argc, char ** argv )
|
---|
6 | {
|
---|
7 | QFile file("list.txt");
|
---|
8 | if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
|
---|
9 | return -1;
|
---|
10 |
|
---|
11 | QRegExp rx("^([a-zA-Z]+) ([a-zA-Z\\-]+)");
|
---|
12 |
|
---|
13 | QString line;
|
---|
14 | while (!file.atEnd()) {
|
---|
15 | line = QString(file.readLine()).simplified();
|
---|
16 | if (!line.isEmpty()) {
|
---|
17 | //qDebug("%s", line.toLatin1().constData());
|
---|
18 | if (rx.indexIn(line) > -1) {
|
---|
19 | QString s1 = rx.cap(1);
|
---|
20 | QString s2 = rx.cap(2);
|
---|
21 | //qDebug("code: %s, language: %s", s1.toLatin1().constData(), s2.toLatin1().constData());
|
---|
22 | printf("\tl[\"%s\"] = tr(\"%s\");\n", s1.toLatin1().constData(), s2.toLatin1().constData());
|
---|
23 | }
|
---|
24 | }
|
---|
25 | }
|
---|
26 | file.close();
|
---|
27 |
|
---|
28 | return 0;
|
---|
29 | }
|
---|
30 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.