Die Nutzung von ChainedResourceBundle überall entfernt und auf *.properties umgestellt.

Die Klasse in core zunächst nicht entfernt, als Referenz für die weitere Entwicklung der Globalisierung/Lokalisierung. Die Änderungen sollten auch in 2.0.x übernommen werden.

git-svn-id: https://svn.libreccm.org/ccm/trunk@2144 8810af33-2d31-482b-a856-94f89814c4df
master
pb 2013-04-27 08:17:18 +00:00
parent 04b1f4f28d
commit e0fb729f11
61 changed files with 694 additions and 1224 deletions

View File

@ -18,7 +18,7 @@ package com.arsdigita.cms.contentassets;
import com.arsdigita.globalization.GlobalizedMessage; import com.arsdigita.globalization.GlobalizedMessage;
/** /**
* Service routine tp provide localized versions of key strings for the * Service routine to provide localized versions of key strings for the
* FileAttachment UI and messages. * FileAttachment UI and messages.
* *
* @author pb * @author pb

View File

@ -0,0 +1,2 @@
com.arsdigita.cms.contentassets.image_step_label=Add Images
com.arsdigita.cms.contentassets.image_step_description=Add Images

View File

@ -1,7 +1,22 @@
/* /*
* To change this template, choose Tools | Templates * Copyright (C) 2004-2012 Sören Bernstein, Universität Bremen. All Rights Reserved.
* and open the template in the editor. *
* 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.cms.contentassets.ui; package com.arsdigita.cms.contentassets.ui;
import com.arsdigita.bebop.MapComponentSelectionModel; import com.arsdigita.bebop.MapComponentSelectionModel;
@ -24,15 +39,20 @@ import org.apache.log4j.Logger;
public class ImageComponentAttachListener extends ImageComponentAbstractListener { public class ImageComponentAttachListener extends ImageComponentAbstractListener {
private final ImageStep m_imageStep; private final ImageStep m_imageStep;
private static final Logger s_log = Logger.getLogger(ImageComponentAttachListener.class); private static final Logger s_log = Logger.getLogger(
ImageComponentAttachListener.class);
public ImageComponentAttachListener(MapComponentSelectionModel imageComponent, ImageStep imageStep) { public ImageComponentAttachListener(MapComponentSelectionModel imageComponent,
ImageStep imageStep) {
super(imageComponent); super(imageComponent);
m_imageStep = imageStep; m_imageStep = imageStep;
} }
@Override @Override
protected void processImage(FormSectionEvent event, PageState ps, ImageComponent component, ReusableImageAsset image) { protected void processImage(FormSectionEvent event,
PageState ps,
ImageComponent component,
ReusableImageAsset image) {
ContentItem item = m_imageStep.getItem(ps); ContentItem item = m_imageStep.getItem(ps);
if (null == item) { if (null == item) {
s_log.error("No item selected in ImageStepEdit", s_log.error("No item selected in ImageStepEdit",

View File

@ -44,7 +44,6 @@ import org.apache.log4j.Logger;
* @author unknown * @author unknown
* @author Sören Bernstein (quasimodo) <sbernstein@quasiweb.de> * @author Sören Bernstein (quasimodo) <sbernstein@quasiweb.de>
*/ */
public class ImageStep extends SecurityPropertyEditor { public class ImageStep extends SecurityPropertyEditor {
private static final Logger s_log = Logger.getLogger(ImageStep.class); private static final Logger s_log = Logger.getLogger(ImageStep.class);

View File

@ -1,21 +1,54 @@
/*
* Copyright (C) 2010-2013 Jens Pelzetter 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.cms.contenttypes.ui; package com.arsdigita.cms.contenttypes.ui;
import com.arsdigita.globalization.GlobalizedMessage; 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 Jens Pelzetter * @author Jens Pelzetter
* @version $Id$ * @version $Id$
*/ */
public class PublicPersonalProfileGlobalizationUtil { public class PublicPersonalProfileGlobalizationUtil {
/** Name of Java resource files to handle PPP's globalisation. */
public static final String BUNDLE_NAME = public static final String BUNDLE_NAME =
"com.arsdigita.cms.contenttypes.ui.PublicPersonalProfileResources"; "com.arsdigita.cms.contenttypes.ui.PublicPersonalProfileResources";
/**
* This returns a globalized message using the package specific bundle,
* provided by BUNDLE_NAME.
*/
public static GlobalizedMessage globalize(String key) { public static GlobalizedMessage globalize(String key) {
return new GlobalizedMessage(key, BUNDLE_NAME); 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(String key, Object[] args) { public static GlobalizedMessage globalize(String key, Object[] args) {
return new GlobalizedMessage(key, BUNDLE_NAME, args); return new GlobalizedMessage(key, BUNDLE_NAME, args);
} }

View File

@ -18,22 +18,23 @@
*/ */
package com.arsdigita.cms.contenttypes.util; package com.arsdigita.cms.contenttypes.util;
import com.arsdigita.globalization.Globalized;
import com.arsdigita.globalization.GlobalizedMessage; import com.arsdigita.globalization.GlobalizedMessage;
/** /**
* <p> * Compilation of methods to simplify the handling of globalizing keys.
* . * Basically it adds the name of package's resource bundle files to the
* Contains methods to simplify globalizing keys * globalize methods and forwards to GlobalizedMessage, shortening the
* </p> * method invocation in the various application classes.
* *
* @author <a href="mailto:randyg@arsdigita.com">randyg@arsdigita.com</a> * @author <a href="mailto:randyg@arsdigita.com">randyg@arsdigita.com</a>
* @version $Revision: #4 $ $Date: 2004/08/17 $ * @version $Revision: #4 $ $Date: 2004/08/17 $
*/ */
public class AgendaGlobalizationUtil implements Globalized {
public class AgendaGlobalizationUtil {
/** Name of Java resource files to handle Agenda's globalisation. */
final public static String BUNDLE_NAME = final public static String BUNDLE_NAME =
"com.arsdigita.cms.contenttypes.util.AgendaResourceBundle"; "com.arsdigita.cms.contenttypes.AgendaResources";
/** /**
* This returns a globalized message using the type specific bundle, * This returns a globalized message using the type specific bundle,
@ -44,8 +45,9 @@ public class AgendaGlobalizationUtil {
} }
/** /**
* This returns a globalized message using the type specific bundle, * Returns a globalized message object, using the package specific bundle,
* BUNDLE_NAME * 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(String key, Object[] args) { public static GlobalizedMessage globalize(String key, Object[] args) {
return new GlobalizedMessage(key, BUNDLE_NAME, args); return new GlobalizedMessage(key, BUNDLE_NAME, args);

View File

@ -1,39 +0,0 @@
/*
* Copyright (C) 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.cms.contenttypes.util;
import java.util.PropertyResourceBundle;
import com.arsdigita.globalization.ChainedResourceBundle;
import com.arsdigita.cms.util.CMSGlobalized;
/**
* Form to edit the basic properties of an event. This form can be extended to
* create forms for Event subclasses.
**/
public class AgendaResourceBundle extends ChainedResourceBundle implements CMSGlobalized {
public final static String AGENDA_BUNDLE_NAME =
"com.arsdigita.cms.contenttypes.AgendaResources";
public AgendaResourceBundle() {
super();
addBundle((PropertyResourceBundle)getBundle(AGENDA_BUNDLE_NAME));
addBundle((PropertyResourceBundle)getBundle(BUNDLE_NAME));
}
}

View File

@ -0,0 +1,2 @@
article.authoring.image.title=Bild
article.authoring.image.description=Bild

View File

@ -18,23 +18,38 @@
*/ */
package com.arsdigita.cms.contenttypes; package com.arsdigita.cms.contenttypes;
import com.arsdigita.globalization.Globalized;
import com.arsdigita.globalization.GlobalizedMessage; import com.arsdigita.globalization.GlobalizedMessage;
/** /**
* Miscellaneous utility methods for the Decision Tree content type. * 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 Carsten Clasohm * @author Carsten Clasohm
* @version $Id$ * @version $Id$
*/ */
public class DecisionTreeUtil { public class DecisionTreeUtil implements Globalized {
/** Name of Java resource files to handle DecisionTree's globalisation. */
public static final String BUNDLE_NAME = public static final String BUNDLE_NAME =
"com.arsdigita.camden.cms.contenttypes.DecisionTreeResources"; "com.arsdigita.cms.contenttypes.DecisionTreeResources";
/**
* This returns a globalized message using the package specific bundle,
* provided by BUNDLE_NAME.
*/
public static GlobalizedMessage globalize(String key) { public static GlobalizedMessage globalize(String key) {
return new GlobalizedMessage(key, BUNDLE_NAME); 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(String key, Object[] args) { public static GlobalizedMessage globalize(String key, Object[] args) {
return new GlobalizedMessage(key, BUNDLE_NAME, args); return new GlobalizedMessage(key, BUNDLE_NAME, args);
} }

View File

@ -19,34 +19,37 @@
package com.arsdigita.cms.contenttypes.util; package com.arsdigita.cms.contenttypes.util;
import com.arsdigita.globalization.Globalized;
import com.arsdigita.globalization.GlobalizedMessage; import com.arsdigita.globalization.GlobalizedMessage;
/** /**
* <p> * Compilation of methods to simplify the handling of globalizing keys.
* Contains methods to simplify globalizing keys * Basically it adds the name of package's resource bundle files to the
* </p> * globalize methods and forwards to GlobalizedMessage, shortening the
* method invocation in the various application classes.
* *
* @author <a href="mailto:randyg@arsdigita.com">randyg@arsdigita.com</a> * @author <a href="mailto:randyg@arsdigita.com">randyg@arsdigita.com</a>
* @version $Revision: #4 $ $Date: 2004/08/17 $ * @version $Revision: #4 $ $Date: 2004/08/17 $
*/ */
public class EventGlobalizationUtil { public class EventGlobalizationUtil implements Globalized {
/** Name of the Java class to handle Event's globalisation. */ /** Name of Java resource files to handle CMS's globalisation. */
final public static String BUNDLE_NAME = final public static String BUNDLE_NAME =
"com.arsdigita.cms.contenttypes.util.EventResourceBundle"; "com.arsdigita.cms.contenttypes.EventResourceBundle";
/** /**
* This returns a globalized message using the type specific bundle, * This returns a globalized message using the package specific bundle,
* BUNDLE_NAME * provided by BUNDLE_NAME.
*/ */
public static GlobalizedMessage globalize(String key) { public static GlobalizedMessage globalize(String key) {
return new GlobalizedMessage(key, BUNDLE_NAME); return new GlobalizedMessage(key, BUNDLE_NAME);
} }
/** /**
* This returns a globalized message using the type specific bundle, * Returns a globalized message object, using the package specific bundle,
* BUNDLE_NAME * 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(String key, Object[] args) { public static GlobalizedMessage globalize(String key, Object[] args) {
return new GlobalizedMessage(key, BUNDLE_NAME, args); return new GlobalizedMessage(key, BUNDLE_NAME, args);

View File

@ -1,42 +0,0 @@
/*
* Copyright (C) 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.cms.contenttypes.util;
import com.arsdigita.cms.util.CMSGlobalized;
import com.arsdigita.globalization.ChainedResourceBundle;
import java.util.PropertyResourceBundle;
/**
* Resource Bundle used in UI for Event ContentType.
*
* @author Shashin Shinde (sshinde@redhat.com)
*/
public class EventResourceBundle extends ChainedResourceBundle
implements CMSGlobalized {
public final static String EVENT_BUNDLE_NAME =
"com.arsdigita.cms.contenttypes.EventResources";
public EventResourceBundle() {
super();
addBundle((PropertyResourceBundle)getBundle(EVENT_BUNDLE_NAME));
addBundle((PropertyResourceBundle)getBundle(BUNDLE_NAME));
}
}

View File

@ -0,0 +1,4 @@
faq_item.authoring.basic_properties.description=Frage und Antwort bearbeiten
cms.contenttypes.ui.faq.question=Frage:
cms.contenttypes.ui.faq.answer=Antwort:
cms.contenttypes.ui.faq.sectionName=Abschnitt

View File

@ -18,34 +18,37 @@
*/ */
package com.arsdigita.cms.contenttypes.util; package com.arsdigita.cms.contenttypes.util;
import com.arsdigita.globalization.Globalized;
import com.arsdigita.globalization.GlobalizedMessage; import com.arsdigita.globalization.GlobalizedMessage;
/** /**
* <p> * Compilation of methods to simplify the handling of globalizing keys.
* . * Basically it adds the name of package's resource bundle files to the
* Contains methods to simplify globalizing keys * globalize methods and forwards to GlobalizedMessage, shortening the
* </p> * method invocation in the various application classes.
* *
* @author <a href="mailto:randyg@arsdigita.com">randyg@arsdigita.com</a> * @author <a href="mailto:randyg@arsdigita.com">randyg@arsdigita.com</a>
* @version $Revision: #4 $ $Date: 2004/08/17 $ * @version $Revision: #4 $ $Date: 2004/08/17 $
*/ */
public class FAQGlobalizationUtil { public class FAQGlobalizationUtil implements Globalized {
/** Name of Java resource files to handle FAQ's globalisation. */
final public static String BUNDLE_NAME = final public static String BUNDLE_NAME =
"com.arsdigita.cms.contenttypes.util.FAQResourceBundle"; "com.arsdigita.cms.contenttypes.FAQItemResources";
/** /**
* This returns a globalized message using the type specific bundle, * This returns a globalized message using the package specific bundle,
* BUNDLE_NAME * provided by BUNDLE_NAME.
*/ */
public static GlobalizedMessage globalize(String key) { public static GlobalizedMessage globalize(String key) {
return new GlobalizedMessage(key, BUNDLE_NAME); return new GlobalizedMessage(key, BUNDLE_NAME);
} }
/** /**
* This returns a globalized message using the type specific bundle, * Returns a globalized message object, using the package specific bundle,
* BUNDLE_NAME * 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(String key, Object[] args) { public static GlobalizedMessage globalize(String key, Object[] args) {
return new GlobalizedMessage(key, BUNDLE_NAME, args); return new GlobalizedMessage(key, BUNDLE_NAME, args);

View File

@ -1,39 +0,0 @@
/*
* Copyright (C) 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.cms.contenttypes.util;
import java.util.PropertyResourceBundle;
import com.arsdigita.globalization.ChainedResourceBundle;
import com.arsdigita.cms.util.CMSGlobalized;
/**
* Form to edit the basic properties of an event. This form can be extended to
* create forms for Event subclasses.
**/
public class FAQResourceBundle extends ChainedResourceBundle implements CMSGlobalized {
public final static String FAQ_BUNDLE_NAME =
"com.arsdigita.cms.contenttypes.FAQItemResources";
public FAQResourceBundle() {
super();
addBundle((PropertyResourceBundle)getBundle(FAQ_BUNDLE_NAME));
addBundle((PropertyResourceBundle)getBundle(BUNDLE_NAME));
}
}

View File

@ -18,34 +18,36 @@
*/ */
package com.arsdigita.cms.contenttypes.util; package com.arsdigita.cms.contenttypes.util;
import com.arsdigita.globalization.Globalized;
import com.arsdigita.globalization.GlobalizedMessage; import com.arsdigita.globalization.GlobalizedMessage;
/** /**
* <p> * Compilation of methods to simplify the handling of globalizing keys.
* . * Basically it adds the name of package's resource bundle files to the
* Contains methods to simplify globalizing keys * globalize methods and forwards to GlobalizedMessage, shortening the
* </p> * method invocation in the various application classes.
* *
* @author <a href="mailto:randyg@arsdigita.com">randyg@arsdigita.com</a> * @author <a href="mailto:randyg@arsdigita.com">randyg@arsdigita.com</a>
* @version $Revision: #4 $ $Date: 2004/08/17 $ * @version $Revision: #4 $ $Date: 2004/08/17 $
*/ */
public class GlossaryGlobalizationUtil implements Globalized {
public class GlossaryGlobalizationUtil {
/** Name of Java resource files to handle Glossary's globalisation. */
final public static String BUNDLE_NAME = final public static String BUNDLE_NAME =
"com.arsdigita.cms.contenttypes.util.GlossaryResourceBundle"; "com.arsdigita.cms.contenttypes.GlossaryResources";
/** /**
* This returns a globalized message using the type specific bundle, * This returns a globalized message using the package specific bundle,
* BUNDLE_NAME * provided by BUNDLE_NAME.
*/ */
public static GlobalizedMessage globalize(String key) { public static GlobalizedMessage globalize(String key) {
return new GlobalizedMessage(key, BUNDLE_NAME); return new GlobalizedMessage(key, BUNDLE_NAME);
} }
/** /**
* This returns a globalized message using the type specific bundle, * Returns a globalized message object, using the package specific bundle,
* BUNDLE_NAME * 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(String key, Object[] args) { public static GlobalizedMessage globalize(String key, Object[] args) {
return new GlobalizedMessage(key, BUNDLE_NAME, args); return new GlobalizedMessage(key, BUNDLE_NAME, args);

View File

@ -1,39 +0,0 @@
/*
* Copyright (C) 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.cms.contenttypes.util;
import java.util.PropertyResourceBundle;
import com.arsdigita.globalization.ChainedResourceBundle;
import com.arsdigita.cms.util.CMSGlobalized;
/**
* Form to edit the basic properties of an event. This form can be extended to
* create forms for Event subclasses.
**/
public class GlossaryResourceBundle extends ChainedResourceBundle implements CMSGlobalized {
public final static String GLOSSARY_BUNDLE_NAME =
"com.arsdigita.cms.contenttypes.GlossaryResources";
public GlossaryResourceBundle() {
super();
addBundle((PropertyResourceBundle)getBundle(GLOSSARY_BUNDLE_NAME));
addBundle((PropertyResourceBundle)getBundle(BUNDLE_NAME));
}
}

View File

@ -18,34 +18,36 @@
*/ */
package com.arsdigita.cms.contenttypes.util; package com.arsdigita.cms.contenttypes.util;
import com.arsdigita.globalization.Globalized;
import com.arsdigita.globalization.GlobalizedMessage; import com.arsdigita.globalization.GlobalizedMessage;
/** /**
* <p> * Compilation of methods to simplify the handling of globalizing keys.
* . * Basically it adds the name of package's resource bundle files to the
* Contains methods to simplify globalizing keys * globalize methods and forwards to GlobalizedMessage, shortening the
* </p> * method invocation in the various application classes.
* *
* @author <a href="mailto:randyg@arsdigita.com">randyg@arsdigita.com</a> * @author <a href="mailto:randyg@arsdigita.com">randyg@arsdigita.com</a>
* @version $Revision: #4 $ $Date: 2004/08/17 $ * @version $Revision: #4 $ $Date: 2004/08/17 $
*/ */
public class HealthCareFacilityGlobalizationUtil implements Globalized {
public class HealthCareFacilityGlobalizationUtil {
/** Name of Java resource files to handle HealthCare's globalisation. */
final public static String BUNDLE_NAME = final public static String BUNDLE_NAME =
"com.arsdigita.cms.contenttypes.util.HealthCareFacilityResourceBundle"; "com.arsdigita.cms.contenttypes.HealthCareFacilityResources";
/** /**
* This returns a globalized message using the type specific bundle, * This returns a globalized message using the package specific bundle,
* BUNDLE_NAME * provided by BUNDLE_NAME.
*/ */
public static GlobalizedMessage globalize(String key) { public static GlobalizedMessage globalize(String key) {
return new GlobalizedMessage(key, BUNDLE_NAME); return new GlobalizedMessage(key, BUNDLE_NAME);
} }
/** /**
* This returns a globalized message using the type specific bundle, * Returns a globalized message object, using the package specific bundle,
* BUNDLE_NAME * 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(String key, Object[] args) { public static GlobalizedMessage globalize(String key, Object[] args) {
return new GlobalizedMessage(key, BUNDLE_NAME, args); return new GlobalizedMessage(key, BUNDLE_NAME, args);

View File

@ -1,39 +0,0 @@
/*
* Copyright (C) 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.cms.contenttypes.util;
import java.util.PropertyResourceBundle;
import com.arsdigita.globalization.ChainedResourceBundle;
import com.arsdigita.cms.util.CMSGlobalized;
/**
* Form to edit the basic properties of an event. This form can be extended to
* create forms for Event subclasses.
**/
public class HealthCareFacilityResourceBundle extends ChainedResourceBundle implements CMSGlobalized {
public final static String HEALTH_CARE_FACILITY_BUNDLE_NAME =
"com.arsdigita.cms.contenttypes.HealthCareFacilityResources";
public HealthCareFacilityResourceBundle() {
super();
addBundle((PropertyResourceBundle)getBundle(HEALTH_CARE_FACILITY_BUNDLE_NAME));
addBundle((PropertyResourceBundle)getBundle(BUNDLE_NAME));
}
}

View File

@ -18,25 +18,34 @@
*/ */
package com.arsdigita.cms.contenttypes.util; package com.arsdigita.cms.contenttypes.util;
import com.arsdigita.globalization.Globalized;
import com.arsdigita.globalization.GlobalizedMessage; import com.arsdigita.globalization.GlobalizedMessage;
public class ImageGlobalizationUtil { /**
* 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.
*
*/
public class ImageGlobalizationUtil implements Globalized {
/** Name of Java resource files to handle CMS's globalisation. */
final public static String BUNDLE_NAME = final public static String BUNDLE_NAME =
"com.arsdigita.cms.contenttypes.util.ImageResourceBundle"; "com.arsdigita.cms.contenttypes.ImageResources";
/** /**
* This returns a globalized message using the type specific bundle, * This returns a globalized message using the package specific bundle,
* BUNDLE_NAME * provided by BUNDLE_NAME.
*/ */
public static GlobalizedMessage globalize(String key) { public static GlobalizedMessage globalize(String key) {
return new GlobalizedMessage(key, BUNDLE_NAME); return new GlobalizedMessage(key, BUNDLE_NAME);
} }
/** /**
* This returns a globalized message using the type specific bundle, * Returns a globalized message object, using the package specific bundle,
* BUNDLE_NAME * 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(String key, Object[] args) { public static GlobalizedMessage globalize(String key, Object[] args) {
return new GlobalizedMessage(key, BUNDLE_NAME, args); return new GlobalizedMessage(key, BUNDLE_NAME, args);

View File

@ -1,38 +0,0 @@
/*
* Copyright (C) 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.cms.contenttypes.util;
import java.util.PropertyResourceBundle;
import com.arsdigita.globalization.ChainedResourceBundle;
import com.arsdigita.cms.util.CMSGlobalized;
/**
* Resource Bundle used in UI for Image ContentType.
*/
public class ImageResourceBundle extends ChainedResourceBundle implements CMSGlobalized {
public final static String IMAGE_BUNDLE_NAME =
"com.arsdigita.cms.contenttypes.ImageResources";
public ImageResourceBundle() {
super();
addBundle((PropertyResourceBundle)getBundle(IMAGE_BUNDLE_NAME));
addBundle((PropertyResourceBundle)getBundle(BUNDLE_NAME));
}
}

View File

@ -33,7 +33,8 @@ import java.math.BigDecimal;
public class Member extends GenericPerson { public class Member extends GenericPerson {
/** Data object type for this domain object */ /** Data object type for this domain object */
public static final String BASE_DATA_OBJECT_TYPE = "com.arsdigita.cms.contenttypes.Member"; public static final String BASE_DATA_OBJECT_TYPE =
"com.arsdigita.cms.contenttypes.Member";
/** /**
* Default constructor. This creates a new (empty) Member. * Default constructor. This creates a new (empty) Member.

View File

@ -19,11 +19,21 @@
package com.arsdigita.cms.contenttypes.util; package com.arsdigita.cms.contenttypes.util;
import com.arsdigita.globalization.Globalized;
import com.arsdigita.globalization.GlobalizedMessage; import com.arsdigita.globalization.GlobalizedMessage;
public class MemberGlobalizationUtil { /**
* 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.
*
*/
public class MemberGlobalizationUtil implements Globalized {
/** Name of Java resource files to handle Member's globalisation. */
final public static String BUNDLE_NAME = final public static String BUNDLE_NAME =
"com.arsdigita.cms.contenttypes.util.MemberResourceBundle"; "com.arsdigita.cms.contenttypes.MemberResources";
public static GlobalizedMessage globalize (String key) { public static GlobalizedMessage globalize (String key) {
return new GlobalizedMessage(key, BUNDLE_NAME); return new GlobalizedMessage(key, BUNDLE_NAME);

View File

@ -1,35 +0,0 @@
/*
* Copyright (C) 2009 Jens Pelzetter, for the Center of Social Politics of the University of Bremen
*
* 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.cms.contenttypes.util;
import java.util.PropertyResourceBundle;
import com.arsdigita.globalization.ChainedResourceBundle;
import com.arsdigita.cms.util.CMSGlobalized;
public class MemberResourceBundle extends ChainedResourceBundle implements CMSGlobalized {
public static final String MEMBER_BUNDLE_NAME =
"com.arsdigita.cms.contenttypes.MemberResources";
public MemberResourceBundle() {
super();
addBundle((PropertyResourceBundle)getBundle(MEMBER_BUNDLE_NAME));
addBundle((PropertyResourceBundle)getBundle(BUNDLE_NAME));
}
}

View File

@ -16,37 +16,41 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* *
*/ */
package com.arsdigita.cms.contenttypes.util; package com.arsdigita.cms.contenttypes.util;
import com.arsdigita.globalization.Globalized;
import com.arsdigita.globalization.GlobalizedMessage; import com.arsdigita.globalization.GlobalizedMessage;
/** /**
* <p> * Compilation of methods to simplify the handling of globalizing keys.
* . * Basically it adds the name of package's resource bundle files to the
* Contains methods to simplify globalizing keys * globalize methods and forwards to GlobalizedMessage, shortening the
* </p> * method invocation in the various application classes.
* *
* @author <a href="mailto:randyg@arsdigita.com">randyg@arsdigita.com</a> * @author <a href="mailto:randyg@arsdigita.com">randyg@arsdigita.com</a>
* @version $Revision: #4 $ $Date: 2004/08/17 $ * @version $Revision: #4 $ $Date: 2004/08/17 $
*/ */
public class MOTDGlobalizationUtil { public class MOTDGlobalizationUtil implements Globalized {
/** Name of Java resource files to handle CMS's globalisation. */
final public static String BUNDLE_NAME = final public static String BUNDLE_NAME =
"com.arsdigita.cms.contenttypes.util.MOTDResourceBundle"; "com.arsdigita.cms.contenttypes.MOTDResources";
/** /**
* This returns a globalized message using the type specific bundle, * This returns a globalized message using the package specific bundle,
* BUNDLE_NAME * provided by BUNDLE_NAME.
*/ */
public static GlobalizedMessage globalize(String key) { public static GlobalizedMessage globalize(String key) {
return new GlobalizedMessage(key, BUNDLE_NAME); return new GlobalizedMessage(key, BUNDLE_NAME);
} }
/** /**
* This returns a globalized message using the type specific bundle, * Returns a globalized message object, using the package specific bundle,
* BUNDLE_NAME * 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(String key, Object[] args) { public static GlobalizedMessage globalize(String key, Object[] args) {
return new GlobalizedMessage(key, BUNDLE_NAME, args); return new GlobalizedMessage(key, BUNDLE_NAME, args);

View File

@ -1,39 +0,0 @@
/*
* Copyright (C) 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.cms.contenttypes.util;
import java.util.PropertyResourceBundle;
import com.arsdigita.globalization.ChainedResourceBundle;
import com.arsdigita.cms.util.CMSGlobalized;
/**
* Form to edit the basic properties of an motd. This form can be extended to
* create forms for Motd subclasses.
**/
public class MOTDResourceBundle extends ChainedResourceBundle implements CMSGlobalized {
public final static String MOTD_BUNDLE_NAME =
"com.arsdigita.cms.contenttypes.MOTDResources";
public MOTDResourceBundle() {
super();
addBundle((PropertyResourceBundle)getBundle(MOTD_BUNDLE_NAME));
addBundle((PropertyResourceBundle)getBundle(BUNDLE_NAME));
}
}

View File

@ -18,34 +18,36 @@
*/ */
package com.arsdigita.cms.contenttypes.util; package com.arsdigita.cms.contenttypes.util;
import com.arsdigita.globalization.Globalized;
import com.arsdigita.globalization.GlobalizedMessage; import com.arsdigita.globalization.GlobalizedMessage;
/** /**
* <p> * Compilation of methods to simplify the handling of globalizing keys.
* . * Basically it adds the name of package's resource bundle files to the
* Contains methods to simplify globalizing keys * globalize methods and forwards to GlobalizedMessage, shortening the
* </p> * method invocation in the various application classes.
* *
* @author <a href="mailto:randyg@arsdigita.com">randyg@arsdigita.com</a> * @author <a href="mailto:randyg@arsdigita.com">randyg@arsdigita.com</a>
* @version $Revision: #4 $ $Date: 2004/08/17 $ * @version $Revision: #4 $ $Date: 2004/08/17 $
*/ */
public class MPArticleGlobalizationUtil implements Globalized {
public class MPArticleGlobalizationUtil {
/** Name of Java resource files to handle CMS's globalisation. */
final public static String BUNDLE_NAME = final public static String BUNDLE_NAME =
"com.arsdigita.cms.contenttypes.util.MultiPartArticleResourceBundle"; "com.arsdigita.cms.contenttypes.MultiPartArticleResources";
/** /**
* This returns a globalized message using the type specific bundle, * This returns a globalized message using the package specific bundle,
* BUNDLE_NAME * provided by BUNDLE_NAME.
*/ */
public static GlobalizedMessage globalize(String key) { public static GlobalizedMessage globalize(String key) {
return new GlobalizedMessage(key, BUNDLE_NAME); return new GlobalizedMessage(key, BUNDLE_NAME);
} }
/** /**
* This returns a globalized message using the type specific bundle, * Returns a globalized message object, using the package specific bundle,
* BUNDLE_NAME * 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(String key, Object[] args) { public static GlobalizedMessage globalize(String key, Object[] args) {
return new GlobalizedMessage(key, BUNDLE_NAME, args); return new GlobalizedMessage(key, BUNDLE_NAME, args);

View File

@ -1,39 +0,0 @@
/*
* Copyright (C) 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.cms.contenttypes.util;
import java.util.PropertyResourceBundle;
import com.arsdigita.globalization.ChainedResourceBundle;
import com.arsdigita.cms.util.CMSGlobalized;
/**
* Form to edit the basic properties of an event. This form can be extended to
* create forms for Event subclasses.
**/
public class MultiPartArticleResourceBundle extends ChainedResourceBundle implements CMSGlobalized {
public final static String MPARTICLE_BUNDLE_NAME =
"com.arsdigita.cms.contenttypes.MultiPartArticleResources";
public MultiPartArticleResourceBundle() {
super();
addBundle((PropertyResourceBundle)getBundle(MPARTICLE_BUNDLE_NAME));
addBundle((PropertyResourceBundle)getBundle(BUNDLE_NAME));
}
}

View File

@ -18,35 +18,38 @@
*/ */
package com.arsdigita.cms.contenttypes.util; package com.arsdigita.cms.contenttypes.util;
import com.arsdigita.globalization.Globalized;
import com.arsdigita.globalization.GlobalizedMessage; import com.arsdigita.globalization.GlobalizedMessage;
/** /**
* <p> * <p>
* . * Compilation of methods to simplify the handling of globalizing keys.
* Contains methods to simplify globalizing keys * Basically it adds the name of package's resource bundle files to the
* </p> * globalize methods and forwards to GlobalizedMessage, shortening the
* method invocation in the various application classes.
* *
* @author <a href="mailto:randyg@arsdigita.com">randyg@arsdigita.com</a> * @author <a href="mailto:randyg@arsdigita.com">randyg@arsdigita.com</a>
* @version $Revision: #4 $ $Date: 2004/08/17 $ * @version $Revision: #4 $ $Date: 2004/08/17 $
*/ */
public class NewsItemGlobalizationUtil implements Globalized {
public class NewsItemGlobalizationUtil {
/** Name of Java resource files to handle NewsItem's globalisation. */
final public static String BUNDLE_NAME = final public static String BUNDLE_NAME =
"com.arsdigita.cms.contenttypes.util.NewsItemResourceBundle"; "com.arsdigita.cms.contenttypes.NewsItemResources";
/** /**
* This returns a globalized message using the type specific bundle, * This returns a globalized message using the package specific bundle,
* BUNDLE_NAME * provided by BUNDLE_NAME.
*/ */
public static GlobalizedMessage globalize(String key) { public static GlobalizedMessage globalize(String key) {
return new GlobalizedMessage(key, BUNDLE_NAME); return new GlobalizedMessage(key, BUNDLE_NAME);
} }
/** /**
* This returns a globalized message using the type specific bundle, * Returns a globalized message object, using the package specific bundle,
* BUNDLE_NAME * 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(String key, Object[] args) { public static GlobalizedMessage globalize(String key, Object[] args) {
return new GlobalizedMessage(key, BUNDLE_NAME, args); return new GlobalizedMessage(key, BUNDLE_NAME, args);

View File

@ -1,41 +0,0 @@
/*
* Copyright (C) 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.cms.contenttypes.util;
import java.util.PropertyResourceBundle;
import com.arsdigita.globalization.ChainedResourceBundle;
import com.arsdigita.cms.util.CMSGlobalized;
/**
* Resource Bundle used in UI for Newsitem ContentType.
*
* @author Shashin Shinde <a href="mailto:sshinde@redhat.com">sshinde@redhat.com</a>
*
*/
public class NewsItemResourceBundle extends ChainedResourceBundle implements CMSGlobalized {
public final static String NEWSITEM_BUNDLE_NAME =
"com.arsdigita.cms.contenttypes.NewsItemResources";
public NewsItemResourceBundle() {
super();
addBundle((PropertyResourceBundle)getBundle(NEWSITEM_BUNDLE_NAME));
addBundle((PropertyResourceBundle)getBundle(BUNDLE_NAME));
}
}

View File

@ -18,34 +18,36 @@
*/ */
package com.arsdigita.cms.contenttypes.util; package com.arsdigita.cms.contenttypes.util;
import com.arsdigita.globalization.Globalized;
import com.arsdigita.globalization.GlobalizedMessage; import com.arsdigita.globalization.GlobalizedMessage;
/** /**
* <p> * Compilation of methods to simplify the handling of globalizing keys.
* . * Basically it adds the name of package's resource bundle files to the
* Contains methods to simplify globalizing keys * globalize methods and forwards to GlobalizedMessage, shortening the
* </p> * method invocation in the various application classes.
* *
* @author <a href="mailto:randyg@arsdigita.com">randyg@arsdigita.com</a> * @author <a href="mailto:randyg@arsdigita.com">randyg@arsdigita.com</a>
* @version $Revision: #4 $ $Date: 2004/08/17 $ * @version $Revision: #4 $ $Date: 2004/08/17 $
*/ */
public class OrganizationGlobalizationUtil implements Globalized {
public class OrganizationGlobalizationUtil {
/** Name of Java resource files to handle CMS's globalisation. */
final public static String BUNDLE_NAME = final public static String BUNDLE_NAME =
"com.arsdigita.cms.contenttypes.util.OrganizationResourceBundle"; "com.arsdigita.cms.contenttypes.OrganizationResources";
/** /**
* This returns a globalized message using the type specific bundle, * This returns a globalized message using the package specific bundle,
* BUNDLE_NAME * provided by BUNDLE_NAME.
*/ */
public static GlobalizedMessage globalize(String key) { public static GlobalizedMessage globalize(String key) {
return new GlobalizedMessage(key, BUNDLE_NAME); return new GlobalizedMessage(key, BUNDLE_NAME);
} }
/** /**
* This returns a globalized message using the type specific bundle, * Returns a globalized message object, using the package specific bundle,
* BUNDLE_NAME * 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(String key, Object[] args) { public static GlobalizedMessage globalize(String key, Object[] args) {
return new GlobalizedMessage(key, BUNDLE_NAME, args); return new GlobalizedMessage(key, BUNDLE_NAME, args);

View File

@ -1,39 +0,0 @@
/*
* Copyright (C) 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.cms.contenttypes.util;
import java.util.PropertyResourceBundle;
import com.arsdigita.globalization.ChainedResourceBundle;
import com.arsdigita.cms.util.CMSGlobalized;
/**
* Form to edit the basic properties of an event. This form can be extended to
* create forms for Event subclasses.
**/
public class OrganizationResourceBundle extends ChainedResourceBundle implements CMSGlobalized {
public final static String ORGANIZATION_BUNDLE_NAME =
"com.arsdigita.cms.contenttypes.OrganizationResources";
public OrganizationResourceBundle() {
super();
addBundle((PropertyResourceBundle)getBundle(ORGANIZATION_BUNDLE_NAME));
addBundle((PropertyResourceBundle)getBundle(BUNDLE_NAME));
}
}

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2009 Jens Pelzetter, for the Center of Social Politics of the University of Bremen * Copyright (C) 2009 Jens Pelzetter, Center of Social Politic Research, University of Bremen
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License * modify it under the terms of the GNU Lesser General Public License
@ -19,17 +19,36 @@
package com.arsdigita.cms.contenttypes.util; package com.arsdigita.cms.contenttypes.util;
import com.arsdigita.globalization.Globalized;
import com.arsdigita.globalization.GlobalizedMessage; import com.arsdigita.globalization.GlobalizedMessage;
public class PersonGlobalizationUtil { /**
final public static String BUNDLE_NAME = * Compilation of methods to simplify the handling of globalizing keys.
"com.arsdigita.cms.contenttypes.util.PersonResourceBundle"; * 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.
*
*/
public class PersonGlobalizationUtil implements Globalized {
/** Name of Java resource files to handle CMS's globalisation. */
final public static String BUNDLE_NAME =
"com.arsdigita.cms.contenttypes.PersonResources";
/**
* Returns a globalized message using the package specific bundle,
* provided by BUNDLE_NAME.
*/
public static GlobalizedMessage globalize (String key) { public static GlobalizedMessage globalize (String key) {
return new GlobalizedMessage(key, BUNDLE_NAME); 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 (String key, Object[] args) { public static GlobalizedMessage globalize (String key, Object[] args) {
return new GlobalizedMessage(key, BUNDLE_NAME, args); return new GlobalizedMessage(key, BUNDLE_NAME, args);
} }
} }

View File

@ -1,35 +0,0 @@
/*
* Copyright (C) 2009 Jens Pelzetter, for the Center of Social Politics of the University of Bremen
*
* 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.cms.contenttypes.util;
import java.util.PropertyResourceBundle;
import com.arsdigita.globalization.ChainedResourceBundle;
import com.arsdigita.cms.util.CMSGlobalized;
public class PersonResourceBundle extends ChainedResourceBundle implements CMSGlobalized {
public static final String PERSON_BUNDLE_NAME =
"com.arsdigita.cms.contenttypes.PersonResources";
public PersonResourceBundle() {
super();
addBundle((PropertyResourceBundle)getBundle(PERSON_BUNDLE_NAME));
addBundle((PropertyResourceBundle)getBundle(BUNDLE_NAME));
}
}

View File

@ -1,27 +1,53 @@
/*
* Copyright (C) 2010-2013 Jens Pelzetter, University of Bremen. 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.cms.contenttypes; package com.arsdigita.cms.contenttypes;
import com.arsdigita.globalization.Globalized;
import com.arsdigita.globalization.GlobalizedMessage; 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 Jens Pelzetter <jens@jp-digital.de> * @author Jens Pelzetter <jens@jp-digital.de>
*/ */
public class ResearchNetworkGlobalizationUtil { public class ResearchNetworkGlobalizationUtil implements Globalized {
/** Name of Java resource files to handle CMS's globalisation. */
final public static String BUNDLE_NAME = final public static String BUNDLE_NAME =
"com.arsdigita.cms.contenttypes.ResearchNetworkResourceBundle"; "com.arsdigita.cms.contenttypes.ResearchNetworkResources";
/** /**
* This returns a globalized message using the type specific bundle, * Returns a globalized message using the package specific bundle,
* BUNDLE_NAME * provided by BUNDLE_NAME.
*/ */
public static GlobalizedMessage globalize(String key) { public static GlobalizedMessage globalize(String key) {
return new GlobalizedMessage(key, BUNDLE_NAME); return new GlobalizedMessage(key, BUNDLE_NAME);
} }
/** /**
* This returns a globalized message using the type specific bundle, * Returns a globalized message object, using the package specific bundle,
* BUNDLE_NAME * 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(String key, Object[] args) { public static GlobalizedMessage globalize(String key, Object[] args) {
return new GlobalizedMessage(key, BUNDLE_NAME, args); return new GlobalizedMessage(key, BUNDLE_NAME, args);

View File

@ -1,22 +0,0 @@
package com.arsdigita.cms.contenttypes;
import com.arsdigita.cms.util.CMSGlobalized;
import com.arsdigita.globalization.ChainedResourceBundle;
import java.util.PropertyResourceBundle;
/**
*
* @author Jens Pelzetter <jens@jp-digital.de>
*/
public class ResearchNetworkResourceBundle extends ChainedResourceBundle implements CMSGlobalized {
public final static String RESEARCH_NETWORK_BUNDLE_NAME =
"com.arsdigita.cms.contenttypes.ResearchNetworkResources";
public ResearchNetworkResourceBundle() {
super();
addBundle((PropertyResourceBundle)getBundle(RESEARCH_NETWORK_BUNDLE_NAME));
addBundle((PropertyResourceBundle)getBundle(BUNDLE_NAME));
}
}

View File

@ -18,34 +18,36 @@
*/ */
package com.arsdigita.cms.contenttypes.util; package com.arsdigita.cms.contenttypes.util;
import com.arsdigita.globalization.Globalized;
import com.arsdigita.globalization.GlobalizedMessage; import com.arsdigita.globalization.GlobalizedMessage;
/** /**
* <p> * Compilation of methods to simplify the handling of globalizing keys.
* . * Basically it adds the name of package's resource bundle files to the
* Contains methods to simplify globalizing keys * globalize methods and forwards to GlobalizedMessage, shortening the
* </p> * method invocation in the various application classes.
* *
* @author <a href="mailto:randyg@arsdigita.com">randyg@arsdigita.com</a> * @author <a href="mailto:randyg@arsdigita.com">randyg@arsdigita.com</a>
* @version $Revision: #4 $ $Date: 2004/08/17 $ * @version $Revision: #4 $ $Date: 2004/08/17 $
*/ */
public class SimpleAddressGlobalizationUtil implements Globalized {
public class SimpleAddressGlobalizationUtil {
/** Name of Java resource files to handle CMS's globalisation. */
final public static String BUNDLE_NAME = final public static String BUNDLE_NAME =
"com.arsdigita.cms.contenttypes.util.SimpleAddressResourceBundle"; "com.arsdigita.cms.contenttypes.SimpleAddressResources";
/** /**
* This returns a globalized message using the type specific bundle, * Returns a globalized message using the package specific bundle,
* BUNDLE_NAME * provided by BUNDLE_NAME.
*/ */
public static GlobalizedMessage globalize(String key) { public static GlobalizedMessage globalize(String key) {
return new GlobalizedMessage(key, BUNDLE_NAME); return new GlobalizedMessage(key, BUNDLE_NAME);
} }
/** /**
* This returns a globalized message using the type specific bundle, * Returns a globalized message object, using the package specific bundle,
* BUNDLE_NAME * 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(String key, Object[] args) { public static GlobalizedMessage globalize(String key, Object[] args) {
return new GlobalizedMessage(key, BUNDLE_NAME, args); return new GlobalizedMessage(key, BUNDLE_NAME, args);

View File

@ -1,42 +0,0 @@
/*
* Copyright (C) 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.cms.contenttypes.util;
import java.util.PropertyResourceBundle;
import com.arsdigita.globalization.ChainedResourceBundle;
import com.arsdigita.cms.util.CMSGlobalized;
/**
* Resource Bundle used in UI for Address ContentType.
*
* @author Shashin Shinde <a href="mailto:sshinde@redhat.com">sshinde@redhat.com</a>
*
*/
public class SimpleAddressResourceBundle extends ChainedResourceBundle
implements CMSGlobalized {
public final static String ADDRESS_BUNDLE_NAME =
"com.arsdigita.cms.contenttypes.SimpleAddressResources";
public SimpleAddressResourceBundle() {
super();
addBundle((PropertyResourceBundle)getBundle(ADDRESS_BUNDLE_NAME));
addBundle((PropertyResourceBundle)getBundle(BUNDLE_NAME));
}
}

View File

@ -18,35 +18,36 @@
*/ */
package com.arsdigita.cms.contenttypes.util; package com.arsdigita.cms.contenttypes.util;
import com.arsdigita.globalization.Globalized;
import com.arsdigita.globalization.GlobalizedMessage; import com.arsdigita.globalization.GlobalizedMessage;
/** /**
* <p> * Compilation of methods to simplify the handling of globalizing keys.
* Contains methods to simplify globalizing keys related to SiteProxy * Basically it adds the name of package's resource bundle files to the
* ContentType object. * globalize methods and forwards to GlobalizedMessage, shortening the
* </p> * method invocation in the various application classes.
* *
* @author Shashin Shinde <a href="mailto:sshinde@redhat.com">sshinde@redhat.com</a> * @author Shashin Shinde <a href="mailto:sshinde@redhat.com">sshinde@redhat.com</a>
*
* @version $Id: SiteProxyGlobalizationUtil.java 287 2005-02-22 00:29:02Z sskracic $ * @version $Id: SiteProxyGlobalizationUtil.java 287 2005-02-22 00:29:02Z sskracic $
*
*/ */
public class SiteProxyGlobalizationUtil { public class SiteProxyGlobalizationUtil implements Globalized {
/** Name of Java resource files to handle CMS's globalisation. */
final public static String BUNDLE_NAME = final public static String BUNDLE_NAME =
"com.arsdigita.cms.contenttypes.util.SiteProxyResourceBundle"; "com.arsdigita.cms.contenttypes.SiteProxyResources";
/** /**
* This returns a globalized message using the type specific bundle, * Returns a globalized message using the package specific bundle,
* BUNDLE_NAME * provided by BUNDLE_NAME.
*/ */
public static GlobalizedMessage globalize(String key) { public static GlobalizedMessage globalize(String key) {
return new GlobalizedMessage(key, BUNDLE_NAME); return new GlobalizedMessage(key, BUNDLE_NAME);
} }
/** /**
* This returns a globalized message using the type specific bundle, * Returns a globalized message object, using the package specific bundle,
* BUNDLE_NAME * 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(String key, Object[] args) { public static GlobalizedMessage globalize(String key, Object[] args) {
return new GlobalizedMessage(key, BUNDLE_NAME, args); return new GlobalizedMessage(key, BUNDLE_NAME, args);

View File

@ -1,47 +0,0 @@
/*
* Copyright (C) 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.cms.contenttypes.util;
import java.util.PropertyResourceBundle;
import com.arsdigita.globalization.ChainedResourceBundle;
import com.arsdigita.cms.util.CMSGlobalized;
/**
*
* Resource Bundle used in UI for SiteProxy ContentType.
*
* @author Shashin Shinde <a href="mailto:sshinde@redhat.com">sshinde@redhat.com</a>
*
* @version $Id: SiteProxyResourceBundle.java 287 2005-02-22 00:29:02Z sskracic $
*
*/
public class SiteProxyResourceBundle extends ChainedResourceBundle implements CMSGlobalized {
public final static String CONTACT_BUNDLE_NAME =
"com.arsdigita.cms.contenttypes.SiteProxyResources";
public SiteProxyResourceBundle() {
super();
addBundle((PropertyResourceBundle)getBundle(CONTACT_BUNDLE_NAME));
addBundle((PropertyResourceBundle)getBundle(BUNDLE_NAME));
}
}

View File

@ -1,31 +1,53 @@
/*
* Copyright (C) 2011 Sören Bernstein, University of Brfemen. 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.cms.contenttypes.util; package com.arsdigita.cms.contenttypes.util;
import com.arsdigita.globalization.Globalized;
import com.arsdigita.globalization.GlobalizedMessage; import com.arsdigita.globalization.GlobalizedMessage;
/** /**
* <p> * Compilation of methods to simplify the handling of globalizing keys.
* . * Basically it adds the name of package's resource bundle files to the
* Contains methods to simplify globalizing keys * globalize methods and forwards to GlobalizedMessage, shortening the
* </p> * method invocation in the various application classes.
* *
* @author Sören Bernstein * @author Sören Bernstein
*/ */
public class SurveyGlobalizationUtil { public class SurveyGlobalizationUtil implements Globalized {
/** Name of Java resource files to handle CMS's globalisation. */
final public static String BUNDLE_NAME = final public static String BUNDLE_NAME =
"com.arsdigita.cms.contenttypes.util.SurveyResourceBundle"; "com.arsdigita.cms.contenttypes.SurveyResources";
/** /**
* This returns a globalized message using the type specific bundle, * Returns a globalized message using the package specific bundle,
* BUNDLE_NAME * provided by BUNDLE_NAME.
*/ */
public static GlobalizedMessage globalize(String key) { public static GlobalizedMessage globalize(String key) {
return new GlobalizedMessage(key, BUNDLE_NAME); return new GlobalizedMessage(key, BUNDLE_NAME);
} }
/** /**
* This returns a globalized message using the type specific bundle, * Returns a globalized message object, using the package specific bundle,
* BUNDLE_NAME * 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(String key, Object[] args) { public static GlobalizedMessage globalize(String key, Object[] args) {
return new GlobalizedMessage(key, BUNDLE_NAME, args); return new GlobalizedMessage(key, BUNDLE_NAME, args);

View File

@ -1,17 +0,0 @@
package com.arsdigita.cms.contenttypes.util;
import java.util.PropertyResourceBundle;
import com.arsdigita.globalization.ChainedResourceBundle;
import com.arsdigita.cms.util.CMSGlobalized;
public class SurveyResourceBundle extends ChainedResourceBundle implements CMSGlobalized {
public final static String SURVEY_BUNDLE_NAME =
"com.arsdigita.cms.contenttypes.SurveyResources";
public SurveyResourceBundle() {
super();
addBundle((PropertyResourceBundle) getBundle(SURVEY_BUNDLE_NAME));
addBundle((PropertyResourceBundle) getBundle(BUNDLE_NAME));
}
}

View File

@ -19,17 +19,38 @@
package com.arsdigita.cms.contenttypes.util; package com.arsdigita.cms.contenttypes.util;
import com.arsdigita.globalization.Globalized;
import com.arsdigita.globalization.GlobalizedMessage; import com.arsdigita.globalization.GlobalizedMessage;
public class ContenttypesGlobalizationUtil { /**
* 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 <a href="mailto:randyg@arsdigita.com">randyg@arsdigita.com</a>
* @version $Revision: #4 $ $Date: 2004/08/17 $
*/
public class ContenttypesGlobalizationUtil implements Globalized {
/** Name of Java resource files to handle CMS's globalisation. */
final public static String BUNDLE_NAME = final public static String BUNDLE_NAME =
"com.arsdigita.cms.contenttypes.util.ContenttypesResourceBundle"; "com.arsdigita.cms.contenttypes.ContenttypesResources";
/**
* Returns a globalized message using the package specific bundle,
* provided by BUNDLE_NAME.
*/
public static GlobalizedMessage globalize (String key) { public static GlobalizedMessage globalize (String key) {
return new GlobalizedMessage(key, BUNDLE_NAME); 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 (String key, Object[] args) { public static GlobalizedMessage globalize (String key, Object[] args) {
return new GlobalizedMessage(key, BUNDLE_NAME, args); return new GlobalizedMessage(key, BUNDLE_NAME, args);
} }
} }

View File

@ -23,6 +23,15 @@ import java.util.PropertyResourceBundle;
import com.arsdigita.globalization.ChainedResourceBundle; import com.arsdigita.globalization.ChainedResourceBundle;
import com.arsdigita.cms.util.CMSGlobalized; import com.arsdigita.cms.util.CMSGlobalized;
// Developers Note (2013-04):
// No longer used because we found no way to make localization work properly.
// Back to use plain property files as of 2013-04 (version 6.6.8)
// Retained for easy reference to further develop localization infrastructure.
public class ContenttypesResourceBundle extends ChainedResourceBundle implements CMSGlobalized { public class ContenttypesResourceBundle extends ChainedResourceBundle implements CMSGlobalized {
public static final String MEMBER_BUNDLE_NAME = public static final String MEMBER_BUNDLE_NAME =
"com.arsdigita.cms.contenttypes.ContenttypesResources"; "com.arsdigita.cms.contenttypes.ContenttypesResources";

View File

@ -42,7 +42,7 @@ import java.math.BigDecimal;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
/** /**
* Displays a list of all language instances of an item. * Displays a list of all language instances of an item.
* *
*/ */
public class ItemLanguagesTable extends DataTable { public class ItemLanguagesTable extends DataTable {

View File

@ -23,6 +23,13 @@ import com.arsdigita.globalization.ChainedResourceBundle;
import java.util.PropertyResourceBundle; import java.util.PropertyResourceBundle;
import java.util.ResourceBundle; import java.util.ResourceBundle;
// Developers Note (2013-04):
// No longer used because we found no way to make localization work properly.
// Back to use plain property files as of 2013-04 (version 6.6.8)
// Retained for easy reference to further develop localization infrastructure.
/** /**
* Main ResourceBundle for CMS UI. * Main ResourceBundle for CMS UI.
* Can be extended using: * Can be extended using:
@ -34,6 +41,9 @@ public class CMSResourceBundle extends ChainedResourceBundle implements CMSGloba
public CMSResourceBundle() { public CMSResourceBundle() {
super(); super();
// addBundle((PropertyResourceBundle) getBundle(BUNDLE_NAME));
// try to make proper localisation work, no success, ne regression either
addBundle((PropertyResourceBundle) getBundle(BUNDLE_NAME, addBundle((PropertyResourceBundle) getBundle(BUNDLE_NAME,
ResourceBundle.Control.getNoFallbackControl( ResourceBundle.Control.getNoFallbackControl(
ResourceBundle.Control.FORMAT_DEFAULT))); ResourceBundle.Control.FORMAT_DEFAULT)));

View File

@ -1,10 +0,0 @@
package com.arsdigita.cms.util;
/**
*
* @author Jens Pelzetter <jens@jp-digital.de>
* @version $Id$
*/
public class CMSResourceBundle_de extends CMSResourceBundle {
}

View File

@ -1,10 +0,0 @@
package com.arsdigita.cms.util;
/**
*
* @author Jens Pelzetter <jens@jp-digital.de>
* @version $Id$
*/
public class CMSResourceBundle_en_GB extends CMSResourceBundle {
}

View File

@ -1,10 +0,0 @@
package com.arsdigita.cms.util;
/**
*
* @author Jens Pelzetter <jens@jp-digital.de>
* @version $Id$
*/
public class CMSResourceBundle_fr extends CMSResourceBundle {
}

View File

@ -16,58 +16,53 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* *
*/ */
package com.arsdigita.cms.util; package com.arsdigita.cms.util;
import com.arsdigita.globalization.Globalized;
import com.arsdigita.globalization.GlobalizedMessage; import com.arsdigita.globalization.GlobalizedMessage;
/** /**
* <p> * Compilation of methods to simplify the handling of globalizing keys.
* . * Basically it adds the name of package's resource bundle files to the
* Contains methods to simplify globalizing keys * globalize methods and forwards to GlobalizedMessage, shortening the
* </p> * method invocation in the various application classes.
* *
* @author <a href="mailto:yon@arsdigita.com">yon@arsdigita.com</a> * @author <a href="mailto:yon@arsdigita.com">yon@arsdigita.com</a>
* @version $Revision: #7 $ $Date: 2004/08/17 $ * @version $Revision: #7 $ $Date: 2004/08/17 $
*/ */
public class GlobalizationUtil { public class GlobalizationUtil implements Globalized {
/** Name of the Java class to handle CMS's globalisation. */ /** Name of Java resource files to handle CMS's globalisation. */
//public static String s_bundleName = "com.arsdigita.cms.util.CMSResourceBundle"; private static final String BUNDLE_NAME = "com.arsdigita.cms.CMSResources";
public static String s_bundleName = "com.arsdigita.cms.CMSResources";
/** /**
* This returns a globalized message using the package specific bundle, * Returns a globalized message using the package specific bundle,
* provided by method getBundleName() * provided by BUNDLE_NAME.
*/ */
public static GlobalizedMessage globalize(String key) { public static GlobalizedMessage globalize(String key) {
return new GlobalizedMessage(key, getBundleName()); return new GlobalizedMessage(key, BUNDLE_NAME);
} }
/** /**
* Returns a globalized message object, using the package specific bundle, * Returns a globalized message object, using the package specific bundle,
* provided by method getBundleName(). Also takes in an Object[] of * as specified by BUNDLE_NAME. Also takes in an Object[] of arguments to
* arguments to interpolate into the retrieved message using the * interpolate into the retrieved message using the MessageFormat class.
* MessageFormat class.
*/ */
public static GlobalizedMessage globalize(String key, Object[] args) { public static GlobalizedMessage globalize(String key, Object[] args) {
return new GlobalizedMessage(key, getBundleName(), args); return new GlobalizedMessage(key, BUNDLE_NAME, args);
} }
/** /**
* Returns the name of the package specific resource bundle. * Returns the name of the package specific resource bundle.
* @return *
* Used e.g. by com.arsdigita.cms.ui.item.ItemLanguageTable to get the
* bundle tp pass to DataTable.
*
* @return Name of resource bundle as String
*/ */
public static String getBundleName() { public static String getBundleName() {
return s_bundleName; return BUNDLE_NAME;
}
/*
* Not a part of API. Otherwise it would need to be properly synchronized.
* Only meant be used to override resource keys in CMSResources
* by a custom application, in Initializer.
*/
public static void internalSetBundleName(String bundleName) {
s_bundleName = bundleName;
} }
} }

View File

@ -0,0 +1,81 @@
/*
* 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.cms.util;
import com.arsdigita.globalization.GlobalizedMessage;
// Developers Note:
// Counterpart to CMSResourceBundle java class.
// No longer used because we couldn't find a way to make proper localization
// work.
// Retained for easy reference to further develop localization infrastructure.
/**
* <p>
* .
* Contains methods to simplify globalizing keys
* </p>
*
* @author <a href="mailto:yon@arsdigita.com">yon@arsdigita.com</a>
* @version $Revision: #7 $ $Date: 2004/08/17 $
*/
public class GlobalizationUtilOld {
/** Name of the Java class to handle CMS's globalisation. */
//public static String s_bundleName = "com.arsdigita.cms.util.CMSResourceBundle";
public static String s_bundleName = "com.arsdigita.cms.CMSResources";
/**
* This returns a globalized message using the package specific bundle,
* provided by method getBundleName()
*/
public static GlobalizedMessage globalize(String key) {
return new GlobalizedMessage(key, getBundleName());
}
/**
* Returns a globalized message object, using the package specific bundle,
* provided by method getBundleName(). Also takes in an Object[] of
* arguments to interpolate into the retrieved message using the
* MessageFormat class.
*/
public static GlobalizedMessage globalize(String key, Object[] args) {
return new GlobalizedMessage(key, getBundleName(), args);
}
/**
* Returns the name of the package specific resource bundle.
* @return
*/
public static String getBundleName() {
return s_bundleName;
}
/*
* Not a part of API. Otherwise it would need to be properly synchronized.
* Only meant be used to override resource keys in CMSResources
* by a custom application, in Initializer.
*/
public static void internalSetBundleName(String bundleName) {
s_bundleName = bundleName;
}
}

View File

@ -16,6 +16,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* *
*/ */
package com.arsdigita.globalization; package com.arsdigita.globalization;
import java.util.Enumeration; import java.util.Enumeration;
@ -39,10 +40,9 @@ public interface ChainableResourceBundle {
public Object handleGetObject(String key); public Object handleGetObject(String key);
/** /**
* This is the public version of ResourceBundle.getKeys() * This is the public version of ResourceBundle.getKeys() which normally has
* which normally has protected access. If you have a PropertyResourceBundle * protected access. If you have a PropertyResourceBundle or a
* or a ListResourceBundle, this will simply delegate to the * ListResourceBundle, this will simply delegate to the getKeys() method.
* getKeys() method.
* *
* @return * @return
*/ */

View File

@ -16,6 +16,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* *
*/ */
package com.arsdigita.globalization; package com.arsdigita.globalization;
import java.util.Collections; import java.util.Collections;
@ -27,6 +28,14 @@ import java.util.ListResourceBundle;
import java.util.PropertyResourceBundle; import java.util.PropertyResourceBundle;
import java.util.ResourceBundle; import java.util.ResourceBundle;
// Developers Note (2013-04):
// No longer used because we found no way to make localization work properly.
// Back to use plain property files as of 2013-04 (version 6.6.8)
// Retained for easy reference to further develop localization infrastructure.
// Should be completely removed in the future.
/** /**
* This is a ResourceBundle that allows the developer to add additional * This is a ResourceBundle that allows the developer to add additional
* ChainableResourceBundles to it. Then, when the bundle is asked for * ChainableResourceBundles to it. Then, when the bundle is asked for
@ -47,6 +56,9 @@ public class ChainedResourceBundle extends ResourceBundle {
private final List<ChainableResourceBundle> bundles; private final List<ChainableResourceBundle> bundles;
private final List<String> keys; private final List<String> keys;
/**
* Constructor to create a new ChainedResourceBundle.
*/
public ChainedResourceBundle() { public ChainedResourceBundle() {
super(); super();
bundles = new LinkedList<ChainableResourceBundle>(); bundles = new LinkedList<ChainableResourceBundle>();

View File

@ -1,162 +0,0 @@
/*
* Copyright (C) 2001-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.globalization;
import com.arsdigita.initializer.Configuration;
import com.arsdigita.initializer.InitializationException;
import com.arsdigita.persistence.DataCollection;
import com.arsdigita.persistence.SessionManager;
import com.arsdigita.persistence.TransactionContext;
import java.io.ByteArrayOutputStream;
import java.io.OutputStreamWriter;
import java.io.UnsupportedEncodingException;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.apache.log4j.Logger;
/**
* Initialize the Globalization package
*
* Old initializer system. Needs LegacyInitializer as glue to invoke.
*
* @version $Revision: #15 $ $Date: 2004/08/16 $
*/
public class LegacyInitializer implements com.arsdigita.initializer.Initializer {
private static final String DEFAULT_CHARSET = "defaultCharset";
private static final String CHARSETS = "charsets";
private static final String LOCALES = "locales";
private static final Logger s_log = Logger.getLogger(LegacyInitializer.class);
private Configuration m_conf = new Configuration();
public LegacyInitializer() throws InitializationException {
m_conf.initParameter
(CHARSETS,
"Recognized character sets",
List.class);
m_conf.initParameter
(LOCALES,
"Recognized locales",
List.class);
m_conf.initParameter
(DEFAULT_CHARSET,
"Default character set for locales not listed",
String.class);
}
public Configuration getConfiguration() {
return m_conf;
}
public void startup() throws InitializationException {
TransactionContext txn = SessionManager.getSession().
getTransactionContext();
txn.beginTxn();
// if ( ! isLoaded() ) {
// s_log.info("Globalization Initializer is loading.");
// load();
// }
LocaleNegotiator.setApplicationLocaleProvider
(new ApplicationLocaleProvider());
LocaleNegotiator.setClientLocaleProvider(new ClientLocaleProvider());
LocaleNegotiator.setSystemLocaleProvider(new SystemLocaleProvider());
String defaultCharset = (String)m_conf.getParameter(DEFAULT_CHARSET);
Globalization.setDefaultCharset(defaultCharset);
txn.commitTxn();
}
public void shutdown() {}
private static boolean isLoaded() {
DataCollection charsets = SessionManager.getSession().
retrieve(Charset.BASE_DATA_OBJECT_TYPE);
boolean result = (charsets.size() > 0);
charsets.close();
return result;
}
private void load() throws InitializationException {
List charsets = (List) m_conf.getParameter(CHARSETS);
if ( charsets == null ) {
throw new InitializationException
("You must specify at least one charset in the \"" + CHARSETS +
"\" parameter of the globalization initaliazer in the init " +
" file. ISO-8859-1 would be a good first choice.");
}
Map charsetMap = new HashMap();
for (Iterator i=charsets.iterator(); i.hasNext(); ) {
String charsetName = (String) i.next();
// Check if this is a valid charset. Is there a better way to do
// this? - vadimn@redhat.com, Mon 2002-07-29 14:47:41 -0400
try {
new OutputStreamWriter(new ByteArrayOutputStream(), charsetName);
} catch (UnsupportedEncodingException ex) {
throw new InitializationException
(charsetName + " is not a supported charset", ex);
}
Charset charset = new Charset();
charset.setCharset(charsetName);
charset.save();
charsetMap.put(charsetName, charset);
}
List locales = (List) m_conf.getParameter(LOCALES);
if ( locales == null ) {
throw new InitializationException
("You must specify at least one locale in the \"" + LOCALES +
"\" parameter of the globalization initializer section of " +
"the init file. The \"en\" locale is probably required.");
}
for (Iterator i=locales.iterator(); i.hasNext(); ) {
List localeData = (List) i.next();
String language = (String) localeData.get(0);
String country = (String) localeData.get(1);
String variant = (String) localeData.get(2);
String charsetName = (String) localeData.get(3);
Locale locale = new Locale(language, country, variant);
Charset defaultCharset = (Charset) charsetMap.get(charsetName);
if ( defaultCharset == null ) {
throw new InitializationException
("You must list " + charsetName + " in the \"" + CHARSETS +
"\" parameter before using it in the \"" + LOCALES +
"\" parameter.");
}
locale.setDefaultCharset(defaultCharset);
locale.save();
}
}
}

View File

@ -37,18 +37,34 @@ import java.util.Date;
import java.util.Map; import java.util.Map;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
// Most of the documentation reconstructed from code by pboy (2013-04)
/** /**
* <p> * MessageCatalog DomainObject. It is comprised of:
* MessageCatalog DomainObject comprised of:
* </p>
* <p>
* <ul> * <ul>
* <li>name</li> * <li>name</li>
* <li>locale</li> * <li>locale</li>
* <li>catalog</li> * <li>catalog</li>
* </ul> * </ul>
* </p>
* *
* (pboy):
* A MessageCatalog object is a complete representation of the well known
* property file for a resource bundle.
* <ul>
* <li> name is analog to the (base) name of a property file for resource
* bundles. If used in conjunction with MixedResourceBundle
* (which might be the only intended use) name will be the
* class name of a child of MixedResourceBundle. </li>
* <li> locale is analog to locale part of the property file name </li>
* <li> catalog is a complete map of key/value pairs, analog to the content
* of a property file. </li>
* </ul>
* Each MessageCatalog object is stored in one row in a database table with
* catalog as a BLOB field.
*
* The MessageCatalog is a pure storage backend for a java resource bundle
* class (like MixedResourceBundle) as an alternative or supplement to a set
* of property files (where each proerty file is a row in the database table).
*
* @version $Revision: #14 $ $Date: 2004/08/16 $ * @version $Revision: #14 $ $Date: 2004/08/16 $
* @version $Id: MessageCatalog.java 287 2005-02-22 00:29:02Z sskracic $ * @version $Id: MessageCatalog.java 287 2005-02-22 00:29:02Z sskracic $
*/ */
@ -59,16 +75,13 @@ public class MessageCatalog extends DomainObject implements java.io.Serializable
Logger.getLogger(MessageCatalog.class.getName()); Logger.getLogger(MessageCatalog.class.getName());
public final static String BASE_DATA_OBJECT_TYPE = public final static String BASE_DATA_OBJECT_TYPE =
"com.arsdigita.globalization.MessageCatalog"; "com.arsdigita.globalization.MessageCatalog";
private boolean m_isReadOnly = true; private boolean m_isReadOnly = true;
/** /**
* <p>
* Constructor for a new root MessageCatalog. * Constructor for a new root MessageCatalog.
* </p>
* *
* @param name The name for this new MessageCatalog * @param name The name for this new MessageCatalog
*
*/ */
public MessageCatalog(String name) { public MessageCatalog(String name) {
super(BASE_DATA_OBJECT_TYPE); super(BASE_DATA_OBJECT_TYPE);
@ -77,14 +90,11 @@ public class MessageCatalog extends DomainObject implements java.io.Serializable
} }
/** /**
* <p>
* Constructor for a new MessageCatalog associated with a particular * Constructor for a new MessageCatalog associated with a particular
* Locale. * Locale.
* </p>
* *
* @param name The name for this new MessageCatalog * @param name The name for this new MessageCatalog
* @param locale The locale associated with this MessageCatalog * @param locale The locale associated with this MessageCatalog
*
*/ */
public MessageCatalog(String name, java.util.Locale locale) public MessageCatalog(String name, java.util.Locale locale)
throws GlobalizationException { throws GlobalizationException {
@ -94,18 +104,16 @@ public class MessageCatalog extends DomainObject implements java.io.Serializable
} }
/** /**
* <p>
* Constructor for retrieving a MessageCatalog. * Constructor for retrieving a MessageCatalog.
* </p>
* *
* @param dataObject The dataObject for this MessageCatalog * @param dataObject The dataObject for this MessageCatalog
*
*/ */
private MessageCatalog(DataObject dataObject) { private MessageCatalog(DataObject dataObject) {
super(dataObject); super(dataObject);
} }
@Override
protected void initialize() { protected void initialize() {
super.initialize(); super.initialize();
if (isNew() && getID() == null) { if (isNew() && getID() == null) {
@ -119,11 +127,9 @@ public class MessageCatalog extends DomainObject implements java.io.Serializable
} }
/** /**
* <p>
* Returns the appropriate object type for a MessageCatalog so that the * Returns the appropriate object type for a MessageCatalog so that the
* proper type validation can take place when retrieving MessageCatalogs * proper type validation can take place when retrieving MessageCatalogs
* by OID. * by OID.
* </p>
* *
* @return String The fully qualified name of the base data object type * @return String The fully qualified name of the base data object type
* for the MessageCatalog DataObject. * for the MessageCatalog DataObject.
@ -133,9 +139,7 @@ public class MessageCatalog extends DomainObject implements java.io.Serializable
} }
/** /**
* <p>
* Return ID. * Return ID.
* </p>
* *
* @return BigDecimal The ID of this DataObject * @return BigDecimal The ID of this DataObject
*/ */
@ -144,9 +148,7 @@ public class MessageCatalog extends DomainObject implements java.io.Serializable
} }
/** /**
* <p>
* Get the date that this MessageCatalog was last modified. * Get the date that this MessageCatalog was last modified.
* </p>
* *
* @return Date representing the date this MessageCatalog was last * @return Date representing the date this MessageCatalog was last
* modified. * modified.
@ -156,26 +158,22 @@ public class MessageCatalog extends DomainObject implements java.io.Serializable
} }
/** /**
* <p>
* Set the date this MessageCatalog was last modified. * Set the date this MessageCatalog was last modified.
* </p>
*/ */
private void setLastModified() throws GlobalizationException { private void setLastModified() throws GlobalizationException {
if (!isReadOnly()) { if (!isReadOnly()) {
set("lastModified", new Date()); set("lastModified", new Date());
} else { } else {
throw new GlobalizationException( throw new GlobalizationException(
"MessageCatalog is in read-only mode. You must use the " + "MessageCatalog is in read-only mode. You must use the " +
"MessageCatalog.retrieveForEdit() static method to edit " + "MessageCatalog.retrieveForEdit() static method to edit " +
"a MessageCatalog." "a MessageCatalog."
); );
} }
} }
/** /**
* <p>
* Get the locale associated with this MessageCatalog. * Get the locale associated with this MessageCatalog.
* </p>
* *
* @return java.util.Locale representing the language, country, * @return java.util.Locale representing the language, country,
* and variant associated with this MessageCatalog * and variant associated with this MessageCatalog
@ -195,9 +193,7 @@ public class MessageCatalog extends DomainObject implements java.io.Serializable
} }
/** /**
* <p>
* Set the locale associated with this MessageCatalog. * Set the locale associated with this MessageCatalog.
* </p>
* *
* @param locale java.util.Locale representing the language, country, * @param locale java.util.Locale representing the language, country,
* and variant associated with this MessageCatalog. * and variant associated with this MessageCatalog.
@ -211,8 +207,8 @@ public class MessageCatalog extends DomainObject implements java.io.Serializable
if (localeObject == null) { if (localeObject == null) {
throw new GlobalizationException( throw new GlobalizationException(
"Locale " + locale.toString() + " is not supported." "Locale " + locale.toString() + " is not supported."
); );
} }
setLocale(localeObject); setLocale(localeObject);
@ -221,17 +217,15 @@ public class MessageCatalog extends DomainObject implements java.io.Serializable
} }
} else { } else {
throw new GlobalizationException( throw new GlobalizationException(
"MessageCatalog is in read-only mode. You must use the " + "MessageCatalog is in read-only mode. You must use the " +
"MessageCatalog.retrieveForEdit() static method to edit " + "MessageCatalog.retrieveForEdit() static method to edit " +
"a MessageCatalog." "a MessageCatalog."
); );
} }
} }
/** /**
* <p>
* Set the locale associated with this MessageCatalog. * Set the locale associated with this MessageCatalog.
* </p>
* *
* @param locale representing the language, country, and variant * @param locale representing the language, country, and variant
* associated with this MessageCatalog. * associated with this MessageCatalog.
@ -241,18 +235,14 @@ public class MessageCatalog extends DomainObject implements java.io.Serializable
} }
/** /**
* <p>
* Clear the locale associated with this MessageCatalog. * Clear the locale associated with this MessageCatalog.
* </p>
*/ */
private void clearLocale() { private void clearLocale() {
setAssociation("locale", null); setAssociation("locale", null);
} }
/** /**
* <p>
* De-serialize the MessageCatalog from the database into a Map object. * De-serialize the MessageCatalog from the database into a Map object.
* </p>
* *
* @return Map representing the MessageCatalog * @return Map representing the MessageCatalog
*/ */
@ -275,7 +265,8 @@ public class MessageCatalog extends DomainObject implements java.io.Serializable
); );
} catch (SQLException sqle) { } catch (SQLException sqle) {
s_cat.error("SQL Exception", sqle); s_cat.error("SQL Exception", sqle);
throw new UncheckedWrapperException("SQLException: " + sqle.getMessage(), sqle); throw new UncheckedWrapperException("SQLException: " +
sqle.getMessage(), sqle);
} }
} else { } else {
throw new RuntimeException("Was not able to determine BLOB type."); throw new RuntimeException("Was not able to determine BLOB type.");
@ -312,9 +303,7 @@ public class MessageCatalog extends DomainObject implements java.io.Serializable
} }
/** /**
* <p>
* Serialize the MessageCatalog to the database from a Map object. * Serialize the MessageCatalog to the database from a Map object.
* </p>
* *
* @param catalog representing the MessageCatalog * @param catalog representing the MessageCatalog
*/ */
@ -343,17 +332,15 @@ public class MessageCatalog extends DomainObject implements java.io.Serializable
set("catalog", baos.toByteArray()); set("catalog", baos.toByteArray());
} else { } else {
throw new GlobalizationException( throw new GlobalizationException(
"MessageCatalog is in read-only mode. You must use the " + "MessageCatalog is in read-only mode. You must use the " +
"MessageCatalog.retrieveForEdit() static method to edit " + "MessageCatalog.retrieveForEdit() static method to edit " +
"a MessageCatalog." "a MessageCatalog."
); );
} }
} }
/** /**
* <p>
* Get the name of this MessageCatalog. * Get the name of this MessageCatalog.
* </p>
* *
* @return String representing the MessageCatalog's name * @return String representing the MessageCatalog's name
*/ */
@ -362,9 +349,7 @@ public class MessageCatalog extends DomainObject implements java.io.Serializable
} }
/** /**
* <p>
* Set the name of this MessageCatalog. * Set the name of this MessageCatalog.
* </p>
* *
* @param name representing the MessageCatalog's name * @param name representing the MessageCatalog's name
*/ */
@ -376,9 +361,7 @@ public class MessageCatalog extends DomainObject implements java.io.Serializable
} }
/** /**
* <p>
* Check whether or not this MessageCatalog is read-only or not. * Check whether or not this MessageCatalog is read-only or not.
* </p>
* *
* @return boolean true if it is read-only * @return boolean true if it is read-only
*/ */
@ -387,34 +370,28 @@ public class MessageCatalog extends DomainObject implements java.io.Serializable
} }
/** /**
* <p>
* Toggle read/write-ability of this MessageCatalog. * Toggle read/write-ability of this MessageCatalog.
* </p>
*/ */
private void setReadWrite() { private void setReadWrite() {
m_isReadOnly = false; m_isReadOnly = false;
} }
/** /**
* <p>
* Retrieve a MessageCatalog object from persistent storage. * Retrieve a MessageCatalog object from persistent storage.
* </p>
* *
* @param name The name of the MessageCatalog to retrieve. * @param name The name of the MessageCatalog to retrieve.
* *
* @return DataObject MessageCatalog * @return DataObject MessageCatalog
*/ */
private static DataObject load(String name) private static DataObject load(String name)
throws GlobalizationException { throws GlobalizationException {
Locale locale = null; Locale locale = null;
return load(name, locale); return load(name, locale);
} }
/** /**
* <p>
* Retrieve a MessageCatalog object from persistent storage. * Retrieve a MessageCatalog object from persistent storage.
* </p>
* *
* @param name The name of the MessageCatalog to retrieve. * @param name The name of the MessageCatalog to retrieve.
* @param locale The locale of the MessageCatalog to retrieve. * @param locale The locale of the MessageCatalog to retrieve.
@ -422,7 +399,7 @@ public class MessageCatalog extends DomainObject implements java.io.Serializable
* @return DataObject MessageCatalog * @return DataObject MessageCatalog
*/ */
private static DataObject load(String name, java.util.Locale locale) private static DataObject load(String name, java.util.Locale locale)
throws GlobalizationException { throws GlobalizationException {
Locale localeObject = null; Locale localeObject = null;
@ -434,9 +411,7 @@ public class MessageCatalog extends DomainObject implements java.io.Serializable
} }
/** /**
* <p>
* Retrieve a MessageCatalog object from persistent storage. * Retrieve a MessageCatalog object from persistent storage.
* </p>
* *
* @param name The name of the MessageCatalog to retrieve. * @param name The name of the MessageCatalog to retrieve.
* @param locale The locale of the MessageCatalog to retrieve. * @param locale The locale of the MessageCatalog to retrieve.
@ -444,7 +419,7 @@ public class MessageCatalog extends DomainObject implements java.io.Serializable
* @return DataObject MessageCatalog * @return DataObject MessageCatalog
*/ */
private static DataObject load(String name, Locale locale) private static DataObject load(String name, Locale locale)
throws GlobalizationException { throws GlobalizationException {
Session s = SessionManager.getSession(); Session s = SessionManager.getSession();
DataCollection catalogs = s.retrieve(BASE_DATA_OBJECT_TYPE); DataCollection catalogs = s.retrieve(BASE_DATA_OBJECT_TYPE);
@ -471,24 +446,20 @@ public class MessageCatalog extends DomainObject implements java.io.Serializable
} }
/** /**
* <p>
* Retrieve the MessageCatalog from persistent storage. * Retrieve the MessageCatalog from persistent storage.
* </p>
* *
* @param name The name of the MessageCatalog to retrieve. * @param name The name of the MessageCatalog to retrieve.
* *
* @return MessageCatalog * @return MessageCatalog
*/ */
public static MessageCatalog retrieve(String name) public static MessageCatalog retrieve(String name)
throws GlobalizationException { throws GlobalizationException {
return new MessageCatalog(load(name)); return new MessageCatalog(load(name));
} }
/** /**
* <p> * Retrieve the MessageCatalog for a specific locale from persistent storage.
* Retrieve the MessageCatalog from persistent storage.
* </p>
* *
* @param name The name of the MessageCatalog to retrieve. * @param name The name of the MessageCatalog to retrieve.
* @param locale The locale of the MessageCatalog to retrieve. * @param locale The locale of the MessageCatalog to retrieve.
@ -496,22 +467,20 @@ public class MessageCatalog extends DomainObject implements java.io.Serializable
* @return MessageCatalog * @return MessageCatalog
*/ */
public static MessageCatalog retrieve(String name, java.util.Locale locale) public static MessageCatalog retrieve(String name, java.util.Locale locale)
throws GlobalizationException { throws GlobalizationException {
return new MessageCatalog(load(name, locale)); return new MessageCatalog(load(name, locale));
} }
/** /**
* <p>
* Retrieve the MessageCatalog from persistent storage for edit. * Retrieve the MessageCatalog from persistent storage for edit.
* </p>
* *
* @param name The name of the MessageCatalog to retrieve. * @param name The name of the MessageCatalog to retrieve.
* *
* @return MessageCatalog * @return MessageCatalog
*/ */
public static MessageCatalog retrieveForEdit(String name) public static MessageCatalog retrieveForEdit(String name)
throws GlobalizationException { throws GlobalizationException {
MessageCatalog mc = new MessageCatalog(load(name)); MessageCatalog mc = new MessageCatalog(load(name));
mc.setReadWrite(); mc.setReadWrite();
@ -519,23 +488,22 @@ public class MessageCatalog extends DomainObject implements java.io.Serializable
} }
/** /**
* <p>
* Retrieve the MessageCatalog from persistent storage for edit. * Retrieve the MessageCatalog from persistent storage for edit.
* </p>
* *
* @param name The name of the MessageCatalog to retrieve. * @param name The name of the MessageCatalog to retrieve.
* @param locale The locale of the MessageCatalog to retrieve. * @param locale The locale of the MessageCatalog to retrieve.
* *
* @return MessageCatalog * @return MessageCatalog
*/ */
public static MessageCatalog retrieveForEdit( public static MessageCatalog retrieveForEdit(String name,
String name, java.util.Locale locale java.util.Locale locale)
) throws GlobalizationException { throws GlobalizationException {
MessageCatalog mc = new MessageCatalog(load(name, locale)); MessageCatalog mc = new MessageCatalog(load(name, locale));
mc.setReadWrite(); mc.setReadWrite();
return mc; return mc;
} }
@Override
protected void beforeSave() { protected void beforeSave() {
try { try {
setLastModified(); setLastModified();

View File

@ -16,6 +16,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* *
*/ */
package com.arsdigita.globalization; package com.arsdigita.globalization;
import java.io.File; import java.io.File;
@ -32,10 +33,7 @@ import java.util.StringTokenizer;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
/** /**
* <p>
* Extends java.util.ResourceBundle to have it do two things: * Extends java.util.ResourceBundle to have it do two things:
* </p>
* <p>
* <ul> * <ul>
* <li> * <li>
* If there is a PropertyResourceBundle with the same name as this one * If there is a PropertyResourceBundle with the same name as this one
@ -46,8 +44,20 @@ import org.apache.log4j.Logger;
* have the same resource bundle name as this one. * have the same resource bundle name as this one.
* </li> * </li>
* </ul> * </ul>
* </p>
* *
* How to use (rough reconstruction from code)
* - for each *.properties file create a child of this class with the same(!) name
* in the same package (subdirecgory)
* - for each language-specific *.proerties file create a child of this class
* with the same(1) name
* - Example:
* <ul> <li>HelloWorldResources.class</li>
* <li>HelloWorldResources.properties</li>
* <li>HelloWorldResources_es.class</li>
* <li>HelloWorldResources_es.properties</li>
* <li>HelloWorldResources_es_CO.class</li>
* <li>HelloWorldResources_es_CO.properties</li> </ul>
*
* @version $Revision: #10 $ $Date: 2004/08/16 $ * @version $Revision: #10 $ $Date: 2004/08/16 $
* @version $Id: MixedResourceBundle.java 287 2005-02-22 00:29:02Z sskracic $ * @version $Id: MixedResourceBundle.java 287 2005-02-22 00:29:02Z sskracic $
*/ */
@ -61,10 +71,8 @@ public abstract class MixedResourceBundle extends java.util.ResourceBundle {
private Date m_lastModified = null; private Date m_lastModified = null;
/** /**
* <p>
* Implement ResourceBundle.handleGetObject(). Reloads if contents have * Implement ResourceBundle.handleGetObject(). Reloads if contents have
* changed. * changed.
* </p>
* *
* @param key The key to the object to retrieve. * @param key The key to the object to retrieve.
* *
@ -78,9 +86,7 @@ public abstract class MixedResourceBundle extends java.util.ResourceBundle {
} }
/** /**
* <p>
* Implement ResourceBundle.getKeys(). Reloads if contents have changed. * Implement ResourceBundle.getKeys(). Reloads if contents have changed.
* </p>
* *
* @return Enumeration of keys. * @return Enumeration of keys.
*/ */
@ -134,12 +140,11 @@ public abstract class MixedResourceBundle extends java.util.ResourceBundle {
} }
/** /**
* <p>
* Mix all static (PropertiesResourceBundle) and dynamic (MessageCatalog) * Mix all static (PropertiesResourceBundle) and dynamic (MessageCatalog)
* resources into one two dimensional array of key, value pairs. * resources into one two dimensional array of key, value pairs.
* </p>
*/ */
private void loadContents() { private void loadContents() {
Map contents = new HashMap(); Map contents = new HashMap();
setLastLoaded(); setLastLoaded();
@ -157,25 +162,20 @@ public abstract class MixedResourceBundle extends java.util.ResourceBundle {
} }
/** /**
* <p>
* Look for a ".properties" file with the same name as the class instance * Look for a ".properties" file with the same name as the class instance
* that extends this class (MixedResourceBundle). If we find one, then: * that extends this class (MixedResourceBundle). If we find one, then:
* </p>
* <p>
* <ul> * <ul>
* <li>load it from disk</li> * <li>load it from disk</li>
* <li>return it as a map of key, value pairs.</li> * <li>return it as a map of key, value pairs.</li>
* </ul> * </ul>
* </p>
* *
* @return Map A map representing all the entries from the properties file. * @return Map A map representing all the entries from the properties file.
*/ */
private Map loadPropertyResources() { private Map loadPropertyResources() {
Map contents = new HashMap(); Map contents = new HashMap();
String className = getClassName().replace('.', '/'); String className = getClassName().replace('.', '/');
URL propertiesURL = getClass().getClassLoader().getResource( URL propertiesURL = getClass().getClassLoader()
className + ".properties" .getResource(className + ".properties");
);
if (s_cat.isDebugEnabled()) { if (s_cat.isDebugEnabled()) {
s_cat.debug("Starting to load static resources."); s_cat.debug("Starting to load static resources.");
@ -234,16 +234,12 @@ public abstract class MixedResourceBundle extends java.util.ResourceBundle {
} }
/** /**
* </p>
* Look for a MessageCatalog with the same name as the class instance * Look for a MessageCatalog with the same name as the class instance
* that extends this class (MixedResourceBundle). If we find one, then: * that extends this class (MixedResourceBundle). If we find one, then:
* </p>
* <p>
* <ul> * <ul>
* <li>load it</li> * <li>load it</li>
* <li>return it as a map of key, value pairs.</li> * <li>return it as a map of key, value pairs.</li>
* </ul> * </ul>
* </p>
* *
* @return Map A map representing all the entries from the MessageCatalog. * @return Map A map representing all the entries from the MessageCatalog.
*/ */
@ -286,26 +282,49 @@ public abstract class MixedResourceBundle extends java.util.ResourceBundle {
return contents; return contents;
} }
/**
*
* @return
*/
private boolean isModified() { private boolean isModified() {
return lastModified().compareTo(lastLoaded()) > 0 ? true : false; return lastModified().compareTo(lastLoaded()) > 0 ? true : false;
} }
/**
*
* @return
*/
private Date lastLoaded() { private Date lastLoaded() {
return m_lastLoaded; return m_lastLoaded;
} }
/**
*
*/
private void setLastLoaded() { private void setLastLoaded() {
m_lastLoaded = new Date(); m_lastLoaded = new Date();
} }
/**
*
* @param date
*/
private void setLastLoaded(Date date) { private void setLastLoaded(Date date) {
m_lastLoaded = date; m_lastLoaded = date;
} }
/**
*
* @return
*/
private Date lastModified() { private Date lastModified() {
return m_lastModified; return m_lastModified;
} }
/**
*
* @param date
*/
private void setLastModified(Date date) { private void setLastModified(Date date) {
if ( if (
m_lastModified == null || m_lastModified == null ||
@ -316,9 +335,7 @@ public abstract class MixedResourceBundle extends java.util.ResourceBundle {
} }
/** /**
* <p>
* Get the name of the instantiating class. * Get the name of the instantiating class.
* </p>
* *
* @return String representing the instantiating class * @return String representing the instantiating class
*/ */
@ -334,14 +351,11 @@ public abstract class MixedResourceBundle extends java.util.ResourceBundle {
} }
/** /**
* <p>
* Parse the instantiating class' name and return the name of the * Parse the instantiating class' name and return the name of the
* ResourceBundle/MessageCatalog that we are looking for. Note that we * ResourceBundle/MessageCatalog that we are looking for. Note that we
* assume that the class name will not contain any underscores ("_") * assume that the class name will not contain any underscores ("_")
* except for those that are used to denote the associated Locale. For * except for those that are used to denote the associated Locale. For
* example, all the following are valid: * example, all the following are valid:
* </p>
* <p>
* <ul> * <ul>
* <li>HelloWorldResources.class</li> * <li>HelloWorldResources.class</li>
* <li>HelloWorldResources.properties</li> * <li>HelloWorldResources.properties</li>
@ -350,19 +364,15 @@ public abstract class MixedResourceBundle extends java.util.ResourceBundle {
* <li>HelloWorldResources_es_CO.class</li> * <li>HelloWorldResources_es_CO.class</li>
* <li>HelloWorldResources_es_CO.properties</li> * <li>HelloWorldResources_es_CO.properties</li>
* </ul> * </ul>
* </p> *
* <p>
* while the follwing examples will cause this code to fail and are * while the follwing examples will cause this code to fail and are
* therefore not allowed (by convention): * therefore not allowed (by convention):
* </p>
* <p>
* <ul> * <ul>
* <li>Hello_World_Resources.class</li> * <li>Hello_World_Resources.class</li>
* <li>Hello_World_Resources.properties</li> * <li>Hello_World_Resources.properties</li>
* <li>Hello_World_Resources_es.class</li> * <li>Hello_World_Resources_es.class</li>
* <li>Hello_World_Resources_es.properties</li> * <li>Hello_World_Resources_es.properties</li>
* </ul> * </ul>
* </p>
* *
* @param className representing the instantiating class * @param className representing the instantiating class
* *
@ -384,14 +394,11 @@ public abstract class MixedResourceBundle extends java.util.ResourceBundle {
} }
/** /**
* <p>
* Parse the instantiating class's name and return the Locale associated * Parse the instantiating class's name and return the Locale associated
* with the ResourceBundle/MessageCatalog we are looking for. Note that we * with the ResourceBundle/MessageCatalog we are looking for. Note that we
* assume that the class name will not contain any underscores ("_") * assume that the class name will not contain any underscores ("_")
* except for those that are used to denote the associated Locale. For * except for those that are used to denote the associated Locale. For
* example, all the following are valid: * example, all the following are valid:
* </p>
* <p>
* <ul> * <ul>
* <li>HelloWorldResources.class</li> * <li>HelloWorldResources.class</li>
* <li>HelloWorldResources.properties</li> * <li>HelloWorldResources.properties</li>
@ -400,19 +407,15 @@ public abstract class MixedResourceBundle extends java.util.ResourceBundle {
* <li>HelloWorldResources_es_CO.class</li> * <li>HelloWorldResources_es_CO.class</li>
* <li>HelloWorldResources_es_CO.properties</li> * <li>HelloWorldResources_es_CO.properties</li>
* </ul> * </ul>
* </p> *
* <p>
* while the follwing examples will cause this code to fail and are * while the follwing examples will cause this code to fail and are
* therefore not allowed (by convention): * therefore not allowed (by convention):
* </p>
* <p>
* <ul> * <ul>
* <li>Hello_World_Resources.class</li> * <li>Hello_World_Resources.class</li>
* <li>Hello_World_Resources.properties</li> * <li>Hello_World_Resources.properties</li>
* <li>Hello_World_Resources_es.class</li> * <li>Hello_World_Resources_es.class</li>
* <li>Hello_World_Resources_es.properties</li> * <li>Hello_World_Resources_es.properties</li>
* </ul> * </ul>
* </p>
* *
* @param className representing the instantiating class * @param className representing the instantiating class
* *

View File

@ -18,33 +18,36 @@
*/ */
package com.arsdigita.london.contenttypes.util; package com.arsdigita.london.contenttypes.util;
import com.arsdigita.globalization.Globalized;
import com.arsdigita.globalization.GlobalizedMessage; import com.arsdigita.globalization.GlobalizedMessage;
/** /**
* <p> * Compilation of methods to simplify the handling of globalizing keys.
* Contains methods to simplify globalizing keys related to Contact * Basically it adds the name of package's resource bundle files to the
* ContentType object. * globalize methods and forwards to GlobalizedMessage, shortening the
* </p> * method invocation in the various application classes.
* *
* @author Shashin Shinde <a href="mailto:sshinde@redhat.com">sshinde@redhat.com</a> * @author Shashin Shinde <a href="mailto:sshinde@redhat.com">sshinde@redhat.com</a>
* @version $Id: ContactGlobalizationUtil.java 287 2005-02-22 00:29:02Z sskracic $ * @version $Id: ContactGlobalizationUtil.java 287 2005-02-22 00:29:02Z sskracic $
*/ */
public class ContactGlobalizationUtil { public class ContactGlobalizationUtil {
/** Name of Java resource files to handle Contact's globalisation. */
final public static String BUNDLE_NAME = final public static String BUNDLE_NAME =
"com.arsdigita.london.contenttypes.util.ContactResourceBundle"; "com.arsdigita.london.contenttypes.ContactResources";
/** /**
* This returns a globalized message using the type specific bundle, * Returns a globalized message using the package specific bundle,
* BUNDLE_NAME * provided by BUNDLE_NAME.
*/ */
public static GlobalizedMessage globalize(String key) { public static GlobalizedMessage globalize(String key) {
return new GlobalizedMessage(key, BUNDLE_NAME); return new GlobalizedMessage(key, BUNDLE_NAME);
} }
/** /**
* This returns a globalized message using the type specific bundle, * Returns a globalized message object, using the package specific bundle,
* BUNDLE_NAME * 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(String key, Object[] args) { public static GlobalizedMessage globalize(String key, Object[] args) {
return new GlobalizedMessage(key, BUNDLE_NAME, args); return new GlobalizedMessage(key, BUNDLE_NAME, args);

View File

@ -1,44 +0,0 @@
/*
* Copyright (C) 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.london.contenttypes.util;
import java.util.PropertyResourceBundle;
import com.arsdigita.globalization.ChainedResourceBundle;
import com.arsdigita.cms.util.CMSGlobalized;
/**
* Resource Bundle used in UI for Contact ContentType.
*
* @author Shashin Shinde <a href="mailto:sshinde@redhat.com">sshinde@redhat.com</a>
* @version $Id: ContactResourceBundle.java 287 2005-02-22 00:29:02Z sskracic $
*/
public class ContactResourceBundle extends ChainedResourceBundle implements CMSGlobalized {
public final static String CONTACT_BUNDLE_NAME =
"com.arsdigita.london.contenttypes.ContactResources";
public ContactResourceBundle() {
super();
addBundle((PropertyResourceBundle)getBundle(CONTACT_BUNDLE_NAME));
addBundle((PropertyResourceBundle)getBundle(BUNDLE_NAME));
}
}

View File

@ -17,38 +17,39 @@
*/ */
package com.arsdigita.london.contenttypes.util; package com.arsdigita.london.contenttypes.util;
import com.arsdigita.globalization.Globalized;
import com.arsdigita.globalization.GlobalizedMessage; import com.arsdigita.globalization.GlobalizedMessage;
/** /**
* <p> * Compilation of methods to simplify the handling of globalizing keys.
* Contains methods to simplify globalizing keys related to * Basically it adds the name of package's resource bundle files to the
* <code>ESDService</code> content type object. * globalize methods and forwards to GlobalizedMessage, shortening the
* </p> * method invocation in the various application classes.
* @author Shashin Shinde <a href="mailto:sshinde@redhat.com">sshinde@redhat.com</a> * @author Shashin Shinde <a href="mailto:sshinde@redhat.com">sshinde@redhat.com</a>
*
* @version $Id: ESDServiceGlobalizationUtil.java 287 2005-02-22 00:29:02Z sskracic $ * @version $Id: ESDServiceGlobalizationUtil.java 287 2005-02-22 00:29:02Z sskracic $
*
*/ */
public class ESDServiceGlobalizationUtil { public class ESDServiceGlobalizationUtil implements Globalized {
final public static String BUNDLE_NAME = /** Name of Java resource files to handle CMS's globalisation. */
"com.arsdigita.london.contenttypes.util.ESDServiceResourceBundle"; final public static String BUNDLE_NAME =
"com.arsdigita.london.contenttypes.ESDServiceResources";
/** /**
* This returns a globalized message using the type specific bundle, * Returns a globalized message using the package specific bundle,
* BUNDLE_NAME * provided by BUNDLE_NAME.
*/ */
public static GlobalizedMessage globalize(String key) { public static GlobalizedMessage globalize(String key) {
return new GlobalizedMessage(key, BUNDLE_NAME); return new GlobalizedMessage(key, BUNDLE_NAME);
} }
/** /**
* This returns a globalized message using the type specific bundle, * Returns a globalized message object, using the package specific bundle,
* BUNDLE_NAME * 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(String key, Object[] args) { */
return new GlobalizedMessage(key, BUNDLE_NAME, args); public static GlobalizedMessage globalize(String key, Object[] args) {
} return new GlobalizedMessage(key, BUNDLE_NAME, args);
}
} }

View File

@ -1,42 +0,0 @@
/*
* Copyright (C) 2001-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.london.contenttypes.util;
import com.arsdigita.cms.util.CMSGlobalized;
import com.arsdigita.globalization.ChainedResourceBundle;
import java.util.PropertyResourceBundle;
/**
* @author Shashin Shinde <a href="mailto:sshinde@redhat.com">sshinde@redhat.com</a>
*
* @version $Id: ESDServiceResourceBundle.java 287 2005-02-22 00:29:02Z sskracic $
*
*/
public class ESDServiceResourceBundle extends ChainedResourceBundle implements CMSGlobalized {
public final static String ESDSERVICE_BUNDLE_NAME =
"com.arsdigita.london.contenttypes.ESDServiceResources";
public ESDServiceResourceBundle() {
super();
addBundle((PropertyResourceBundle)getBundle(ESDSERVICE_BUNDLE_NAME));
addBundle((PropertyResourceBundle)getBundle(BUNDLE_NAME));
}
}

View File

@ -1,16 +1,53 @@
/*
* 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.portalworkspace.util; package com.arsdigita.portalworkspace.util;
import com.arsdigita.globalization.Globalized; import com.arsdigita.globalization.Globalized;
import com.arsdigita.globalization.GlobalizedMessage; 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.
*
* @version $Id: $
*/
public class GlobalizationUtil implements Globalized { public class GlobalizationUtil implements Globalized {
private static final String BUNDLE_NAME =
"com.arsdigita.portalworkspace.WorkspaceResources";
/** Name of the Java resource files to handle Workspace globalisation. */
private static final String BUNDLE_NAME =
"com.arsdigita.portalworkspace.WorkspaceResources";
/**
* This returns a globalized message using the package specific bundle.
*/
public static GlobalizedMessage globalize(String key) { public static GlobalizedMessage globalize(String key) {
return new GlobalizedMessage(key, BUNDLE_NAME); return new GlobalizedMessage(key, BUNDLE_NAME);
} }
/**
* Returns a globalized message object, using the package specific bundle.
* Also takes in an Object[] of arguments to interpolate into the
* retrieved message using the MessageFormat class.
*/
public static GlobalizedMessage globalize(String key, Object[] args) { public static GlobalizedMessage globalize(String key, Object[] args) {
return new GlobalizedMessage(key, BUNDLE_NAME, args); return new GlobalizedMessage(key, BUNDLE_NAME, args);

View File

@ -21,21 +21,33 @@ package com.arsdigita.themedirector.util;
import com.arsdigita.globalization.GlobalizedMessage; import com.arsdigita.globalization.GlobalizedMessage;
/** /**
* Methods to simplify globalizing keys * 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 <a href="mailto:yon@arsdigita.com">yon@arsdigita.com</a> * @author <a href="mailto:yon@arsdigita.com">yon@arsdigita.com</a>
* @version $Revision: #1 $ $Date: 2003/11/18 $ * @version $Revision: #1 $ $Date: 2003/11/18 $
*/ */
public class GlobalizationUtil { public class GlobalizationUtil {
/** Name of resource files to handle themedirector's globalisation. */
public static final String BUNDLE_NAME = public static final String BUNDLE_NAME =
"com.arsdigita.themedirector.ThemeDirectorResources"; "com.arsdigita.themedirector.ThemeDirectorResources";
/**
* This returns a globalized message using the package specific bundle,
* provided by BUNDLE_NAME.
*/
public static GlobalizedMessage globalize(String key) { public static GlobalizedMessage globalize(String key) {
return new GlobalizedMessage(key, BUNDLE_NAME); 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(String key, Object[] args) { public static GlobalizedMessage globalize(String key, Object[] args) {
return new GlobalizedMessage(key, BUNDLE_NAME, args); return new GlobalizedMessage(key, BUNDLE_NAME, args);
} }