Monday 15 June 2015

c# - Build a App that accepts language pack -


I have lost a lot here and I need guidance.

I need to create a web app that will support the language pack ... This idea is to start with a default language like English, and then the client will be able to download and install the language pack And then select between the default language and any other installed language. Is there a pattern on this matter? Perhaps I could study an open source software (and take it as an example)? Or maybe some literature on this?

Edit1: The idea is that the user will deploy the web app on the premises (or the cloud IaaS) and many language packs will be installed, and the app browser's language check And check whether there is a compatible language pack for translation ... .net already does this which uses local resources, which requires re-synchronization ...

Unix world's example RAN gettext, but I'm sure you're looking for something more modern.

At this, you have to structure your string-consumer code, so that members can read / print / etc strings to read, like, this.mainForm.Title = StringLib. MainFormTitle .

The string-elb will be just one big static square with a ton of mill / set properties.

Then, create separate assemblies for each language you want to support, give them some names langpack.en-US.dll, langpack.it-IT.dll, etc. Each will have two squares - one category that you will install to get metadata about language packs (culture, version, etc.) and other classes, when applied, your string labels will be filled in the stable properties of the class.

In run-time, see LangPac files for everyone, then use reflection to load them. Use reflection to know the name of Lang Pack, show them in the list of user selections. The user selects a Langpack, at that point you call the initial class in the Lang Pack. In order to reduce the properties of the stylilib class, the initial call calls a ton, and you go out.

MainApp.csproj:

  Public class StringLib {Receives public static string {MainFormTitle} Set; Langpack.en-US.csproj:  
  public class LangPackDescriptor: ILangPackDescriptor {public readonly string LangPackName = "American English"; Public readonly string culture string = "n-US"; ...} public class EnUsLangPackInit: ILangPackInit {Public Zero Init () {StringLib.MainFormTitle = "My Application Name" ...}}   

langpack.it-IT.csproj < / P>

  public class LangPackDescriptor: ILangPackDescriptor {public static string LangPackName = "Italian"; Public string string cultureString = "it-IT"; ...} Public Square ItItLangPackInit: ILangPackInit {Public Zero Init () {StringLib.MainFormTitle = "Il Nome Del Mio Applicazione" ...}}   

Use reflection to initalize , A file name:

  public zero load LAN (string filename) {assembly langpackAssembly; ILLPK descriptor descriptor; IELAPPacinist Initializer; LangpackAssembly = Assembly.LoadFrom (filename); Type [langpackTypes = langpackAssembly.GetExportedTypes (); (Typ (Typ (iialpk descriptor)) {descriptor = activator. Create instance (found type); } If found (includeType.GetInterfaces). Include & type; type & gt; (typeof (ILangPackInit)) {initializer = Actator.CreateInstance (foundType); }} // if the pass-in file is Langpack.en - USDLL File, then this // calls langpack.en-US.dll's NUsLongPac INIT. The int () method is. Initializer.Init (); }    

No comments:

Post a Comment