Best practices for global resources in c# -


when want make our application users(speak different languages),we need global technology.
in c# use resourcemanager follow:

using system; using system.reflection; using system.resources;  public class example {    public static void main()    {       // retrieve resource.       resourcemanager rm = new resourcemanager("exampleresources" ,                                 typeof(example).assembly);       string greeting = rm.getstring("greeting");        console.write("enter name: ");       string name = console.readline();       console.writeline("{0} {1}!", greeting, name);    } } // example produces output similar following: //       enter name: john //       hello john! 

the assembly have 2 or more language resources:
assembly
|--assembly.en-us.resx
|--assembly.zh-cn.resx

then archive change resource changing thread cultureinfo use different resource.

if application have lot of dll(assembly) files.
want have single point(one resource file 1 language) application,
there solution idea?

before change view(eg.winform or usercontrol)'s language implement different ui corresponding language.

just build internationalization in c# using way described. last step of build process, can run fody.costura.

this take different dlls , pack them application have single .exe file included.

the benefit can use c# internationalization frameworks intended without hacks, still single exe can deliver customers.


Comments

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -