[Libreoffice-commits] core.git: cui/source cui/uiconfig

Brij Mohan Lal Srivastava contactbrijmohan at gmail.com
Sun Nov 16 00:36:06 PST 2014


 cui/source/dialogs/about.cxx   |   29 +++++++++++++++++++++++++++++
 cui/source/inc/about.hxx       |    2 ++
 cui/uiconfig/ui/aboutdialog.ui |   13 +++++++++++++
 3 files changed, 44 insertions(+)

New commits:
commit c5092a8d0edeada83118c595b61ee80486e84659
Author: Brij Mohan Lal Srivastava <contactbrijmohan at gmail.com>
Date:   Sun Nov 16 01:58:54 2014 +0530

    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 at ubuntu.com>
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
    Tested-by: Michael Meeks <michael.meeks at collabora.com>

diff --git a/cui/source/dialogs/about.cxx b/cui/source/dialogs/about.cxx
index 0846bd3..b9e3306 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 60f2657..132ab54 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 7449b62..1565d09 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>


More information about the Libreoffice-commits mailing list