Load from resource file with ResourceManager : Resource File « I18N Internationalization « C# / CSharp Tutorial






using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Resources;
using System.Threading;
using System.Globalization;
using System.Reflection;

  public class MainClass
  {
    [STAThread]
    static void Main() 
    {
            // set UI culture
            Thread.CurrentThread.CurrentUICulture = new CultureInfo( "ja" );
            // create a resourcemanager to load satellite assembly
            ResourceManager resMan = new ResourceManager( "SatelliteAssemblyClient.MyResources", Assembly.GetExecutingAssembly() );

            // set picture box
            (Image) resMan.GetObject( "flag" );

            // set label
            resMan.GetString( "Hello" );
        }
  }



/*
File: SatelliteAssembly\MyResources.ja.txt
Hello=Hello World
*/








21.16.Resource File
21.16.1.Internationalization Form: default culture info
21.16.2.Load from resource file with ResourceManager