Skip to content

Commit

Permalink
feat(bundler): wix localization, closes #3174 (#3179)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasfernog authored Feb 5, 2022
1 parent de0543f commit af329f2
Show file tree
Hide file tree
Showing 15 changed files with 431 additions and 238 deletions.
6 changes: 6 additions & 0 deletions .changes/wix-localization.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"cli.rs": patch
"tauri-bundler": patch
---

Allow setting the localization file for WiX.
34 changes: 29 additions & 5 deletions core/tauri-utils/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,18 +122,42 @@ pub struct MacConfig {
pub entitlements: Option<String>,
}

fn default_language() -> String {
"en-US".into()
/// Configuration for a target language for the WiX build.
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
#[cfg_attr(feature = "schema", derive(JsonSchema))]
#[serde(rename_all = "camelCase", deny_unknown_fields)]
pub struct WixLanguageConfig {
/// The path to a locale (`.wxl`) file. See <https://wixtoolset.org/documentation/manual/v3/howtos/ui_and_localization/build_a_localized_version.html>.
pub locale_path: Option<String>,
}

/// The languages to build using WiX.
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
#[cfg_attr(feature = "schema", derive(JsonSchema))]
#[serde(untagged)]
pub enum WixLanguage {
/// A single language to build, without configuration.
One(String),
/// A list of languages to build, without configuration.
List(Vec<String>),
/// A map of languages and its configuration.
Localized(HashMap<String, WixLanguageConfig>),
}

impl Default for WixLanguage {
fn default() -> Self {
Self::One("en-US".into())
}
}

/// Configuration for the MSI bundle using WiX.
#[derive(Debug, Default, PartialEq, Clone, Deserialize, Serialize)]
#[cfg_attr(feature = "schema", derive(JsonSchema))]
#[serde(rename_all = "camelCase", deny_unknown_fields)]
pub struct WixConfig {
/// The installer language. See <https://docs.microsoft.com/en-us/windows/win32/msi/localizing-the-error-and-actiontext-tables>.
#[serde(default = "default_language")]
pub language: String,
/// The installer languages to build. See <https://docs.microsoft.com/en-us/windows/win32/msi/localizing-the-error-and-actiontext-tables>.
#[serde(default)]
pub language: WixLanguage,
/// A custom .wxs template to use.
pub template: Option<PathBuf>,
/// A list of paths to .wxs files with WiX fragments to use.
Expand Down
Loading

0 comments on commit af329f2

Please sign in to comment.