libreoffice/wizards-create-temlates-with-python-2.6.diff

46 lines
1.7 KiB
Diff
Raw Normal View History

diff -urN libreoffice-4.2.0.1.old/wizards/com/sun/star/wizards/common/SystemDialog.py libreoffice-4.2.0.1/wizards/com/sun/star/wizards/common/SystemDialog.py
--- libreoffice-4.2.0.1.old/wizards/com/sun/star/wizards/common/SystemDialog.py 2013-12-30 11:24:14.200021127 +0100
+++ libreoffice-4.2.0.1/wizards/com/sun/star/wizards/common/SystemDialog.py 2014-01-01 14:34:21.173943513 +0100
@@ -15,6 +15,7 @@
# except in compliance with the License. You may obtain a copy of
# the License at http://www.apache.org/licenses/LICENSE-2.0 .
#
+import locale
import traceback
from .Desktop import Desktop
@@ -140,6 +141,24 @@
traceback.print_exc()
'''
+ The original string is in the system encoding but str accepts only "ascii" in python 2.6
+ This hack is not needed with python-3.0
+ '''
+ def createStr(self, sString):
+ try:
+ strString = str(sString)
+
+ except:
+ try:
+ sCodeSet = locale.nl_langinfo(locale.CODESET)
+ except:
+ sCodeSet = "utf-8"
+
+ strString = str(sString.encode(sCodeSet))
+
+ return strString
+
+ '''
note the result should go through conversion of the product name.
@param filterName
@return the UI localized name of the given filter name.
@@ -153,7 +172,7 @@
xPropertyValue = list(oObject)
for i in xPropertyValue:
if i is not None and i.Name == "UIName":
- return str(i.Value).replace("%productname%", "LibreOffice")
+ return self.createStr(i.Value).replace("%productname%", "LibreOffice")
raise NullPointerException(
"UIName property not found for Filter " + filterName);