summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrij Mohan Lal Srivastava <contactbrijmohan@gmail.com>2014-11-16 01:58:54 +0530
committerMichael Meeks <michael.meeks@collabora.com>2014-11-16 08:35:38 +0000
commitc5092a8d0edeada83118c595b61ee80486e84659 (patch)
tree40a12f19fa85175c22bf0899250d3ef1326ba5c1
parent1defd9aeb9c051dc3b719bade5edb58462b4b817 (diff)
fdo#85432 : Add locale details to help->about
Added locale text to About dialog Change-Id: Ic26219e8fe845b4c5027b65d5f5edba9279b1b11 Reviewed-on: https://gerrit.libreoffice.org/12464 Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com> Reviewed-by: Michael Meeks <michael.meeks@collabora.com> Tested-by: Michael Meeks <michael.meeks@collabora.com>
-rw-r--r--cui/source/dialogs/about.cxx29
-rw-r--r--cui/source/inc/about.hxx2
-rw-r--r--cui/uiconfig/ui/aboutdialog.ui13
3 files changed, 44 insertions, 0 deletions
diff --git a/cui/source/dialogs/about.cxx b/cui/source/dialogs/about.cxx
index 0846bd369959..b9e3306e2048 100644
--- a/cui/source/dialogs/about.cxx
+++ b/cui/source/dialogs/about.cxx
@@ -77,6 +77,7 @@ AboutDialog::AboutDialog(vcl::Window* pParent)
m_aVersionTextStr = m_pVersion->GetText();
m_aBasedTextStr = get<FixedText>("libreoffice")->GetText();
m_aBasedDerivedTextStr = get<FixedText>("derived")->GetText();
+ m_pLocaleStr = get<FixedText>("locale")->GetText();;
m_pVersion->SetText(GetVersionString());
@@ -232,12 +233,29 @@ OUString AboutDialog::GetBuildId()
return sBuildId;
}
+OUString AboutDialog::GetLocaleString()
+{
+ OUString pLocaleStr;
+ rtl_Locale * pLocale;
+
+ osl_getProcessLocale( &pLocale );
+
+ if ( pLocale && pLocale->Language && pLocale->Country )
+ {
+ pLocaleStr = OUString(pLocale->Language) + "_" + OUString(pLocale->Country);
+ }
+
+ return pLocaleStr;
+}
+
OUString AboutDialog::GetVersionString()
{
OUString sVersion = m_aVersionTextStr;
OUString sBuildId = GetBuildId();
+ OUString pLocaleStr = GetLocaleString();
+
if (!sBuildId.trim().isEmpty())
{
sVersion += "\n";
@@ -255,6 +273,17 @@ OUString AboutDialog::GetVersionString()
sVersion += EXTRA_BUILDID;
}
+ if (!pLocaleStr.trim().isEmpty())
+ {
+ sVersion += "\n";
+ if (m_pLocaleStr.indexOf("$LOCALE") == -1)
+ {
+ SAL_WARN( "cui.dialogs", "translated locale string in translations doesn't contain $LOCALE placeholder" );
+ m_pLocaleStr += " $LOCALE";
+ }
+ sVersion += m_pLocaleStr.replaceAll("$LOCALE", pLocaleStr);
+ }
+
return sVersion;
}
diff --git a/cui/source/inc/about.hxx b/cui/source/inc/about.hxx
index 60f265742410..132ab541702e 100644
--- a/cui/source/inc/about.hxx
+++ b/cui/source/inc/about.hxx
@@ -49,6 +49,7 @@ private:
OUString m_aBasedDerivedTextStr;
OUString m_aCreditsLinkStr;
OUString m_sBuildStr;
+ OUString m_pLocaleStr;
void StyleControls();
void SetLogo();
@@ -56,6 +57,7 @@ private:
OUString GetBuildId();
OUString GetVersionString();
OUString GetCopyrightString();
+ OUString GetLocaleString();
protected:
virtual bool Close() SAL_OVERRIDE;
diff --git a/cui/uiconfig/ui/aboutdialog.ui b/cui/uiconfig/ui/aboutdialog.ui
index 7449b6215edf..1565d0968b9b 100644
--- a/cui/uiconfig/ui/aboutdialog.ui
+++ b/cui/uiconfig/ui/aboutdialog.ui
@@ -134,6 +134,19 @@
</packing>
</child>
<child>
+ <object class="GtkLabel" id="locale">
+ <property name="can_focus">False</property>
+ <property name="no_show_all">True</property>
+ <property name="hexpand">True</property>
+ <property name="label" translatable="yes">Locale: $LOCALE</property>
+ <property name="justify">center</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ </packing>
+ </child>
+ <child>
<object class="GtkTextView" id="version">
<property name="visible">True</property>
<property name="can_focus">True</property>