From 0b24f1996debc24a9af2bd1dc921f347506ac32c Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Thu, 1 Oct 2009 14:03:31 +0200 Subject: QNAM HTTP Code: Always send an Accept-Language header Send a header that we accept every language. Works around a bug in some broken websites and is hopefully of no harm for us. Task-number: QT-952 Reviewed-by: Thiago --- src/network/access/qhttpnetworkconnection.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp index 4fcbc1f..aef1258 100644 --- a/src/network/access/qhttpnetworkconnection.cpp +++ b/src/network/access/qhttpnetworkconnection.cpp @@ -244,6 +244,15 @@ void QHttpNetworkConnectionPrivate::prepareRequest(HttpMessagePair &messagePair) request.d->autoDecompress = false; #endif } + + // some websites mandate an accept-language header and fail + // if it is not sent. This is a problem with the website and + // not with us, but we work around this by setting a + // universal one always. + value = request.headerField("accept-language"); + if (value.isEmpty()) + request.setHeaderField("accept-language", "en,*"); + // set the User Agent value = request.headerField("user-agent"); if (value.isEmpty()) -- cgit v0.12 From ec05eed4fa68b7b1af2dead4fdbb83cd3a758ac0 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 1 Oct 2009 12:51:41 +0200 Subject: make -help reflect reality --- tools/linguist/lupdate/main.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tools/linguist/lupdate/main.cpp b/tools/linguist/lupdate/main.cpp index 8818b50..8560c7d 100644 --- a/tools/linguist/lupdate/main.cpp +++ b/tools/linguist/lupdate/main.cpp @@ -119,12 +119,11 @@ static void printUsage() " Name of a .pro file. Useful for files with .pro\n" " file syntax but different file suffix\n" " -source-language [_]\n" - " Specify/override the language of the source strings. Defaults to\n" - " POSIX if not specified and the file does not name it yet.\n" + " Specify the language of the source strings for new files.\n" + " Defaults to POSIX if not specified.\n" " -target-language [_]\n" - " Specify/override the language of the translation.\n" - " The target language is guessed from the file name if this option\n" - " is not specified and the file contents name no language yet.\n" + " Specify the language of the translations for new files.\n" + " Guessed from the file name if not specified.\n" " -version\n" " Display the version of lupdate and exit.\n" ).arg(m_defaultExtensions)); -- cgit v0.12 From ce7cf03ab1346b5f447db3d849d2c183abce0138 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 1 Oct 2009 13:37:21 +0200 Subject: make -{source,target}-language actually override values from files -help says it does, and it kinda makes sense --- tools/linguist/lconvert/main.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/linguist/lconvert/main.cpp b/tools/linguist/lconvert/main.cpp index c342def..3cc9509 100644 --- a/tools/linguist/lconvert/main.cpp +++ b/tools/linguist/lconvert/main.cpp @@ -215,10 +215,6 @@ int main(int argc, char *argv[]) return usage(args); tr.setLanguageCode(Translator::guessLanguageCodeFromFileName(inFiles[0].name)); - if (!targetLanguage.isEmpty()) - tr.setLanguageCode(targetLanguage); - if (!sourceLanguage.isEmpty()) - tr.setSourceLanguageCode(sourceLanguage); if (!tr.load(inFiles[0].name, cd, inFiles[0].format)) { qWarning() << qPrintable(cd.error()); @@ -237,6 +233,10 @@ int main(int argc, char *argv[]) tr.replaceSorted(tr2.message(j)); } + if (!targetLanguage.isEmpty()) + tr.setLanguageCode(targetLanguage); + if (!sourceLanguage.isEmpty()) + tr.setSourceLanguageCode(sourceLanguage); if (noObsolete) tr.stripObsoleteMessages(); if (noFinished) -- cgit v0.12