c5b436d6b3
- update to 4.0.3.3.2 (SUSE 4.0-rc2, tag suse-4.0-2, based on upstream 4.0.3.3) OBS-URL: https://build.opensuse.org/request/show/175584 OBS-URL: https://build.opensuse.org/package/show/LibreOffice:Factory/libreoffice?expand=0&rev=33
66 lines
2.3 KiB
Diff
66 lines
2.3 KiB
Diff
From 8a6be8341d0a962d1ec384440ece523607c8b1d5 Mon Sep 17 00:00:00 2001
|
|
From: Petr Mladek <pmladek@suse.cz>
|
|
Date: Tue, 14 May 2013 11:25:49 +0200
|
|
Subject: [PATCH] allow to create Letter and Fax templates with python 2.6
|
|
|
|
The localized file type desciptions have non-ascii characters.
|
|
The "str" type acceppts only "ascii" characters in python-2.6,
|
|
|
|
The string has to be encoded according to the system locale,
|
|
otherwise it is broken in non-UTF-* locales.
|
|
|
|
Change-Id: I0a138f10ec7c2665c0700918f671fbd5eb674bf6
|
|
---
|
|
wizards/com/sun/star/wizards/common/SystemDialog.py | 21 ++++++++++++++++++++-
|
|
1 file changed, 20 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/wizards/com/sun/star/wizards/common/SystemDialog.py b/wizards/com/sun/star/wizards/common/SystemDialog.py
|
|
index ab9b463..aa3426a 100644
|
|
--- a/wizards/com/sun/star/wizards/common/SystemDialog.py
|
|
+++ b/wizards/com/sun/star/wizards/common/SystemDialog.py
|
|
@@ -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
|
|
|
|
@@ -139,6 +140,24 @@ class SystemDialog(object):
|
|
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.
|
|
@@ -152,7 +171,7 @@ class SystemDialog(object):
|
|
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);
|
|
--
|
|
1.8.1.3
|
|
|