Giter VIP home page Giter VIP logo

Comments (3)

oleg-shilo avatar oleg-shilo commented on July 24, 2024

Yes it is possible. Though not the way you suggested. You can build all msis from the same build script.

var project = new ManagedProject(...)

project.LocalizationFile = @"Language\en-US.wxl";
project.Language = "en-US";
project.OutFileName = "en.product.msi";
project.BuildMsi();

project.LocalizationFile = @"Language\en-FR.wxl";
project.Language = "fr-FR";
project.OutFileName = "fr.product.msi";
project.BuildMsi();

project.LocalizationFile = @"Language\de-DE.wxl";
project.Language = "de-DE";
project.OutFileName = "de.product.msi";
project.BuildMsi();

from wixsharp.

Christobal25 avatar Christobal25 commented on July 24, 2024

Thanks for your Help, but I have another Question...

private void dialog_Load(object sender, EventArgs e){
var box = System.Windows.Forms.MessageBox.Show("[KeyA]", "[KeyB]", (...) )
(...)
}

Is it possible to localize the Key´s for the MessageBox in the CodeBehind from a WinForm?

from wixsharp.

oleg-shilo avatar oleg-shilo commented on July 24, 2024

Typically. WinForm localization is done view dedicated resources *.resx and as such they have nothing to do with MSI. This is the most orthodox approach and it's covered very well by "WinForm Localization".

Alternatively can access the UIText table from the msi being executed and read any key value from it with MSI SQL statement via the session object. It is not trivial but possible and Wix# does for some scenarios.

However If you are using EmbeddedUI (ManagedUI) WiX compiler does not embed wxl file and the UIText table is not created. Wix# fixes this problem and embeds your whole language file as binary resource. You can access it at runtime like this:

var bytes = Session.TryReadBinary("WixSharp_UIText");

Convert it to whatever you want (e.g. XML) and you can read your text from it. Though MsiRuntime class already has the localization routine based on that embedded wxl file:

void next_Click(object sender, EventArgs e)
{
    string localized = MsiRuntime.Localize("whatever");

Or you can even use the more powerful LocalizeWith extension:

void dialog_Load(object sender, EventArgs e)
{
    next_button.LocalizeWith(MsiRuntime.Localize);

This extension reads the Text property of the control, localizes it and sets it back to the control.

from wixsharp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.