OSDN Git Service

cosmetic updates
[dictzip-java/dictzip-java.git] / src / main / java / org / dict / zip / cli / AppConsts.java
1 /*
2  * Copyright (C) 2016 Hiroshi Miura
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
17  */
18
19 package org.dict.zip.cli;
20
21 import java.text.MessageFormat;
22 import java.util.Locale;
23 import java.util.ResourceBundle;
24
25 /**
26  * Application specific constants.
27  * @author Hiroshi Miura
28  */
29 public class AppConsts {
30     static final String VERSION = ResourceBundle.getBundle("org/dict/zip/Version")
31             .getString("version");
32     static final String UPDATE = ResourceBundle.getBundle("org/dict/zip/Version")
33             .getString("update");
34     static final String REVISION = ResourceBundle.getBundle("org/dict/zip/Version")
35             .getString("revision");
36
37     static final ResourceBundle _messages = ResourceBundle.getBundle("org/dict/zip/cli/Bundle",
38             Locale.getDefault());
39
40     static final String NAME = _messages.getString("application.name");
41     static final String BRANDING = "";
42     static final String YEAR = "2016";
43     static final String AUTHORS = "Hiroshi Miura";
44     static final String LICENSE = "GPLv2+";
45
46     private static String getString(final String key) {
47         return _messages.getString(key);
48     }
49
50     static String getNameAndVersion() {
51         if (UPDATE != null && !UPDATE.equals("0")) {
52             return MessageFormat.format(getString("app-version-template-pretty-update"),
53                     getApplicationName(), VERSION, UPDATE);
54         } else {
55             return MessageFormat.format(getString("app-version-template-pretty"),
56                     getApplicationName(), VERSION);
57         }
58     }
59
60     static String getApplicationName() {
61         return BRANDING.isEmpty() ? NAME : NAME + " " + BRANDING;
62     }
63
64     private AppConsts() {
65     }
66 }