Skip to content

Commit af329f2

Browse files
authored
feat(bundler): wix localization, closes #3174 (#3179)
1 parent de0543f commit af329f2

File tree

15 files changed

+431
-238
lines changed

15 files changed

+431
-238
lines changed

.changes/wix-localization.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"cli.rs": patch
3+
"tauri-bundler": patch
4+
---
5+
6+
Allow setting the localization file for WiX.

core/tauri-utils/src/config.rs

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,18 +122,42 @@ pub struct MacConfig {
122122
pub entitlements: Option<String>,
123123
}
124124

125-
fn default_language() -> String {
126-
"en-US".into()
125+
/// Configuration for a target language for the WiX build.
126+
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
127+
#[cfg_attr(feature = "schema", derive(JsonSchema))]
128+
#[serde(rename_all = "camelCase", deny_unknown_fields)]
129+
pub struct WixLanguageConfig {
130+
/// The path to a locale (`.wxl`) file. See <https://wixtoolset.org/documentation/manual/v3/howtos/ui_and_localization/build_a_localized_version.html>.
131+
pub locale_path: Option<String>,
132+
}
133+
134+
/// The languages to build using WiX.
135+
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
136+
#[cfg_attr(feature = "schema", derive(JsonSchema))]
137+
#[serde(untagged)]
138+
pub enum WixLanguage {
139+
/// A single language to build, without configuration.
140+
One(String),
141+
/// A list of languages to build, without configuration.
142+
List(Vec<String>),
143+
/// A map of languages and its configuration.
144+
Localized(HashMap<String, WixLanguageConfig>),
145+
}
146+
147+
impl Default for WixLanguage {
148+
fn default() -> Self {
149+
Self::One("en-US".into())
150+
}
127151
}
128152

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

0 commit comments

Comments
 (0)