- OK/cancel/apply logics for localization option;

- Localized buttons and window title;

git-svn-id: https://webim.svn.sourceforge.net/svnroot/webim/trunk@82 c66351dc-e62f-0410-b875-e3a5c0b9693f
This commit is contained in:
Pavel Petroshenko 2008-05-18 19:36:55 +00:00
parent f558332718
commit e9fad99416
6 changed files with 69 additions and 18 deletions

View File

@ -104,5 +104,13 @@ namespace webImTray {
if (args.Length == 1 && args[0].Equals("/show"))
forceShowWindow = true;
}
public static bool RussianLocale {
get {
return Application.UserAppDataRegistry.GetValue("isrussianlocale", "false").ToString().ToLower().Equals("true");
} set {
Application.UserAppDataRegistry.SetValue("isrussianlocale", value.ToString());
}
}
}
}

View File

@ -131,9 +131,5 @@ namespace webImTray {
private System.Windows.Forms.Button apply;
private System.Windows.Forms.Panel container;
private System.Windows.Forms.LinkLabel linkLabel1;
}
}

View File

@ -24,8 +24,13 @@ namespace webImTray {
public static CultureInfo englishCulture = new CultureInfo("en-US");
public static CultureInfo russianCulture = new CultureInfo("ru-RU");
// FIXME: we have only one OptionsDialog instance
// thus it's safe to keep it in a static variable.
private static OptionsDialog currentInstance = null;
public OptionsDialog() {
InitializeComponent();
currentInstance = this;
}
private void changePanel(OptionsPanel panel) {
@ -102,6 +107,10 @@ namespace webImTray {
for (int i = 0; i < 4; i++) {
((OptionsPanel)panels[i]).updateUI(resourceManager);
}
currentInstance.ok.Text = resourceManager.GetString("ok");
currentInstance.cancel.Text = resourceManager.GetString("cancel");
currentInstance.apply.Text = resourceManager.GetString("apply");
currentInstance.Text = resourceManager.GetString("optionsTitle");
}
}
}

View File

@ -7,6 +7,7 @@ using System.Text;
using System.Windows.Forms;
using System.Resources;
using System.Threading;
using System.Globalization;
namespace webImTray {
public partial class OptionsGeneralPanel : UserControl, OptionsPanel {
@ -27,6 +28,18 @@ namespace webImTray {
Options.ShowInTaskBar = showInTaskBar.Checked;
Options.AutoStart = autoStart.Checked;
Options.HideAfterStart = hideWhenStarted.Checked;
// Save locale
Options.RussianLocale = radioRussian.Checked;
// Apply locale
if (radioEnglish.Checked) {
Thread.CurrentThread.CurrentUICulture = OptionsDialog.englishCulture;
} else if (radioRussian.Checked) {
Thread.CurrentThread.CurrentUICulture = OptionsDialog.russianCulture;
}
// Update UI according to the current locale
OptionsDialog.updateUI();
modified = false;
}
}
@ -35,6 +48,17 @@ namespace webImTray {
showInTaskBar.Checked = Options.ShowInTaskBar;
autoStart.Checked = Options.AutoStart;
hideWhenStarted.Checked = Options.HideAfterStart;
// Restore previously set locale
if (!Options.RussianLocale) {
radioEnglish.Checked = true;
} else {
radioRussian.Checked = true;
}
// Update UI according to the current locale
OptionsDialog.updateUI();
modified = false;
}
@ -56,23 +80,13 @@ namespace webImTray {
}
private void radioEnglish_CheckedChanged(object sender, EventArgs e) {
if (radioEnglish.Checked) {
// Set english culture
Thread.CurrentThread.CurrentUICulture = OptionsDialog.englishCulture;
// Update UI
OptionsDialog.updateUI();
}
modified = true;
PanelModified.Invoke();
}
private void radioRussian_CheckedChanged(object sender, EventArgs e) {
if (radioRussian.Checked) {
// Set russian culture
Thread.CurrentThread.CurrentUICulture = OptionsDialog.russianCulture;
// Update UI
OptionsDialog.updateUI();
}
modified = true;
PanelModified.Invoke();
}
}
}

View File

@ -120,6 +120,9 @@
<data name="application" xml:space="preserve">
<value>Application</value>
</data>
<data name="apply" xml:space="preserve">
<value>Apply</value>
</data>
<data name="autoDesconnectOnSS" xml:space="preserve">
<value>Become idle if the screen saver is activated</value>
</data>
@ -129,6 +132,9 @@
<data name="autoStart" xml:space="preserve">
<value>Start automatically when starting Windows</value>
</data>
<data name="cancel" xml:space="preserve">
<value>Cancel</value>
</data>
<data name="connection" xml:space="preserve">
<value>Connection</value>
</data>
@ -156,9 +162,15 @@
<data name="notifications" xml:space="preserve">
<value>Notifications</value>
</data>
<data name="ok" xml:space="preserve">
<value>OK</value>
</data>
<data name="operatorPreferences" xml:space="preserve">
<value>Operator preferences</value>
</data>
<data name="optionsTitle" xml:space="preserve">
<value>Web IM Tray Options</value>
</data>
<data name="playSoundOnVisitor" xml:space="preserve">
<value>Play sound when visitor comes</value>
</data>

View File

@ -120,6 +120,9 @@
<data name="application" xml:space="preserve">
<value>Приложение</value>
</data>
<data name="apply" xml:space="preserve">
<value>Применить</value>
</data>
<data name="autoDesconnectOnSS" xml:space="preserve">
<value>Автоматически отсоединяться, если запущен хранитель экрана</value>
</data>
@ -129,6 +132,9 @@
<data name="autoStart" xml:space="preserve">
<value>Запускать автоматически при загрузке системы</value>
</data>
<data name="cancel" xml:space="preserve">
<value>Нет</value>
</data>
<data name="connection" xml:space="preserve">
<value>Соединение</value>
</data>
@ -156,9 +162,15 @@
<data name="notifications" xml:space="preserve">
<value>Звуковые уведомления</value>
</data>
<data name="ok" xml:space="preserve">
<value>Да</value>
</data>
<data name="operatorPreferences" xml:space="preserve">
<value>Настройки оператора</value>
</data>
<data name="optionsTitle" xml:space="preserve">
<value>Настройки Веб Мессенджер "Трей"</value>
</data>
<data name="playSoundOnVisitor" xml:space="preserve">
<value>Звуковое уведомление о появлении посетителя</value>
</data>