![]() |
2010-11-16
, 10:16
|
|
Posts: 319 |
Thanked: 221 times |
Joined on Jan 2010
@ Finland
|
#41
|
![]() |
2010-11-17
, 18:47
|
|
Posts: 319 |
Thanked: 221 times |
Joined on Jan 2010
@ Finland
|
#42
|
I don't remember :-)
I found this one in some example code or in the maemo developer
guide.
Nicolai
QStringDialog::translate(QStringdomain,QStringstr) { QByteArraydomainBytes=domain.toLatin1(); constchar*domainPtr=domainBytes.data(); QByteArraystrBytes=str.toLatin1(); constchar*strPtr=strBytes.data(); setlocale(LC_ALL,""); returnQString::fromUtf8(dgettext(domainPtr,strPtr)); }
if(line.startsWith("Comment=")) { strList=line.split("="); if(strList.length()>=2) { comment=strList[strList.length()-1]; realComment=translate("maemo-af-desktop",comment); } } if(line.startsWith("X-Text-Domain=")) { strList=line.split("="); if(strList.length()>=2){ xTextDomain=strList[strList.length()-1]; realName=translate(xTextDomain,name); realComment=translate(xTextDomain,comment); } }
![]() |
2010-11-18
, 00:16
|
|
Posts: 1,637 |
Thanked: 4,424 times |
Joined on Apr 2009
@ Germany
|
#43
|
QT += core gui TARGET = settingsreader TEMPLATE = app SOURCES += main.cpp\
#include <QtGui/QApplication> #include <QSettings> #include <QMainWindow> #include <QListWidget> #include <QDirIterator> #include <locale> #include <libintl.h> #include <QDebug> int main(int argc, char *argv[]) { QApplication a(argc, argv); QMainWindow w; QListWidget* list = new QListWidget(&w); QDirIterator iter("/usr/share/applications/hildon/"); while(iter.hasNext()) { QString path = iter.next(); qDebug() << path; if(path.endsWith(".desktop")) { QSettings settings(path, QSettings::IniFormat); settings.beginGroup("Desktop Entry"); QString name = settings.value("Name", "no name").toString(); QString comment; QString domain("maemo-af-desktop"); if(settings.contains("X-Text-Domain")) { domain = settings.value("X-Text-Domain").toString(); } name = QString::fromUtf8(dgettext(domain.toLatin1(), name.toLatin1())); if(settings.contains("Comment")) { comment = QString::fromUtf8(dgettext(domain.toLatin1(), settings.value("Comment").toString().toLatin1())); } list->addItem(name + " " + comment); } } w.setCentralWidget(list); w.show(); return a.exec(); }
The Following User Says Thank You to nicolai For This Useful Post: | ||
![]() |
2010-11-18
, 07:18
|
|
Posts: 319 |
Thanked: 221 times |
Joined on Jan 2010
@ Finland
|
#44
|
![]() |
2010-11-18
, 15:57
|
|
Posts: 319 |
Thanked: 221 times |
Joined on Jan 2010
@ Finland
|
#45
|
Hi rooster,
I just looked at my app-search-widget code again, because it seems
only the Name but not the comment entry is localized (translatable).
The comment entry for the browser is
weba_ap_web_browser_thumb
but I can not find any translated text for this name...
nicolai
QString Dialog::getComment(QString xTextDomain, QString execPath) { QString retComment = ""; QStringList execList = execPath.split("/"); QString execName = execList[execList.length() - 1]; bool isFound = false; QProcess apt; apt.start("sh -c \"apt-cache show " + xTextDomain.replace("_", "-") + " | grep 'Description:' | tail -1\""); apt.waitForFinished(); while(apt.canReadLine()) { QString outData = apt.readLine(); if (outData.startsWith("Description:")) { //qDebug() << outData; QStringList tmpSplit = outData.split(":"); if (tmpSplit.length() >= 2) { retComment = tmpSplit[tmpSplit.length() - 1]; isFound = true; } } } apt.close(); if (!isFound) { apt.start("sh -c \"apt-cache show " + execName.replace("_", "-") + " | grep 'Description:' | tail -1\""); apt.waitForFinished(); while(apt.canReadLine()) { QString outData = apt.readLine(); if (outData.startsWith("Description:")) { //qDebug() << outData; QStringList tmpSplit = outData.split(":"); if (tmpSplit.length() >= 2) { retComment = tmpSplit[tmpSplit.length() - 1]; isFound = true; } } } apt.close(); } return retComment.trimmed(); }
The Following User Says Thank You to rooster13 For This Useful Post: | ||
![]() |
2010-11-20
, 12:15
|
|
Posts: 319 |
Thanked: 221 times |
Joined on Jan 2010
@ Finland
|
#46
|
The Following 4 Users Say Thank You to rooster13 For This Useful Post: | ||
![]() |
2010-11-22
, 14:54
|
|
Posts: 319 |
Thanked: 221 times |
Joined on Jan 2010
@ Finland
|
#47
|
TMP="/var/tmp" TEMP="/var/tmp" DEBIAN_FRONTEND="noninteractive" DEBIAN_PRIORITY="critical" DEB_BUILD_OPTIONS="parallel=4" TMPDIR="/var/tmp" dpkg-buildpackage: set CFLAGS to default value: -g -O2 dpkg-buildpackage: set CPPFLAGS to default value: dpkg-buildpackage: set LDFLAGS to default value: dpkg-buildpackage: set FFLAGS to default value: -g -O2 dpkg-buildpackage: set CXXFLAGS to default value: -g -O2 dpkg-buildpackage: source package maemostash dpkg-buildpackage: source version 0.1-1 dpkg-buildpackage: host architecture armel dpkg-checkbuilddeps: Using Scratchbox tools to satisfy builddeps fakeroot debian/rules clean dh_testdir dh_testroot rm -f build-stamp # Add here commands to clean up after the build process. rm -rf builddir dh_clean dpkg-source -b maemostash-0.1 dpkg-source: info: using source format `1.0' dpkg-source: info: building maemostash using existing maemostash_0.1.orig.tar.gz dpkg-source: info: building maemostash in maemostash_0.1-1.diff.gz dpkg-source: warning: the diff modifies the following upstream files: Makefile dpkg-source: info: use the '3.0 (quilt)' format to have separate and documented changes to upstream files, see dpkg-source(1) dpkg-source: info: building maemostash in maemostash_0.1-1.dsc debian/rules build mkdir -p builddir cd builddir && qmake-qt4 PREFIX=/usr ../MaemoStash.pro /scratchbox/tools/bin/sh: line 1: qmake-qt4: command not found make: *** [builddir/Makefile] Error 127 dpkg-buildpackage: error: debian/rules build gave error exit status 2
![]() |
2010-11-22
, 17:26
|
|
Posts: 319 |
Thanked: 221 times |
Joined on Jan 2010
@ Finland
|
#49
|
![]() |
2010-11-22
, 17:51
|
|
Posts: 319 |
Thanked: 221 times |
Joined on Jan 2010
@ Finland
|
#50
|
/usr/bin/rcc: File does not exist '../images.qrc'