From 9e15e1647126db419928067d088ac7e7ba075973 Mon Sep 17 00:00:00 2001 From: Samikshan Bairagya Date: Mon, 20 Aug 2012 23:40:09 +0530 Subject: [PATCH] Internationalized the WI feature. Made the size of the "Go Back" button dependent on the size of the text so that the button-text do not overshoot the button boundaries. --- kstars/Messages.sh | 2 +- .../tools/whatsinteresting/obsconditions.cpp | 2 +- kstars/tools/whatsinteresting/qml/wiview.qml | 26 ++++++++++--------- kstars/tools/whatsinteresting/skyobjitem.cpp | 12 ++++----- kstars/tools/whatsinteresting/wiview.cpp | 8 +++--- 5 files changed, 26 insertions(+), 24 deletions(-) diff --git a/kstars/Messages.sh b/kstars/Messages.sh index 7d56711c0..bf4d36997 100644 --- a/kstars/Messages.sh +++ b/kstars/Messages.sh @@ -69,7 +69,7 @@ rm -f tips.cpp $EXTRACTRC xplanet/*.ui *.ui printing/*.ui tools/*.ui dialogs/*.ui fitsviewer/*.ui indi/*.ui options/*.ui oal/*.ui *.rc *.kcfg >> rc.cpp || exit 11 (cd data && $PREPARETIPS > ../tips.cpp) -$XGETTEXT *.cpp *.h printing/*.cpp tools/*.cpp tools/*.h skycomponents/*.cpp widgets/*.cpp dialogs/*.cpp dialogs/*.h fitsviewer/*.cpp fitsviewer/*.h indi/*.cpp indi/*.h options/*.cpp options/*.h skyobjects/*.cpp skyobjects/*.h xplanet/*.cpp oal/*.h oal/*.cpp -o $podir/kstars.pot +$XGETTEXT *.cpp *.h printing/*.cpp tools/*.cpp tools/*.h tools/whatsinteresting/*.h tools/whatsinteresting/*.cpp skycomponents/*.cpp widgets/*.cpp dialogs/*.cpp dialogs/*.h fitsviewer/*.cpp fitsviewer/*.h indi/*.cpp indi/*.h options/*.cpp options/*.h skyobjects/*.cpp skyobjects/*.h xplanet/*.cpp oal/*.h oal/*.cpp -o $podir/kstars.pot rm -f tips.cpp rm -f kstars_i18n.cpp rm -f rc.cpp diff --git a/kstars/tools/whatsinteresting/obsconditions.cpp b/kstars/tools/whatsinteresting/obsconditions.cpp index e87bbe188..cce1b825c 100644 --- a/kstars/tools/whatsinteresting/obsconditions.cpp +++ b/kstars/tools/whatsinteresting/obsconditions.cpp @@ -95,7 +95,7 @@ double ObsConditions::getTrueMagLim() * The calculation is just based on the calculation of the * telescope's aperture to eye's pupil surface ratio. */ - //kDebug() << (LM + 5*log10(aperture/7.5)); + return m_LM + 5 * log10(m_Aperture / 7.5); } diff --git a/kstars/tools/whatsinteresting/qml/wiview.qml b/kstars/tools/whatsinteresting/qml/wiview.qml index d3920aefb..3602eb347 100644 --- a/kstars/tools/whatsinteresting/qml/wiview.qml +++ b/kstars/tools/whatsinteresting/qml/wiview.qml @@ -806,7 +806,7 @@ Rectangle { id: backButton x: container.width + 10 y: 493 - width: 114 + width: leftArrow.width + goBackText.width + 18 height: 49 color: "#00000000" radius: 5 @@ -820,26 +820,28 @@ Rectangle { Text { id: goBackText + x: 45 + y: 12 color: "#f7e808" - text: "Go back" - anchors.leftMargin: 45 + text: qsTr("Go back") + anchors.verticalCenterOffset: 0 + anchors.horizontalCenterOffset: 53 + anchors.horizontalCenter: leftArrow.horizontalCenter + anchors.verticalCenter: leftArrow.verticalCenter font.family: "Cantarell" font.pointSize: 13 verticalAlignment: Text.AlignVCenter horizontalAlignment: Text.AlignHCenter - anchors.fill: parent } Image { id: leftArrow - anchors.right: parent.right - anchors.rightMargin: 74 - anchors.left: parent.left - anchors.leftMargin: 8 - anchors.top: parent.top - anchors.topMargin: 8 - anchors.bottom: parent.bottom - anchors.bottomMargin: 9 + x: 5 + y: 9 + anchors.verticalCenterOffset: 0 + anchors.horizontalCenterOffset: -36 + anchors.horizontalCenter: parent.horizontalCenter + anchors.verticalCenter: parent.verticalCenter source: "leftArrow.png" } diff --git a/kstars/tools/whatsinteresting/skyobjitem.cpp b/kstars/tools/whatsinteresting/skyobjitem.cpp index 53fc6bd0a..01e6de9d1 100644 --- a/kstars/tools/whatsinteresting/skyobjitem.cpp +++ b/kstars/tools/whatsinteresting/skyobjitem.cpp @@ -93,7 +93,7 @@ void SkyObjItem::setPosition(SkyObject* so) double rounded_altitude = (int)(sp.alt().Degrees()/5.0)*5.0; int rounded_azimuth = (int)(sp.az().Degrees()/22.5); - m_Position = QString("Now visible: About ") + (QString::number(rounded_altitude)) + (" degrees above the ") + (cardinals[rounded_azimuth]) + (" horizon "); + m_Position = i18n("Now visible: About %1 degrees above the %2 horizon", rounded_altitude, cardinals[rounded_azimuth]); } QString SkyObjItem::getDesc() const @@ -113,11 +113,11 @@ QString SkyObjItem::getDesc() const } else if (m_Type == Star) { - return "Bright Star"; + return i18n("Bright Star"); } else if (m_Type == Constellation) { - return "Constellation"; + return i18n("Constellation"); } return getTypeName(); @@ -139,7 +139,7 @@ QString SkyObjItem::getSurfaceBrightness() const { case Galaxy: case Nebula: - return KGlobal::locale()->formatNumber(SB) + " mag/arcmin^2"; + return KGlobal::locale()->formatNumber(SB, 2) + " mag/arcmin^2"; default: return QString(" --"); // Not applicable for other sky-objects } @@ -152,9 +152,9 @@ QString SkyObjItem::getSize() const case Galaxy: case Cluster: case Nebula: - return QString::number(((DeepSkyObject *)m_So)->a()) + " arcminutes"; + return KGlobal::locale()->formatNumber(((DeepSkyObject *)m_So)->a(), 2) + " arcminutes"; case Planet: - return QString::number(((KSPlanetBase *)m_So)->angSize()) + " arcseconds"; + return KGlobal::locale()->formatNumber(((KSPlanetBase *)m_So)->angSize(), 2) + " arcseconds"; default: return QString(" --"); } diff --git a/kstars/tools/whatsinteresting/wiview.cpp b/kstars/tools/whatsinteresting/wiview.cpp index 0088729b8..045dbbf1f 100644 --- a/kstars/tools/whatsinteresting/wiview.cpp +++ b/kstars/tools/whatsinteresting/wiview.cpp @@ -114,15 +114,15 @@ void WIView::loadDetailsView(SkyObjItem *soitem, int index) QString magText; if (soitem->getType() == SkyObjItem::Constellation) - magText = QString("Magnitude: --"); + magText = i18n("Magnitude: --"); else - magText = QString("Magnitude: ") + QString::number(soitem->getMagnitude()) + " mag"; + magText = i18n("Magnitude: %1 %2", soitem->getMagnitude(), " mag"); magTextObj->setProperty("text", magText); - QString sbText = QString("Surface Brightness: ") + soitem->getSurfaceBrightness(); + QString sbText = i18n("Surface Brightness: %1", soitem->getSurfaceBrightness()); sbTextObj->setProperty("text", sbText); - QString sizeText = QString("Size: ") + soitem->getSize(); + QString sizeText = i18n("Size: %1", soitem->getSize()); sizeTextObj->setProperty("text", sizeText); } -- GitLab