summaryrefslogtreecommitdiff
path: root/muse2
diff options
context:
space:
mode:
authorOrcan Ogetbil <oget.fedora@gmail.com>2010-12-13 11:31:53 +0000
committerOrcan Ogetbil <oget.fedora@gmail.com>2010-12-13 11:31:53 +0000
commit466a93203ef2cccbf91316e28661aaa29f8a506e (patch)
treeacc8f595d9f196217972d877fc27247fedfdd2c9 /muse2
parent0da3a1d73e2b407047bfedfb4f085fb8df067a19 (diff)
List the available locales in the --help output
Diffstat (limited to 'muse2')
-rw-r--r--muse2/ChangeLog2
-rw-r--r--muse2/muse/app.cpp29
2 files changed, 30 insertions, 1 deletions
diff --git a/muse2/ChangeLog b/muse2/ChangeLog
index 5cf5834c..af680887 100644
--- a/muse2/ChangeLog
+++ b/muse2/ChangeLog
@@ -1,3 +1,5 @@
+13.12.2010:
+ - List the available locales in the --help output. (Orcan)
12.12.2010:
- Integrated the translation system into cmake. Added a -DUPDATE_TRANSLATIONS flag to cmake
which will update the .ts files in the source tree with the newest strings. I used this to
diff --git a/muse2/muse/app.cpp b/muse2/muse/app.cpp
index 2d19f2cc..e2748724 100644
--- a/muse2/muse/app.cpp
+++ b/muse2/muse/app.cpp
@@ -3590,6 +3590,33 @@ class MuseApplication : public QApplication {
};
//---------------------------------------------------------
+// localeList
+//---------------------------------------------------------
+
+static QString localeList()
+ {
+ // Find out what translations are available:
+ QStringList deliveredLocaleListFiltered;
+ QString distLocale = QString(INSTPREFIX) + "/" + SHAREINSTPREFIX + "/"
+ + INSTALL_NAME + "/locale";
+ QFileInfo distLocaleFi(distLocale);
+ if (distLocaleFi.isDir()) {
+ QDir dir = QDir(distLocale);
+ QStringList deliveredLocaleList = dir.entryList();
+ for(QStringList::iterator it = deliveredLocaleList.begin(); it != deliveredLocaleList.end(); ++it) {
+ QString item = *it;
+ if (item.endsWith(".qm")) {
+ int inipos = item.indexOf("muse_") + 5;
+ int finpos = item.lastIndexOf(".qm");
+ deliveredLocaleListFiltered << item.mid(inipos, finpos - inipos);
+ }
+ }
+ return deliveredLocaleListFiltered.join(",");
+ }
+ return QString("No translations found!");
+ }
+
+//---------------------------------------------------------
// usage
//---------------------------------------------------------
@@ -3621,7 +3648,7 @@ static void usage(const char* prog, const char* txt)
#ifdef HAVE_LASH
fprintf(stderr, " -L don't use LASH\n");
#endif
- fprintf(stderr, " -l xx force locale given by language/country code (de, sv_SE, ...)");
+ fprintf(stderr, " -l xx force locale to the given language/country code (xx = %s)\n", localeList().toLatin1().constData());
fprintf(stderr, "useful environment variables:\n");
fprintf(stderr, " MUSE override library and shared directories location\n");
fprintf(stderr, " MUSEHOME override user home directory (HOME/)\n");