[Libreoffice-commits] core.git: unotools/source
Andras Timar
andras.timar at collabora.com
Wed Jul 9 02:43:54 PDT 2014
unotools/source/config/useroptions.cxx | 38 +++++++++++++++++++++++++++------
1 file changed, 32 insertions(+), 6 deletions(-)
New commits:
commit 33c36fb9fbc69bbc32088532dd21db7153aee09d
Author: Andras Timar <andras.timar at collabora.com>
Date: Wed Jul 9 11:44:32 2014 +0200
localized GetFullName()
Change-Id: I4f2bffadef3db1bd07432202525734ab9b0cb0de
diff --git a/unotools/source/config/useroptions.cxx b/unotools/source/config/useroptions.cxx
index 0f92991..6fab077 100644
--- a/unotools/source/config/useroptions.cxx
+++ b/unotools/source/config/useroptions.cxx
@@ -18,7 +18,7 @@
*/
#include <unotools/useroptions.hxx>
-
+#include <unotools/syslocale.hxx>
#include <unotools/configmgr.hxx>
#include <com/sun/star/uno/Any.hxx>
#include <com/sun/star/uno/Sequence.hxx>
@@ -37,6 +37,7 @@
#include <com/sun/star/util/ChangesEvent.hpp>
#include <comphelper/configurationhelper.hxx>
#include <comphelper/processfactory.hxx>
+#include <i18nlangtag/mslangid.hxx>
using namespace utl;
using namespace com::sun::star;
@@ -194,11 +195,36 @@ void SvtUserOptions::Impl::SetToken (sal_uInt16 nToken, OUString const& sToken)
OUString SvtUserOptions::Impl::GetFullName () const
{
- // TODO international name
- OUString sFullName = GetToken(USER_OPT_FIRSTNAME).trim();
- if (!sFullName.isEmpty())
- sFullName += " ";
- sFullName += GetToken(USER_OPT_LASTNAME).trim();
+ OUString sFullName;
+ switch (LanguageType const eLang = SvtSysLocale().GetUILanguageTag().getLanguageType())
+ {
+ case LANGUAGE_RUSSIAN:
+ sFullName = GetToken(USER_OPT_FIRSTNAME).trim();
+ if (!sFullName.isEmpty())
+ sFullName += " ";
+ sFullName += GetToken(USER_OPT_FATHERSNAME).trim();
+ if (!sFullName.isEmpty())
+ sFullName += " ";
+ sFullName += GetToken(USER_OPT_LASTNAME).trim();
+ break;
+ default:
+ if (MsLangId::isFamilyNameFirst(eLang))
+ {
+ sFullName = GetToken(USER_OPT_LASTNAME).trim();
+ if (!sFullName.isEmpty())
+ sFullName += " ";
+ sFullName += GetToken(USER_OPT_FIRSTNAME).trim();
+ }
+ else
+ {
+ sFullName = GetToken(USER_OPT_FIRSTNAME).trim();
+ if (!sFullName.isEmpty())
+ sFullName += " ";
+ sFullName += GetToken(USER_OPT_LASTNAME).trim();
+ }
+ break;
+ }
+
return sFullName;
}
More information about the Libreoffice-commits
mailing list