Minor UI locale updates.
Qt: Call setlocale before commandline_early_options so that we get proper "-v" output, similar to the GTK+ UI. GTK+: Call setlocale once at startup. Bug: 11960 Change-Id: I3c3a196b9d94fc768e1085200891bc8d67e21a08 Reviewed-on: https://code.wireshark.org/review/16132 Reviewed-by: Gerald Combs <gerald@wireshark.org> Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: João Valverde <j@v6e.pt>
This commit is contained in:
parent
79836fa23a
commit
b47aca5fd1
@ -2095,7 +2095,10 @@ main(int argc, char *argv[])
|
|||||||
|
|
||||||
cmdarg_err_init(wireshark_cmdarg_err, wireshark_cmdarg_err_cont);
|
cmdarg_err_init(wireshark_cmdarg_err, wireshark_cmdarg_err_cont);
|
||||||
|
|
||||||
/* Set the C-language locale to the native environment. */
|
/* Set the current locale according to the program environment.
|
||||||
|
* We haven't localized anything, but some GTK widgets are localized
|
||||||
|
* (the file selection dialogue, for example).
|
||||||
|
* This also sets the C-language locale to the native environment. */
|
||||||
setlocale(LC_ALL, "");
|
setlocale(LC_ALL, "");
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
arg_list_utf_16to8(argc, argv);
|
arg_list_utf_16to8(argc, argv);
|
||||||
@ -2235,12 +2238,6 @@ main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Set the current locale according to the program environment.
|
|
||||||
* We haven't localized anything, but some GTK widgets are localized
|
|
||||||
* (the file selection dialogue, for example).
|
|
||||||
* This also sets the C-language locale to the native environment. */
|
|
||||||
setlocale (LC_ALL, "");
|
|
||||||
|
|
||||||
/* Let GTK get its args (will need an X server, so do this after command line only commands handled) */
|
/* Let GTK get its args (will need an X server, so do this after command line only commands handled) */
|
||||||
gtk_init (&argc, &argv);
|
gtk_init (&argc, &argv);
|
||||||
|
|
||||||
|
@ -1051,7 +1051,7 @@ static void switchTranslator(QTranslator& myTranslator, const QString& filename,
|
|||||||
wsApp->installTranslator(&myTranslator);
|
wsApp->installTranslator(&myTranslator);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WiresharkApplication::loadLanguage(const QString& newLanguage)
|
void WiresharkApplication::loadLanguage(const QString newLanguage)
|
||||||
{
|
{
|
||||||
QLocale locale;
|
QLocale locale;
|
||||||
QString localeLanguage;
|
QString localeLanguage;
|
||||||
|
@ -118,7 +118,7 @@ public:
|
|||||||
|
|
||||||
QTranslator translator;
|
QTranslator translator;
|
||||||
QTranslator translatorQt;
|
QTranslator translatorQt;
|
||||||
void loadLanguage(const QString& language);
|
void loadLanguage(const QString language);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool initialized_;
|
bool initialized_;
|
||||||
|
@ -27,6 +27,8 @@
|
|||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <locale.h>
|
||||||
|
|
||||||
#ifdef HAVE_GETOPT_H
|
#ifdef HAVE_GETOPT_H
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
#endif
|
#endif
|
||||||
@ -355,8 +357,8 @@ int main(int argc, char *argv[])
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Set the C-language locale to the native environment. */
|
/* Set the C-language locale to the native environment. */
|
||||||
// The GTK+ UI calls this. Should we as well?
|
setlocale(LC_ALL, "");
|
||||||
//setlocale(LC_ALL, "");
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
// QCoreApplication clobbers argv. Let's have a local copy.
|
// QCoreApplication clobbers argv. Let's have a local copy.
|
||||||
ws_argv = (char **) g_malloc(sizeof(char *) * argc);
|
ws_argv = (char **) g_malloc(sizeof(char *) * argc);
|
||||||
@ -467,7 +469,6 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
AirPDcapInitContext(&airpdcap_ctx);
|
AirPDcapInitContext(&airpdcap_ctx);
|
||||||
|
|
||||||
QString locale;
|
|
||||||
QString cf_name;
|
QString cf_name;
|
||||||
unsigned int in_file_type = WTAP_TYPE_AUTO;
|
unsigned int in_file_type = WTAP_TYPE_AUTO;
|
||||||
|
|
||||||
@ -498,10 +499,9 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
// Initialize our language
|
// Initialize our language
|
||||||
read_language_prefs();
|
read_language_prefs();
|
||||||
locale = QString(language);
|
wsApp->loadLanguage(language);
|
||||||
wsApp->loadLanguage(locale);
|
|
||||||
|
|
||||||
g_log(LOG_DOMAIN_MAIN, G_LOG_LEVEL_DEBUG, "Translator %s", locale.toStdString().c_str());
|
g_log(LOG_DOMAIN_MAIN, G_LOG_LEVEL_DEBUG, "Translator %s", language);
|
||||||
|
|
||||||
// Init the main window (and splash)
|
// Init the main window (and splash)
|
||||||
main_w = new(MainWindow);
|
main_w = new(MainWindow);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user