// Path: src/main/java/org/kontalk/util/Tr.java
// public class Tr {
//     private static final Logger LOGGER = Logger.getLogger(Tr.class.getName());
// 
//     private static final String DEFAULT_LANG = "en";
//     private static final String I18N_DIR = "i18n/";
//     private static final String STRING_FILE = "strings";
//     private static final String PROP_EXT = ".properties";
// 
//     private static final String WIKI_BASE = "https://github.com/kontalk/desktopclient-java/wiki";
//     private static final String WIKI_HOME = "Home";
//     private static final List<String> WIKI_LANGS = Arrays.asList("de");
// 
//     /** Map default (English) strings to translated strings. **/
//     private static Map<String, String> TR_MAP = null;
// 
//     /**
//      * Translate string used in user interface.
//      * Spaces at beginning or end of string not supported!
//      * @param s string that wants to be translated (in English)
//      * @return translation of input string (depending on platform language)
//      */
//     public static String tr(String s) {
//         if (TR_MAP == null || !TR_MAP.containsKey(s))
//             return s;
//         return TR_MAP.get(s);
//     }
// 
//     public static void init() {
//         // get language
//         String lang = Locale.getDefault().getLanguage();
//         // for testing
//         //String lang = new Locale("zh").getLanguage();
//         if (lang.equals(DEFAULT_LANG)) {
//             return;
//         }
// 
//         LOGGER.info("Setting language: "+lang);
// 
//         // load string keys file
//         String path = I18N_DIR + STRING_FILE + PROP_EXT;
//         PropertiesConfiguration stringKeys;
//         try {
//             stringKeys = new PropertiesConfiguration(ClassLoader.getSystemResource(path));
//         } catch (ConfigurationException ex) {
//             LOGGER.log(Level.WARNING, "can't load string key file", ex);
//             return;
//         }
// 
//         // load translation file
//         path = I18N_DIR + STRING_FILE + "_" + lang + PROP_EXT;
//         URL url = ClassLoader.getSystemResource(path);
//         if (url == null) {
//             LOGGER.info("can't find translation file: "+path);
//             return;
//         }
//         PropertiesConfiguration tr = new PropertiesConfiguration();
//         tr.setEncoding("UTF-8");
//         try {
//             tr.load(url);
//         } catch (ConfigurationException ex) {
//             LOGGER.log(Level.WARNING, "can't load translation file", ex);
//             return;
//         }
// 
//         TR_MAP = new HashMap<>();
//         Iterator<String> it = tr.getKeys();
//         while (it.hasNext()) {
//             String k = it.next();
//             if (!stringKeys.containsKey(k)) {
//                 LOGGER.warning("key in translation but not in key file: "+k);
//                 continue;
//             }
//             TR_MAP.put(stringKeys.getString(k), tr.getString(k));
//         }
//     }
// 
//     public static String getLocalizedWikiLink() {
//         String lang = Locale.getDefault().getLanguage();
//         if (WIKI_LANGS.contains(lang)) {
//             // damn URI decoding
//             return WIKI_BASE + "/%5B" + lang + "%5D-" + WIKI_HOME;
//         }
//         return WIKI_BASE;
//     }
// }


import java.nio.file.Path;
import java.util.HashMap;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.configuration.PropertiesConfiguration;
import org.kontalk.util.Tr;
    public static final String SERV_HOST = "server.host";
    public static final String SERV_PORT = "server.port";
    public static final String SERV_CERT_VALIDATION = "server.cert_validation";
    public static final String ACC_PASS = "account.passphrase";
    public static final String ACC_JID = "account.jid";
    public static final String VIEW_FRAME_WIDTH = "view.frame.width";
    public static final String VIEW_FRAME_HEIGHT = "view.frame.height";
    public static final String VIEW_SELECTED_CHAT = "view.thread";
    public static final String VIEW_CHAT_BG = "view.thread_bg";
    public static final String VIEW_USER_CONTACT = "view.user_in_contactlist";
    public static final String VIEW_HIDE_BLOCKED = "view.hide_blocked_contacts";
    public static final String VIEW_MESSAGE_FONT_SIZE = "view.msg_font_size";
    public static final String NET_SEND_CHAT_STATE = "net.chatstate";
    public static final String NET_SEND_ROSTER_NAME = "net.roster_name";
    public static final String NET_STATUS_LIST = "net.status_list";
    public static final String NET_AUTO_SUBSCRIPTION = "net.auto_subscription";
    public static final String NET_REQUEST_AVATARS = "net.request_avatars";
    public static final String NET_MAX_IMG_SIZE = "net.max_img_size";
    public static final String MAIN_CONNECT_STARTUP = "main.connect_startup";
    public static final String NET_RETRY_CONNECT = "main.retry_connect";
    public static final String MAIN_TRAY = "main.tray";
    public static final String MAIN_TRAY_CLOSE = "main.tray_close";
    public static final String MAIN_ENTER_SENDS = "main.enter_sends";

    // default server address
    //public static final String DEFAULT_SERV_NET = "kontalk.net";
    public static final String DEFAULT_SERV_HOST = "beta.kontalk.net";
    public static final int DEFAULT_SERV_PORT = 5999;

    private final String mDefaultXMPPStatus =
// Path: src/main/java/org/kontalk/util/Tr.java
// public class Tr {
//     private static final Logger LOGGER = Logger.getLogger(Tr.class.getName());
// 
//     private static final String DEFAULT_LANG = "en";
//     private static final String I18N_DIR = "i18n/";
//     private static final String STRING_FILE = "strings";
//     private static final String PROP_EXT = ".properties";
// 
//     private static final String WIKI_BASE = "https://github.com/kontalk/desktopclient-java/wiki";
//     private static final String WIKI_HOME = "Home";
//     private static final List<String> WIKI_LANGS = Arrays.asList("de");
// 
//     /** Map default (English) strings to translated strings. **/
//     private static Map<String, String> TR_MAP = null;
// 
//     /**
//      * Translate string used in user interface.
//      * Spaces at beginning or end of string not supported!
//      * @param s string that wants to be translated (in English)
//      * @return translation of input string (depending on platform language)
//      */
//     public static String tr(String s) {
//         if (TR_MAP == null || !TR_MAP.containsKey(s))
//             return s;
//         return TR_MAP.get(s);
//     }
// 
//     public static void init() {
//         // get language
//         String lang = Locale.getDefault().getLanguage();
//         // for testing
//         //String lang = new Locale("zh").getLanguage();
//         if (lang.equals(DEFAULT_LANG)) {
//             return;
//         }
// 
//         LOGGER.info("Setting language: "+lang);
// 
//         // load string keys file
//         String path = I18N_DIR + STRING_FILE + PROP_EXT;
//         PropertiesConfiguration stringKeys;
//         try {
//             stringKeys = new PropertiesConfiguration(ClassLoader.getSystemResource(path));
//         } catch (ConfigurationException ex) {
//             LOGGER.log(Level.WARNING, "can't load string key file", ex);
//             return;
//         }
// 
//         // load translation file
//         path = I18N_DIR + STRING_FILE + "_" + lang + PROP_EXT;
//         URL url = ClassLoader.getSystemResource(path);
//         if (url == null) {
//             LOGGER.info("can't find translation file: "+path);
//             return;
//         }
//         PropertiesConfiguration tr = new PropertiesConfiguration();
//         tr.setEncoding("UTF-8");
//         try {
//             tr.load(url);
//         } catch (ConfigurationException ex) {
//             LOGGER.log(Level.WARNING, "can't load translation file", ex);
//             return;
//         }
// 
//         TR_MAP = new HashMap<>();
//         Iterator<String> it = tr.getKeys();
//         while (it.hasNext()) {
//             String k = it.next();
//             if (!stringKeys.containsKey(k)) {
//                 LOGGER.warning("key in translation but not in key file: "+k);
//                 continue;
//             }
//             TR_MAP.put(stringKeys.getString(k), tr.getString(k));
//         }
//     }
// 
//     public static String getLocalizedWikiLink() {
//         String lang = Locale.getDefault().getLanguage();
//         if (WIKI_LANGS.contains(lang)) {
//             // damn URI decoding
//             return WIKI_BASE + "/%5B" + lang + "%5D-" + WIKI_HOME;
//         }
//         return WIKI_BASE;
//     }
// }


// Path: src/main/java/org/kontalk/persistence/Config.java
import java.nio.file.Path;
import java.util.HashMap;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.configuration.PropertiesConfiguration;
import org.kontalk.util.Tr;

    public static final String SERV_HOST = "server.host";
    public static final String SERV_PORT = "server.port";
    public static final String SERV_CERT_VALIDATION = "server.cert_validation";
    public static final String ACC_PASS = "account.passphrase";
    public static final String ACC_JID = "account.jid";
    public static final String VIEW_FRAME_WIDTH = "view.frame.width";
    public static final String VIEW_FRAME_HEIGHT = "view.frame.height";
    public static final String VIEW_SELECTED_CHAT = "view.thread";
    public static final String VIEW_CHAT_BG = "view.thread_bg";
    public static final String VIEW_USER_CONTACT = "view.user_in_contactlist";
    public static final String VIEW_HIDE_BLOCKED = "view.hide_blocked_contacts";
    public static final String VIEW_MESSAGE_FONT_SIZE = "view.msg_font_size";
    public static final String NET_SEND_CHAT_STATE = "net.chatstate";
    public static final String NET_SEND_ROSTER_NAME = "net.roster_name";
    public static final String NET_STATUS_LIST = "net.status_list";
    public static final String NET_AUTO_SUBSCRIPTION = "net.auto_subscription";
    public static final String NET_REQUEST_AVATARS = "net.request_avatars";
    public static final String NET_MAX_IMG_SIZE = "net.max_img_size";
    public static final String MAIN_CONNECT_STARTUP = "main.connect_startup";
    public static final String NET_RETRY_CONNECT = "main.retry_connect";
    public static final String MAIN_TRAY = "main.tray";
    public static final String MAIN_TRAY_CLOSE = "main.tray_close";
    public static final String MAIN_ENTER_SENDS = "main.enter_sends";

    // default server address
    //public static final String DEFAULT_SERV_NET = "kontalk.net";
    public static final String DEFAULT_SERV_HOST = "beta.kontalk.net";
    public static final int DEFAULT_SERV_PORT = 5999;

    private final String mDefaultXMPPStatus =
            Tr.tr("Hey, I'm using Kontalk on my PC!");