// 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 javax.swing.Icon;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import com.alee.extended.image.WebImage;
import com.alee.laf.button.WebButton;
import com.alee.laf.panel.WebPanel;
import com.alee.laf.text.WebTextField;
import org.kontalk.util.Tr;
/*
 *  Kontalk Java client
 *  Copyright (C) 2016 Kontalk Devteam <devteam@kontalk.org>
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package org.kontalk.view;



/**
 * A search bar to search for text in contact, chat and message lists.
 * @author Alexander Bikadorov {@literal <bikaejkb@mail.tu-berlin.de>}
 */
final class SearchPanel extends WebPanel {
    private final WebTextField mSearchField;

    SearchPanel(final ListView[] lists, final ChatView chatView) {
        mSearchField = new WebTextField();
// 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/view/SearchPanel.java
import javax.swing.Icon;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import com.alee.extended.image.WebImage;
import com.alee.laf.button.WebButton;
import com.alee.laf.panel.WebPanel;
import com.alee.laf.text.WebTextField;
import org.kontalk.util.Tr;

/*
 *  Kontalk Java client
 *  Copyright (C) 2016 Kontalk Devteam <devteam@kontalk.org>
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package org.kontalk.view;



/**
 * A search bar to search for text in contact, chat and message lists.
 * @author Alexander Bikadorov {@literal <bikaejkb@mail.tu-berlin.de>}
 */
final class SearchPanel extends WebPanel {
    private final WebTextField mSearchField;

    SearchPanel(final ListView[] lists, final ChatView chatView) {
        mSearchField = new WebTextField();
        mSearchField.setInputPrompt(Tr.tr("Search…"));