[Mono-devel-list] Internationalisation
Paul
paul at all-the-johnsons.co.uk
Tue Aug 2 10:17:48 EDT 2005
Hi,
I have a small piece of code (which uses SWF, but the problem is not
there) below. It compiles fine and runs. However, if I click on the
Swahili radio button, I get the errors set out beneath the source.
Is internationalisation on the todo list or is this something I need to
put into bugzilla?
TTFN
Paul
using System;
using System.Drawing;
using System.Resources;
using System.Globalization;
using System.Windows.Forms;
class International : Form
{
ResourceManager rm;
Label man;
Label woman;
public International()
{
rm = new ResourceManager(typeof(International));
RadioButton eng = new RadioButton();
eng.Checked = true;
eng.Location = new Point(10, 10);
eng.Text = "English";
eng.CheckedChanged += new EventHandler(LoadUSResources);
RadioButton swa = new RadioButton();
swa.Location = new Point(10, 30);
swa.Text = "Swahili";
swa.CheckedChanged += new EventHandler(LoadSwahiliResources);
man = new Label();
man.Location = new Point(10, 60);
man.Text = "Man";
woman = new Label();
woman.Location = new Point(10, 90);
woman.Text = "Woman";
Controls.AddRange(new Control[] {eng, swa, man, woman} );
Text = "International";
}
public void LoadUSResources(object src, EventArgs a)
{
if (((RadioButton)src).Checked == true)
{
ResourceSet rs = rm.GetResourceSet(new CultureInfo("en-GB"), true,
true);
SetLabels(rs);
}
}
public void LoadSwahiliResources(object src, EventArgs a)
{
if (((RadioButton)src).Checked == true)
{
ResourceSet rs = rm.GetResourceSet(new CultureInfo("sw"), true,
true);
SetLabels(rs);
}
}
private void SetLabels(ResourceSet rs)
{
man.Text = rs.GetString("Man");
woman.Text = rs.GetString("Woman");
}
public static void Main()
{
Application.Run(new International());
}
}
mcs international.cs -r:System.Windows.Forms -r:System.Drawing
mono international.exe
Unhandled Exception: System.Resources.MissingManifestResourceException:
Could not find any resource appropiate for the specified culture or its
parents. Make sure "International.resources" was correctly embedded or
linked into assembly "international".
in <0x002ea> System.Resources.ResourceManager:InternalGetResourceSet
(System.Globalization.CultureInfo culture, Boolean Createifnotexists,
Boolean tryParents)
in <0x00409> System.Resources.ResourceManager:InternalGetResourceSet
(System.Globalization.CultureInfo culture, Boolean Createifnotexists,
Boolean tryParents)
in <0x0003f> System.Resources.ResourceManager:GetResourceSet
(System.Globalization.CultureInfo culture, Boolean createIfNotExists,
Boolean tryParents)
in <0x000b9> International:LoadSwahiliResources (System.Object src,
System.EventArgs a)
in (wrapper delegate-invoke)
System.MulticastDelegate:invoke_void_object_EventArgs
(object,System.EventArgs)
in <0x00023> System.Windows.Forms.RadioButton:OnCheckedChanged
(System.EventArgs e)
in <0x0003f> System.Windows.Forms.RadioButton:set_Checked (Boolean
value)
in (wrapper remoting-invoke-with-check)
System.Windows.Forms.RadioButton:set_Checked (bool)
in <0x0002f> System.Windows.Forms.RadioButton:OnClick (System.EventArgs
e)
in <0x00011> System.Windows.Forms.RadioButton:ReceivedFocus
(System.Object sender, System.EventArgs e)
in (wrapper delegate-invoke)
System.MulticastDelegate:invoke_void_object_EventArgs
(object,System.EventArgs)
in <0x00023> System.Windows.Forms.Control:OnGotFocus (System.EventArgs
e)
in <0x00020> System.Windows.Forms.ButtonBase:OnGotFocus
(System.EventArgs e)
in <0x012a9> System.Windows.Forms.Control:WndProc
(System.Windows.Forms.Message m)
in <0x00066> System.Windows.Forms.ButtonBase:WndProc
(System.Windows.Forms.Message m)
in <0x00014> System.Windows.Forms.Control+ControlNativeWindow:WndProc
(System.Windows.Forms.Message m)
in <0x0011b> System.Windows.Forms.NativeWindow:WndProc (IntPtr hWnd, Msg
msg, IntPtr wParam, IntPtr lParam)
in <0x00016> System.Windows.Forms.XplatUIX11:DispatchMessage
(System.Windows.Forms.MSG msg)
in <0x00015> System.Windows.Forms.XplatUI:DispatchMessage
(System.Windows.Forms.MSG msg)
in <0x001f2> System.Windows.Forms.Application:Run ()
in <0x000a6> System.Windows.Forms.Application:Run
(System.Windows.Forms.ApplicationContext context)
in <0x0002e> System.Windows.Forms.Application:Run
(System.Windows.Forms.Form mainForm)
in <0x0001f> International:Main ()
--
"Some people will do anything for a woman in uniform" - The Doctor -
Unregenerate (Big Finish audio)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20050802/eec8752b/attachment.bin
More information about the Mono-devel-list
mailing list