f085be
From 848ee355904db1453f343c8257a86635c1dddcac Mon Sep 17 00:00:00 2001
f085be
From: Andras Timar <andras.timar@collabora.com>
f085be
Date: Wed, 9 Jul 2014 11:44:32 +0200
f085be
Subject: [PATCH 002/137] localized GetFullName()
f085be
f085be
Change-Id: I4f2bffadef3db1bd07432202525734ab9b0cb0de
f085be
(cherry picked from commit 33c36fb9fbc69bbc32088532dd21db7153aee09d)
f085be
---
f085be
 unotools/source/config/useroptions.cxx | 38 ++++++++++++++++++++++++++++------
f085be
 1 file changed, 32 insertions(+), 6 deletions(-)
f085be
f085be
diff --git a/unotools/source/config/useroptions.cxx b/unotools/source/config/useroptions.cxx
f085be
index 01ae9e6..1dadaf3 100644
f085be
--- a/unotools/source/config/useroptions.cxx
f085be
+++ b/unotools/source/config/useroptions.cxx
f085be
@@ -19,7 +19,7 @@
f085be
 
f085be
 
f085be
 #include <unotools/useroptions.hxx>
f085be
-
f085be
+#include <unotools/syslocale.hxx>
f085be
 #include <unotools/configmgr.hxx>
f085be
 #include <com/sun/star/uno/Any.hxx>
f085be
 #include <com/sun/star/uno/Sequence.hxx>
f085be
@@ -39,6 +39,7 @@
f085be
 #include <com/sun/star/util/ChangesEvent.hpp>
f085be
 #include <comphelper/configurationhelper.hxx>
f085be
 #include <comphelper/processfactory.hxx>
f085be
+#include <i18nlangtag/mslangid.hxx>
f085be
 
f085be
 using namespace utl;
f085be
 using namespace com::sun::star;
f085be
@@ -210,11 +211,36 @@ void SvtUserOptions::Impl::SetToken (sal_uInt16 nToken, OUString const& sToken)
f085be
 
f085be
 OUString SvtUserOptions::Impl::GetFullName () const
f085be
 {
f085be
-    // TODO international name
f085be
-    OUString sFullName = GetToken(USER_OPT_FIRSTNAME).trim();
f085be
-    if (!sFullName.isEmpty())
f085be
-        sFullName += " ";
f085be
-    sFullName += GetToken(USER_OPT_LASTNAME).trim();
f085be
+    OUString sFullName;
f085be
+    switch (LanguageType const eLang = SvtSysLocale().GetUILanguageTag().getLanguageType())
f085be
+    {
f085be
+        case LANGUAGE_RUSSIAN:
f085be
+            sFullName = GetToken(USER_OPT_FIRSTNAME).trim();
f085be
+            if (!sFullName.isEmpty())
f085be
+                sFullName += " ";
f085be
+            sFullName += GetToken(USER_OPT_FATHERSNAME).trim();
f085be
+            if (!sFullName.isEmpty())
f085be
+                sFullName += " ";
f085be
+            sFullName += GetToken(USER_OPT_LASTNAME).trim();
f085be
+            break;
f085be
+        default:
f085be
+            if (MsLangId::isFamilyNameFirst(eLang))
f085be
+            {
f085be
+                sFullName = GetToken(USER_OPT_LASTNAME).trim();
f085be
+                if (!sFullName.isEmpty())
f085be
+                    sFullName += " ";
f085be
+                sFullName += GetToken(USER_OPT_FIRSTNAME).trim();
f085be
+            }
f085be
+            else
f085be
+            {
f085be
+                sFullName = GetToken(USER_OPT_FIRSTNAME).trim();
f085be
+                if (!sFullName.isEmpty())
f085be
+                    sFullName += " ";
f085be
+                sFullName += GetToken(USER_OPT_LASTNAME).trim();
f085be
+            }
f085be
+            break;
f085be
+    }
f085be
+
f085be
     return sFullName;
f085be
 }
f085be
 
f085be
-- 
f085be
1.9.3
f085be