001    /*
002     * JBoss, Home of Professional Open Source.
003     * Copyright 2008, Red Hat Middleware LLC, and individual contributors
004     * as indicated by the @author tags. See the copyright.txt file in the
005     * distribution for a full listing of individual contributors.
006     *
007     * This is free software; you can redistribute it and/or modify it
008     * under the terms of the GNU Lesser General Public License as
009     * published by the Free Software Foundation; either version 2.1 of
010     * the License, or (at your option) any later version.
011     *
012     * This software is distributed in the hope that it will be useful,
013     * but WITHOUT ANY WARRANTY; without even the implied warranty of
014     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015     * Lesser General Public License for more details.
016     *
017     * You should have received a copy of the GNU Lesser General Public
018     * License along with this software; if not, write to the Free
019     * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
020     * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
021     */
022    package org.jboss.dna.common;
023    
024    import java.util.Locale;
025    import java.util.Set;
026    import org.jboss.dna.common.i18n.I18n;
027    
028    /**
029     * @author John Verhaeg
030     * @author Randall Hauch
031     */
032    public final class CommonI18n {
033    
034        // Make sure the following I18n.java-related fields are defined before all other fields to ensure a valid error message is
035        // produced in the event of a missing/duplicate/unused property
036    
037        public static I18n i18nClassInterface;
038        public static I18n i18nClassNotPublic;
039        public static I18n i18nFieldFinal;
040        public static I18n i18nFieldInvalidType;
041        public static I18n i18nFieldNotPublic;
042        public static I18n i18nFieldNotStatic;
043        public static I18n i18nLocalizationFileNotFound;
044        public static I18n i18nLocalizationProblems;
045        public static I18n i18nRequiredToSuppliedParameterMismatch;
046    
047        /**
048         * Parameters:
049         * <ol>
050         * <li>{@link I18n#id() Property}</li>
051         * <li>Localization file URL</li>
052         * </ol>
053         */
054        public static I18n i18nPropertyDuplicate;
055        public static I18n i18nPropertyMissing;
056        public static I18n i18nPropertyUnused;
057    
058        // Core-related fields
059        public static I18n argumentMayNotBeLessThan;
060        public static I18n argumentMayNotBeGreaterThan;
061        public static I18n argumentMustBeGreaterThan;
062        public static I18n argumentMustBeLessThan;
063        public static I18n argumentMustBeGreaterThanOrEqualTo;
064        public static I18n argumentMustBeLessThanOrEqualTo;
065        public static I18n argumentMayNotBeNegative;
066        public static I18n argumentMayNotBePositive;
067        public static I18n argumentMustBeNegative;
068        public static I18n argumentMustBePositive;
069        public static I18n argumentMustBeNumber;
070        public static I18n argumentMayNotBeNullOrZeroLength;
071        public static I18n argumentMayNotBeNullOrZeroLengthOrEmpty;
072        public static I18n argumentMayNotBeNull;
073        public static I18n argumentMustBeNull;
074        public static I18n argumentMustBeInstanceOf;
075        public static I18n argumentMustBeSameAs;
076        public static I18n argumentMustNotBeSameAs;
077        public static I18n argumentMustBeEquals;
078        public static I18n argumentMustNotBeEquals;
079        public static I18n argumentMayNotBeEmpty;
080        public static I18n argumentDidNotContainObject;
081        public static I18n argumentDidNotContainKey;
082        public static I18n argumentMayNotContainNullValue;
083        public static I18n argumentMustBeOfMinimumSize;
084        public static I18n argumentMustBeOfMaximumSize;
085        public static I18n componentClassnameNotValid;
086        public static I18n componentNotConfigured;
087        public static I18n dateParsingFailure;
088        public static I18n initialProgressMonitorTaskName;
089        public static I18n nullProgressMonitorTaskName;
090        public static I18n pathAncestorDegreeIsInvalid;
091        public static I18n pathIsAlreadyAbsolute;
092        public static I18n pathIsNotAbsolute;
093        public static I18n pathIsNotRelative;
094        public static I18n pathCannotBeNormalized;
095        public static I18n progressMonitorBeginTask;
096        public static I18n progressMonitorStatus;
097        public static I18n requiredToSuppliedParameterMismatch;
098    
099        static {
100            try {
101                I18n.initialize(CommonI18n.class);
102            } catch (final Exception err) {
103                System.err.println(err);
104            }
105        }
106    
107        public static Set<Locale> getLocalizationProblemLocales() {
108            return I18n.getLocalizationProblemLocales(CommonI18n.class);
109        }
110    
111        public static Set<String> getLocalizationProblems() {
112            return I18n.getLocalizationProblems(CommonI18n.class);
113        }
114    
115        public static Set<String> getLocalizationProblems( Locale locale ) {
116            return I18n.getLocalizationProblems(CommonI18n.class, locale);
117        }
118    }