1   /**
2    * Distribution License:
3    * BibleDesktop is free software; you can redistribute it and/or modify it under
4    * the terms of the GNU General Public License, version 2 as published by
5    * the Free Software Foundation. This program is distributed in the hope
6    * that it will be useful, but WITHOUT ANY WARRANTY; without even the
7    * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
8    * See the GNU General Public License for more details.
9    *
10   * The License is available on the internet at:
11   *       http://www.gnu.org/copyleft/gpl.html
12   * or by writing to:
13   *      Free Software Foundation, Inc.
14   *      59 Temple Place - Suite 330
15   *      Boston, MA 02111-1307, USA
16   *
17   * Copyright: 2007
18   *     The copyright to this program is held by it's authors.
19   *
20   * ID: $Id: org.eclipse.jdt.ui.prefs 1178 2006-11-06 12:48:02Z dmsmith $
21   */
22  
23  package org.crosswire.bibledesktop;
24  
25  import org.crosswire.common.icu.NumberShaper;
26  import org.crosswire.common.util.MsgBase;
27  
28  /**
29   * BibleDesktop API for all the messages in the BibleDesktop jar.
30   *
31   * @see gnu.gpl.License for license details.
32   *      The copyright to this program is held by it's authors.
33   * @author DM Smith [dmsmith555 at yahoo dot com]
34   */
35   public final class BDMsg extends MsgBase {
36  
37      /**
38       * get the title of the application
39       * @return the title of the application
40       */
41      public static String getApplicationTitle() {
42          // TRANSLATOR: The name of the program.
43          return BDMsg.gettext("Bible Desktop");
44      }
45  
46      /**
47       * get a version string of the form "Version: 1.0"
48       * 
49       * @return the version string
50       */
51      public static String getVersionInfo() {
52          // TRANSLATOR: Gets a version string in the form "Version 1.0"
53          // {0} is a placeholder for the version
54          return BDMsg.gettext("Version {0}", getVersion());
55      }
56  
57      /**
58       * get a title of the form "App Name v1.0"
59       * 
60       * @return a versioned title
61       */
62      public static String getVersionedApplicationTitle() {
63          // TRANSLATOR: Gets a version string in the form "Bible Desktop v1.0"
64          // {0} is a placeholder for the application name
65          // {1} is a placeholder for the version
66          return BDMsg.gettext("{0} v{1}", getApplicationTitle(), getVersion());
67      }
68  
69      /**
70       * get an About string of the form "About App Name"
71       * 
72       * @return Info for "About"
73       */
74      public static String getAboutInfo() {
75          // TRANSLATOR: An "About" string in the form "About Bible Desktop"
76          return BDMsg.gettext("About {0}", getApplicationTitle());
77      }
78  
79      private static String getVersion() {
80          return VERSION;
81      }
82  
83      /**
84       * Get the internationalized text, but return key if key is unknown.
85       * The text requires one or more parameters to be passed.
86       * 
87       * @param key
88       * @param params
89       * @return the formatted, internationalized text
90       */
91      public static String gettext(String key, Object... params) {
92          return msg.lookup(key, params);
93      }
94  
95      // The shaper for the version number
96      private static NumberShaper shaper = new NumberShaper();
97  
98      /**
99       * The current version of Bible Desktop. Adjust for each release.
100      * And increment after each release and append alpha, beta, ... to it.
101      */
102     private static final String VERSION = shaper.shape("1.6.1beta");
103 
104     private static MsgBase msg = new BDMsg();
105 }
106