equal
deleted
inserted
replaced
43 |
43 |
44 #include "simtexth.h" |
44 #include "simtexth.h" |
45 |
45 |
46 #include <stdio.h> |
46 #include <stdio.h> |
47 #ifdef Q_OS_WIN |
47 #ifdef Q_OS_WIN |
48 #include <io.h> // required for _setmode, to avoid _O_TEXT streams... |
48 // required for _setmode, to avoid _O_TEXT streams... |
49 #include <fcntl.h> // for _O_BINARY |
49 # ifdef Q_OS_WINCE |
|
50 # include <stdlib.h> |
|
51 # else |
|
52 # include <io.h> // for _setmode |
|
53 # include <fcntl.h> // for _O_BINARY |
|
54 # endif |
50 #endif |
55 #endif |
51 |
56 |
52 #include <QtCore/QDebug> |
57 #include <QtCore/QDebug> |
53 #include <QtCore/QDir> |
58 #include <QtCore/QDir> |
54 #include <QtCore/QFile> |
59 #include <QtCore/QFile> |
211 |
216 |
212 QFile file; |
217 QFile file; |
213 if (filename.isEmpty() || filename == QLatin1String("-")) { |
218 if (filename.isEmpty() || filename == QLatin1String("-")) { |
214 #ifdef Q_OS_WIN |
219 #ifdef Q_OS_WIN |
215 // QFile is broken for text files |
220 // QFile is broken for text files |
|
221 # ifdef Q_OS_WINCE |
|
222 ::_setmode(stdin, _O_BINARY); |
|
223 # else |
216 ::_setmode(0, _O_BINARY); |
224 ::_setmode(0, _O_BINARY); |
|
225 # endif |
217 #endif |
226 #endif |
218 if (!file.open(stdin, QIODevice::ReadOnly)) { |
227 if (!file.open(stdin, QIODevice::ReadOnly)) { |
219 cd.appendError(QString::fromLatin1("Cannot open stdin!? (%1)") |
228 cd.appendError(QString::fromLatin1("Cannot open stdin!? (%1)") |
220 .arg(file.errorString())); |
229 .arg(file.errorString())); |
221 return false; |
230 return false; |
251 { |
260 { |
252 QFile file; |
261 QFile file; |
253 if (filename.isEmpty() || filename == QLatin1String("-")) { |
262 if (filename.isEmpty() || filename == QLatin1String("-")) { |
254 #ifdef Q_OS_WIN |
263 #ifdef Q_OS_WIN |
255 // QFile is broken for text files |
264 // QFile is broken for text files |
|
265 # ifdef Q_OS_WINCE |
|
266 ::_setmode(stdout, _O_BINARY); |
|
267 # else |
256 ::_setmode(1, _O_BINARY); |
268 ::_setmode(1, _O_BINARY); |
|
269 # endif |
257 #endif |
270 #endif |
258 if (!file.open(stdout, QIODevice::WriteOnly)) { |
271 if (!file.open(stdout, QIODevice::WriteOnly)) { |
259 cd.appendError(QString::fromLatin1("Cannot open stdout!? (%1)") |
272 cd.appendError(QString::fromLatin1("Cannot open stdout!? (%1)") |
260 .arg(file.errorString())); |
273 .arg(file.errorString())); |
261 return false; |
274 return false; |
650 QLocale::Country c; |
663 QLocale::Country c; |
651 languageAndCountry(languageCode(), &l, &c); |
664 languageAndCountry(languageCode(), &l, &c); |
652 int numPlurals = 1; |
665 int numPlurals = 1; |
653 if (l != QLocale::C) { |
666 if (l != QLocale::C) { |
654 QStringList forms; |
667 QStringList forms; |
655 if (getNumerusInfo(l, c, 0, &forms)) |
668 if (getNumerusInfo(l, c, 0, &forms, 0)) |
656 numPlurals = forms.count(); // includes singular |
669 numPlurals = forms.count(); // includes singular |
657 } |
670 } |
658 for (int i = 0; i < m_messages.count(); ++i) { |
671 for (int i = 0; i < m_messages.count(); ++i) { |
659 const TranslatorMessage &msg = m_messages.at(i); |
672 const TranslatorMessage &msg = m_messages.at(i); |
660 QStringList tlns = msg.translations(); |
673 QStringList tlns = msg.translations(); |