2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
6 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 * See LICENSE.TXT at the top of this package for the full license terms.
9 package eu
.etaxonomy
.taxeditor
.editor
.name
;
11 import java
.util
.Locale
;
12 import java
.util
.MissingResourceException
;
13 import java
.util
.ResourceBundle
;
15 import org
.apache
.log4j
.Logger
;
17 import eu
.etaxonomy
.cdm
.model
.name
.BotanicalName
;
18 import eu
.etaxonomy
.cdm
.model
.name
.TaxonNameBase
;
19 import eu
.etaxonomy
.cdm
.model
.name
.ZoologicalName
;
20 import eu
.etaxonomy
.taxeditor
.ITaxEditorConstants
;
21 import eu
.etaxonomy
.taxeditor
.preference
.PreferencesUtil
;
28 public class Messages
{
29 private static final Logger logger
= Logger
.getLogger(Messages
.class);
30 private static final String BUNDLE_NAME
= "eu.etaxonomy.taxeditor.editor.name.messages"; //$NON-NLS-1$
32 private static final ResourceBundle RESOURCE_BUNDLE
= ResourceBundle
33 .getBundle(BUNDLE_NAME
, Locale
.getDefault());
38 public static String
getString(String key
) {
40 return RESOURCE_BUNDLE
.getString(PreferencesUtil
.concatCodeMessageSuffix(key
));
41 } catch (MissingResourceException e1
) {
43 return RESOURCE_BUNDLE
.getString(key
);
44 } catch (MissingResourceException e2
) {
45 return '!' + key
+ '!';
50 public static String
getString(String key
, TaxonNameBase name
) {
51 if (name
instanceof BotanicalName
) {
52 key
+= "." + ITaxEditorConstants
.CODE_PREFERENCE_ICBN
;
53 } else if (name
instanceof ZoologicalName
) {
54 key
+= "." + ITaxEditorConstants
.CODE_PREFERENCE_ICZN
;
59 return RESOURCE_BUNDLE
.getString(key
);
60 } catch (MissingResourceException e2
) {
61 return '!' + key
+ '!';