mirror of
https://github.com/igniterealtime/Spark.git
synced 2025-10-29 11:47:01 +00:00
Compare commits
5 Commits
fae3cf7e4b
...
7925f667b5
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7925f667b5 | ||
|
|
73715fa0fb | ||
|
|
68ce7b08ae | ||
|
|
4499d1eaf2 | ||
|
|
8856e6dd3b |
@ -348,27 +348,35 @@ public final class MainWindow extends ChatFrame implements ActionListener {
|
||||
return classpath.toString();
|
||||
}
|
||||
|
||||
private String getCommandPath() throws IOException{
|
||||
return getLibDirectory().getParentFile().getCanonicalPath();
|
||||
private String getCommandPath() throws IOException{
|
||||
File libDir = getLibDirectory();
|
||||
if (libDir == null) {
|
||||
return null;
|
||||
}
|
||||
return libDir.getParentFile().getCanonicalPath();
|
||||
}
|
||||
|
||||
public boolean restartApplicationWithScript() {
|
||||
String command = null;
|
||||
try {
|
||||
String commandPath = getCommandPath();
|
||||
if (commandPath == null) {
|
||||
return false;
|
||||
}
|
||||
if (Spark.isWindows()) {
|
||||
String sparkExe = getCommandPath() + File.separator + Default.getString(Default.SHORT_NAME) + ".exe";
|
||||
String sparkExe = commandPath + File.separator + Default.getString(Default.SHORT_NAME) + ".exe";
|
||||
if (!new File(sparkExe).exists()) {
|
||||
Log.warning("Client EXE file does not exist");
|
||||
return false;
|
||||
}
|
||||
String starterExe = getCommandPath() + File.separator + "starter.exe";
|
||||
String starterExe = commandPath + File.separator + "starter.exe";
|
||||
if (!new File(starterExe).exists()) {
|
||||
Log.warning("Starter EXE file does not exist");
|
||||
return false;
|
||||
}
|
||||
command = starterExe + " \"" + sparkExe + "\"";
|
||||
command = starterExe + " \"" + sparkExe + "\"";
|
||||
} else if (Spark.isLinux()) {
|
||||
command = getCommandPath() + File.separator + Default.getString(Default.SHORT_NAME);
|
||||
command = commandPath + File.separator + Default.getString(Default.SHORT_NAME);
|
||||
if (!new File(command).exists()) {
|
||||
Log.warning("Client startup script does not exist");
|
||||
return false;
|
||||
|
||||
@ -33,38 +33,41 @@ import java.util.Locale;
|
||||
*/
|
||||
public class LanguagePlugin implements Plugin {
|
||||
|
||||
private Locale[] locales;
|
||||
private JMenu languageMenu;
|
||||
|
||||
@Override
|
||||
public void initialize() {
|
||||
// Register with action menu
|
||||
final JMenu actionsMenu = SparkManager.getMainWindow().getMenuByName(Res.getString("menuitem.actions"));
|
||||
|
||||
languageMenu = new JMenu(Res.getString("menuitem.languages"));
|
||||
String languageMenuLabel = Res.getString("menuitem.languages");
|
||||
// For non-English locales append "Language" for those who accidentally changed language
|
||||
if (!Locale.getDefault().getLanguage().equals("en")) {
|
||||
languageMenuLabel += " (Language)";
|
||||
}
|
||||
JMenu languageMenu = new JMenu(languageMenuLabel);
|
||||
languageMenu.setIcon(SparkRes.getImageIcon("LANGUAGE_ICON"));
|
||||
|
||||
locales = Locale.getAvailableLocales();
|
||||
Locale[] locales = Locale.getAvailableLocales();
|
||||
|
||||
// Load files
|
||||
for (final Locale locale : locales) {
|
||||
String code = locale.toString();
|
||||
final String targetI18nFileName;
|
||||
if (locale.toString().equals("en")) {
|
||||
if (code.equals("en")) {
|
||||
targetI18nFileName = "/i18n/spark_i18n.properties";
|
||||
} else {
|
||||
targetI18nFileName = "/i18n/spark_i18n_" + locale.toString() + ".properties";
|
||||
targetI18nFileName = "/i18n/spark_i18n_" + code + ".properties";
|
||||
}
|
||||
|
||||
// If we can find an translation file for this locale, we can support the language!
|
||||
if (getClass().getResource( targetI18nFileName ) != null) {
|
||||
addLanguage(locale);
|
||||
addLanguage(locale, languageMenu);
|
||||
}
|
||||
}
|
||||
|
||||
actionsMenu.add(languageMenu);
|
||||
}
|
||||
|
||||
private void addLanguage(Locale locale) {
|
||||
private void addLanguage(Locale locale, JMenu languageMenu) {
|
||||
Action action = new AbstractAction() {
|
||||
private static final long serialVersionUID = -7093236616888591766L;
|
||||
|
||||
@ -83,10 +86,7 @@ public class LanguagePlugin implements Plugin {
|
||||
}
|
||||
}
|
||||
};
|
||||
String label = locale.getDisplayLanguage(locale);
|
||||
if (!locale.getDisplayCountry(locale).isEmpty()) {
|
||||
label = label + "-" + locale.getDisplayCountry(locale);
|
||||
}
|
||||
String label = locale.getDisplayName(locale);
|
||||
action.putValue(Action.NAME, label);
|
||||
languageMenu.add(action);
|
||||
}
|
||||
|
||||
@ -621,7 +621,7 @@ message.save.profile = Чтобы сохранить изменения проф
|
||||
message.search.for.contacts = Найти контакты.
|
||||
message.search.input.short = Укажите хотя бы две буквы.
|
||||
message.search.for.other.people = Поиск людей на сервере
|
||||
message.search.service.not.available = Нет связи с сервисом поиска
|
||||
message.search.service.not.available = Нет связи с сервисом поиска контактов
|
||||
message.searching.please.wait = Поиск. Ждите...
|
||||
message.select.add.room.to.add = Выберете комнату для добавления в Ваш список сервисов
|
||||
message.select.one.or.more = Выберете одного или нескольких пользователей.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user