From 1f69ba8c55f7ce18f3c42f01eb31144508234071 Mon Sep 17 00:00:00 2001 From: konermann Date: Mon, 16 Feb 2015 12:39:04 +0000 Subject: [PATCH] Fehler #2400 FormprocessException, modul ccm-core/../kernel git-svn-id: https://svn.libreccm.org/ccm/trunk@3216 8810af33-2d31-482b-a856-94f89814c4df --- .../kernel/KernelResources.properties | 2 + .../kernel/KernelResources_de.properties | 1 + .../arsdigita/kernel/ResourceTypeConfig.java | 4 +- .../kernel/util/KernelGlobalizationUtil.java | 56 +++++++++++++++++++ 4 files changed, 61 insertions(+), 2 deletions(-) create mode 100644 ccm-core/src/com/arsdigita/kernel/KernelResources.properties create mode 100644 ccm-core/src/com/arsdigita/kernel/KernelResources_de.properties create mode 100644 ccm-core/src/com/arsdigita/kernel/util/KernelGlobalizationUtil.java diff --git a/ccm-core/src/com/arsdigita/kernel/KernelResources.properties b/ccm-core/src/com/arsdigita/kernel/KernelResources.properties new file mode 100644 index 000000000..d30527d84 --- /dev/null +++ b/ccm-core/src/com/arsdigita/kernel/KernelResources.properties @@ -0,0 +1,2 @@ + +kernel.cancelled=Cancelled diff --git a/ccm-core/src/com/arsdigita/kernel/KernelResources_de.properties b/ccm-core/src/com/arsdigita/kernel/KernelResources_de.properties new file mode 100644 index 000000000..26181a8b0 --- /dev/null +++ b/ccm-core/src/com/arsdigita/kernel/KernelResources_de.properties @@ -0,0 +1 @@ +kernel.cancelled=Abgebrochen\n diff --git a/ccm-core/src/com/arsdigita/kernel/ResourceTypeConfig.java b/ccm-core/src/com/arsdigita/kernel/ResourceTypeConfig.java index 4a5560303..0369d8c20 100755 --- a/ccm-core/src/com/arsdigita/kernel/ResourceTypeConfig.java +++ b/ccm-core/src/com/arsdigita/kernel/ResourceTypeConfig.java @@ -42,7 +42,7 @@ import org.apache.log4j.Logger; * @see ResourceConfigFormSection * @see com.arsdigita.kernel.Resource * @author Justin Ross - * @version $Id: ResourceTypeConfig.java 1942 2009-05-29 07:53:23Z terry $ + * @version $Id: ResourceTypeConfig.java 1942 2009-05-29 07:53:23Z terry $ */ public class ResourceTypeConfig { @@ -243,7 +243,7 @@ public class ResourceTypeConfig { if (m_buttons.getCancelButton().isSelected(state)) { fireCompletionEvent(state); - throw new FormProcessException("cancelled"); + throw new FormProcessException(KernelGlobalizationUtil.globalization("kernel.cancelled")); } } }); diff --git a/ccm-core/src/com/arsdigita/kernel/util/KernelGlobalizationUtil.java b/ccm-core/src/com/arsdigita/kernel/util/KernelGlobalizationUtil.java new file mode 100644 index 000000000..c2e67894f --- /dev/null +++ b/ccm-core/src/com/arsdigita/kernel/util/KernelGlobalizationUtil.java @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2013 Jens Pelzetter + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +package com.arsdigita.kernel.util; + +import com.arsdigita.globalization.GlobalizedMessage; + +/** + * Compilation of methods to simplify the handling of globalizing keys. + * Basically it adds the name of package's resource bundle files to the + * globalize methods and forwards to GlobalizedMessage, shortening the + * method invocation in the various application classes. + * + * @author Alexander Konermann + */ +public class TermsGlobalizationUtil { + + /** Name of Java resource files to handle CMS's globalisation. */ + public static final String BUNDLE_NAME = + "com.arsdigita.kernel.KernelResources"; + + /** + * Returns a globalized message using the package specific bundle, + * provided by BUNDLE_NAME. + */ + public static GlobalizedMessage globalize(final String key) { + return new GlobalizedMessage(key, BUNDLE_NAME); + } + + /** + * Returns a globalized message object, using the package specific bundle, + * as specified by BUNDLE_NAME. Also takes in an Object[] of arguments to + * interpolate into the retrieved message using the MessageFormat class. + */ + public static GlobalizedMessage globalize(final String key, + final Object[] args) { + return new GlobalizedMessage(key, BUNDLE_NAME, args); + } + +}