From 973358bc5dd561fd27a9c411f6f95e104d6344f0 Mon Sep 17 00:00:00 2001 From: tosmers Date: Sun, 15 Feb 2015 18:20:04 +0000 Subject: [PATCH] =?UTF-8?q?[FEATURE]=20Ich=20habe=20das=20Paket=20ccm-port?= =?UTF-8?q?let-bookmarks/=20um=20das=20Paket=20com/arsdigita/portlet/bookm?= =?UTF-8?q?arks/util=20mit=20einer=20GlobalizationUtil.java=20erweitert,?= =?UTF-8?q?=20um=20so=20den=20Gebrauch=20der=20GlobalizationUtil=20im=20Zu?= =?UTF-8?q?sammenhang=20mit=20der=20BookmarkResources.properties=20zu=20er?= =?UTF-8?q?m=C3=B6glichen.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://svn.libreccm.org/ccm/trunk@3205 8810af33-2d31-482b-a856-94f89814c4df --- .../bookmarks/util/GlobalizationUtil.java | 70 +++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 ccm-portlet-bookmarks/src/com/arsdigita/portlet/bookmarks/util/GlobalizationUtil.java diff --git a/ccm-portlet-bookmarks/src/com/arsdigita/portlet/bookmarks/util/GlobalizationUtil.java b/ccm-portlet-bookmarks/src/com/arsdigita/portlet/bookmarks/util/GlobalizationUtil.java new file mode 100644 index 000000000..3a1fa906c --- /dev/null +++ b/ccm-portlet-bookmarks/src/com/arsdigita/portlet/bookmarks/util/GlobalizationUtil.java @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2002-2004 Red Hat Inc. All Rights Reserved. + * + * 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.portlet.bookmarks.util; + +import com.arsdigita.globalization.Globalized; +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 tosmers + * @version $Revision: #1 $ $Date: 2015/02/15 $ + */ +public class GlobalizationUtil implements Globalized { + + /** Name of Java resource files to handle CMS's globalisation. */ + private static final String BUNDLE_NAME = "com.arsdigita.portlet.bookmarks.ui.BookmarkResources"; + + /** + * Returns a globalized message using the package specific bundle, + * provided by BUNDLE_NAME. + * @param key + * @return + */ + public static GlobalizedMessage globalize(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. + * @param key + * @param args + * @return + */ + public static GlobalizedMessage globalize(String key, Object[] args) { + return new GlobalizedMessage(key, BUNDLE_NAME, args); + } + + /** + * Returns the name of the package specific resource bundle. + * + * @return Name of resource bundle as String + */ + public static String getBundleName() { + return BUNDLE_NAME; + } + +} \ No newline at end of file