[Mono-devel-list] Internationalisation
Rafael Teixeira
monoman at gmail.com
Wed Aug 3 10:28:27 EDT 2005
Hi Paul,
It seems like you didn't embed or link your resources in the
compilation command line, so sure it wouldn't find any resource to
load at run-time... Be sure to include them when compiling.
As you asked about compiling to a winexe target in another email, it
seems like you didn't do your homework on command line options for the
compiler (either csc/mcs).
Homework: go extensively over 'man mcs' and contrast with csc
documentation at msdn.
Well, but now seriously: Most people doesn't have a clue of how many
things the IDEs (VS.NET, SD, MD, XD) do behind the curtain about
compilation, so I think you won't be the last one to ask such
questions, or fumble on basic compilation concepts.
Key rule for begginers: first try 'man', and if 'man' doesn't help
enough 'google' is your handy learning tool...
:)
On 8/2/05, Paul <paul at all-the-johnsons.co.uk> wrote:
> 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)
>
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.2 (GNU/Linux)
>
> iD8DBQBC74CMusSVe5EZv3wRAhNwAJ4u+ITzyI17e7qIQt2r0tA+L7zzywCePsr4
> 0AtRWD0DfR4bfO64GRPXTWQ=
> =z4iv
> -----END PGP SIGNATURE-----
>
>
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>
>
>
--
Rafael "Monoman" Teixeira
---------------------------------------
I'm trying to become a "Rosh Gadol" before my own eyes.
See http://www.joelonsoftware.com/items/2004/12/06.html for enlightment.
It hurts!
More information about the Mono-devel-list
mailing list