Skip to content

Commit

Permalink
Localize the parameters in the widget app intents
Browse files Browse the repository at this point in the history
  • Loading branch information
literally-anything committed Jul 2, 2024
1 parent f1d1ec6 commit d32bd63
Show file tree
Hide file tree
Showing 6 changed files with 78 additions and 78 deletions.
18 changes: 6 additions & 12 deletions HomeAssistant.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,8 @@
403AE92B2C2F3A9200D48147 /* IntentServerAppEntitiy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 403AE9292C2F3A9200D48147 /* IntentServerAppEntitiy.swift */; };
404C79762C3482860010EB81 /* AppIntentWidgetKinds.swift in Sources */ = {isa = PBXBuildFile; fileRef = 404C79752C3482790010EB81 /* AppIntentWidgetKinds.swift */; };
404C79772C3482860010EB81 /* AppIntentWidgetKinds.swift in Sources */ = {isa = PBXBuildFile; fileRef = 404C79752C3482790010EB81 /* AppIntentWidgetKinds.swift */; };
404C797F2C3491390010EB81 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = B69933931E232AEA0054453D /* Localizable.strings */; };
404C79802C3491390010EB81 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = B69933931E232AEA0054453D /* Localizable.strings */; };
4080D5BE2C319AA000099C88 /* WidgetDetailsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4080D5BD2C319AA000099C88 /* WidgetDetailsView.swift */; };
4080D5BF2C319AA000099C88 /* WidgetDetails.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4080D5BC2C319AA000099C88 /* WidgetDetails.swift */; };
4080D5C42C319B0A00099C88 /* WidgetDetailsAppIntent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4080D5C12C319B0A00099C88 /* WidgetDetailsAppIntent.swift */; };
Expand Down Expand Up @@ -604,11 +606,9 @@
42A818E32BBEA9780083D045 /* MockAudioRecorder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 42A818E22BBEA9780083D045 /* MockAudioRecorder.swift */; };
42A818E52BBEAA3A0083D045 /* MockAudioPlayer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 42A818E42BBEAA3A0083D045 /* MockAudioPlayer.swift */; };
42A818E72BBEAAE80083D045 /* MockAssistService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 42A818E62BBEAAE80083D045 /* MockAssistService.swift */; };
42AA4C842C2DACAD00EA2E99 /* UIImage+Circle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 42AA4C832C2DACAD00EA2E99 /* UIImage+Circle.swift */; };
42B1A7432C11E65100904548 /* WatchAssistService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 42B1A7422C11E65100904548 /* WatchAssistService.swift */; };
42B1A7452C1305C300904548 /* WatchCommunicatorService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 42B1A7442C1305C300904548 /* WatchCommunicatorService.swift */; };
42AA4C822C2DA56100EA2E99 /* SharedAssets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 420B10032B1CF6D800D383D8 /* SharedAssets.xcassets */; };
42AA4C842C2DACAD00EA2E99 /* UIImage+Circle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 42AA4C832C2DACAD00EA2E99 /* UIImage+Circle.swift */; };
42B94BDD2B9606CD00DEE060 /* AssistChatItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 42B94BDA2B9606CD00DEE060 /* AssistChatItem.swift */; };
42B94BDE2B9606CD00DEE060 /* AssistViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 42B94BDB2B9606CD00DEE060 /* AssistViewModel.swift */; };
42B94BDF2B9606CD00DEE060 /* AssistView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 42B94BDC2B9606CD00DEE060 /* AssistView.swift */; };
42B94BEC2B96083C00DEE060 /* AssistModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 42B94BE72B9607D100DEE060 /* AssistModel.swift */; };
Expand Down Expand Up @@ -1812,9 +1812,9 @@
42A818E22BBEA9780083D045 /* MockAudioRecorder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockAudioRecorder.swift; sourceTree = "<group>"; };
42A818E42BBEAA3A0083D045 /* MockAudioPlayer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockAudioPlayer.swift; sourceTree = "<group>"; };
42A818E62BBEAAE80083D045 /* MockAssistService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockAssistService.swift; sourceTree = "<group>"; };
42AA4C832C2DACAD00EA2E99 /* UIImage+Circle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIImage+Circle.swift"; sourceTree = "<group>"; };
42B1A7422C11E65100904548 /* WatchAssistService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WatchAssistService.swift; sourceTree = "<group>"; };
42B1A7442C1305C300904548 /* WatchCommunicatorService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WatchCommunicatorService.swift; sourceTree = "<group>"; };
42AA4C832C2DACAD00EA2E99 /* UIImage+Circle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIImage+Circle.swift"; sourceTree = "<group>"; };
42B94BDA2B9606CD00DEE060 /* AssistChatItem.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AssistChatItem.swift; sourceTree = "<group>"; };
42B94BDB2B9606CD00DEE060 /* AssistViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AssistViewModel.swift; sourceTree = "<group>"; };
42B94BDC2B9606CD00DEE060 /* AssistView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AssistView.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -3438,14 +3438,6 @@
path = Domains;
sourceTree = "<group>";
};
425573D82B57DDC700145217 /* Tests */ = {
isa = PBXGroup;
children = (
425573D92B57DDE000145217 /* WindowScenesManager.test.swift */,
);
path = Tests;
sourceTree = "<group>";
};
426266432C11B0070081A818 /* Watch */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -5331,6 +5323,7 @@
B606168B1D1F117700249C11 /* US-EN-Alexa-Motion-Detected-Generic.wav in Resources */,
4279407F2B8369EC001D7E14 /* AppIntentVocabulary.plist in Resources */,
B606168E1D1F117700249C11 /* US-EN-Alexa-Motion-In-Front-Yard.wav in Resources */,
404C797F2C3491390010EB81 /* Localizable.strings in Resources */,
B60616261D1F117700249C11 /* US-EN-Morgan-Freeman-Motion-In-Garage.wav in Resources */,
420B100C2B1D204400D383D8 /* Assets.xcassets in Resources */,
B60616941D1F117800249C11 /* US-EN-Alexa-Smoke-Detected-In-Garage.wav in Resources */,
Expand Down Expand Up @@ -5531,6 +5524,7 @@
buildActionMask = 2147483647;
files = (
B6CC5D882159D10E00833E5D /* Assets.xcassets in Resources */,
404C79802C3491390010EB81 /* Localizable.strings in Resources */,
B6CC5D862159D10D00833E5D /* Interface.storyboard in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down
30 changes: 15 additions & 15 deletions Sources/App/Resources/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -844,6 +844,7 @@ Home Assistant is free and open source home automation software with a focus on
"watch.labels.complication_text_areas.trailing.label" = "Trailing";
"watch.labels.no_action" = "No actions configured. Configure actions on your phone to dismiss this message.";
"watch.placeholder_complication_name" = "Placeholder";
"widgets.actions.parameters.action" = "Action";
"widgets.actions.description" = "Perform Home Assistant actions.";
"widgets.actions.not_configured" = "No Actions Configured";
"widgets.actions.title" = "Actions";
Expand All @@ -855,23 +856,22 @@ Home Assistant is free and open source home automation software with a focus on
"widgets.open_page.description" = "Open a frontend page in Home Assistant.";
"widgets.open_page.not_configured" = "No Pages Available";
"widgets.open_page.title" = "Open Page";
"widgets.gauge.gauge_type" = "Gauge Type";
"widgets.gauge.server" = "Server";
"widgets.gauge.value_template" = "Value Template (0-1)";
"widgets.gauge.value_label_template" = "Value Label Template";
"widgets.gauge.min_label_template" = "Min Label Template";
"widgets.gauge.max_label_template" = "Max Label Template";
"widgets.gauge.run_action" = "Run Action";
"widgets.gauge.action" = "Action";
"widgets.gauge.parameters.gauge_type" = "Gauge Type";
"widgets.gauge.parameters.server" = "Server";
"widgets.gauge.parameters.value_template" = "Value Template (0-1)";
"widgets.gauge.parameters.value_label_template" = "Value Label Template";
"widgets.gauge.parameters.min_label_template" = "Min Label Template";
"widgets.gauge.parameters.max_label_template" = "Max Label Template";
"widgets.gauge.parameters.run_action" = "Run Action";
"widgets.gauge.parameters.action" = "Action";
"widgets.gauge.description" = "Display numeric states from Home Assistant in a gauge";
"widgets.gauge.title" = "Gauge";
"widgets.details.server" = "Server";
"widgets.details.upper_template" = "Upper Text Template";
"widgets.details.lower_template" = "Lower Text Template";
"widgets.details.details_template" = "Details Text Template (only in rectangular family)";
"widgets.details.max_label_template" = "Max Label Template";
"widgets.details.run_action" = "Run Action (only in rectangular family)";
"widgets.details.action" = "Action";
"widgets.details.parameters.server" = "Server";
"widgets.details.parameters.upper_template" = "Upper Text Template";
"widgets.details.parameters.lower_template" = "Lower Text Template";
"widgets.details.parameters.details_template" = "Details Text Template (only in rectangular family)";
"widgets.details.parameters.run_action" = "Run Action (only in rectangular family)";
"widgets.details.parameters.action" = "Action";
"widgets.details.description" = "Display states using from Home Assistant in text";
"widgets.details.title" = "Details";
"yes_label" = "Yes";
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import Shared

@available(iOS 17.0, macOS 14.0, watchOS 10.0, *)
struct WidgetDetailsAppIntent: WidgetConfigurationIntent {
static let title: LocalizedStringResource = "Details"
static let description = IntentDescription("Display states using from Home Assistant in text")
static let title: LocalizedStringResource = "widgets.details.title"
static let description = IntentDescription("widgets.details.description")

@Parameter(title: "Server", default: nil)
@Parameter(title: "widgets.details.parameters.server", default: nil)
var server: IntentServerAppEntity

@Parameter(
title: "Upper Text Template",
title: "widgets.details.parameters.upper_template",
default: "",
inputOptions: .init(
capitalizationType: .none,
Expand All @@ -25,7 +25,7 @@ struct WidgetDetailsAppIntent: WidgetConfigurationIntent {
var upperTemplate: String

@Parameter(
title: "Lower Text Template",
title: "widgets.details.parameters.lower_template",
default: "",
inputOptions: .init(
capitalizationType: .none,
Expand All @@ -38,7 +38,7 @@ struct WidgetDetailsAppIntent: WidgetConfigurationIntent {
var lowerTemplate: String

@Parameter(
title: "Details Text Template (only in rectangular family)",
title: "widgets.details.parameters.details_template",
default: "",
inputOptions: .init(
capitalizationType: .none,
Expand All @@ -50,10 +50,10 @@ struct WidgetDetailsAppIntent: WidgetConfigurationIntent {
)
var detailsTemplate: String

@Parameter(title: "Run Action (only in rectangular family)", default: false)
@Parameter(title: "widgets.details.parameters.run_action", default: false)
var runAction: Bool

@Parameter(title: "Action", default: nil)
@Parameter(title: "widgets.details.parameters.action", default: nil)
var action: IntentActionAppEntity?

static var parameterSummary: some ParameterSummary {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ import Shared

@available(iOS 17.0, macOS 14.0, watchOS 10.0, *)
struct WidgetGaugeAppIntent: WidgetConfigurationIntent {
static let title: LocalizedStringResource = "Gauge"
static let description = IntentDescription("Display numeric states from Home Assistant in a gauge")
static let title: LocalizedStringResource = "widgets.gauge.title"
static let description = IntentDescription("widgets.gauge.description")

@Parameter(title: "Gauge Type", default: .normal)
@Parameter(title: "widgets.gauge.parameters.gauge_type", default: .normal)
var gaugeType: GaugeTypeAppEnum

@Parameter(title: "Server", default: nil)
@Parameter(title: "widgets.gauge.parameters.server", default: nil)
var server: IntentServerAppEntity

@Parameter(
title: "Value Template (0-1)",
title: "widgets.gauge.parameters.value_template",
default: "",
inputOptions: .init(
capitalizationType: .none,
Expand All @@ -28,7 +28,7 @@ struct WidgetGaugeAppIntent: WidgetConfigurationIntent {
var valueTemplate: String

@Parameter(
title: "Value Label Template",
title: "widgets.gauge.parameters.value_label_template",
default: "",
inputOptions: .init(
capitalizationType: .none,
Expand All @@ -41,7 +41,7 @@ struct WidgetGaugeAppIntent: WidgetConfigurationIntent {
var valueLabelTemplate: String

@Parameter(
title: "Min Label Template",
title: "widgets.gauge.parameters.min_label_template",
default: "",
inputOptions: .init(
capitalizationType: .none,
Expand All @@ -54,7 +54,7 @@ struct WidgetGaugeAppIntent: WidgetConfigurationIntent {
var minTemplate: String

@Parameter(
title: "Max Label Template",
title: "widgets.gauge.parameters.max_label_template",
default: "",
inputOptions: .init(
capitalizationType: .none,
Expand All @@ -66,10 +66,10 @@ struct WidgetGaugeAppIntent: WidgetConfigurationIntent {
)
var maxTemplate: String

@Parameter(title: "Run Action", default: false)
@Parameter(title: "widgets.gauge.parameters.run_action", default: false)
var runAction: Bool

@Parameter(title: "Action", default: nil)
@Parameter(title: "widgets.gauge.parameters.action", default: nil)
var action: IntentActionAppEntity?

static var parameterSummary: some ParameterSummary {
Expand Down
6 changes: 3 additions & 3 deletions Sources/Extensions/AppIntents/WidgetActionsAppIntent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ struct WidgetActionsAppIntent: AppIntent, WidgetConfigurationIntent, CustomInten
ProgressReportingIntent {
static let intentClassName = "WidgetActionsIntent"

static let title: LocalizedStringResource = "Actions"
static let description = IntentDescription("View and run actions")
static let title: LocalizedStringResource = "widgets.actions.title"
static let description = IntentDescription("widgets.actions.description")

@Parameter(
title: "Actions",
title: "widgets.actions.parameters.action",
size: [
.systemSmall: 1,
.systemMedium: 8,
Expand Down
66 changes: 36 additions & 30 deletions Sources/Shared/Resources/Swiftgen/Strings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2857,6 +2857,10 @@ public enum L10n {
public static var notConfigured: String { return L10n.tr("Localizable", "widgets.actions.not_configured") }
/// Actions
public static var title: String { return L10n.tr("Localizable", "widgets.actions.title") }
public enum Parameters {
/// Action
public static var action: String { return L10n.tr("Localizable", "widgets.actions.parameters.action") }
}
}
public enum Assist {
/// Ask Assist
Expand All @@ -2873,46 +2877,48 @@ public enum L10n {
public static var reloadTimeline: String { return L10n.tr("Localizable", "widgets.button.reload_timeline") }
}
public enum Details {
/// Action
public static var action: String { return L10n.tr("Localizable", "widgets.details.action") }
/// Display states using from Home Assistant in text
public static var description: String { return L10n.tr("Localizable", "widgets.details.description") }
/// Details Text Template (only in rectangular family)
public static var detailsTemplate: String { return L10n.tr("Localizable", "widgets.details.details_template") }
/// Lower Text Template
public static var lowerTemplate: String { return L10n.tr("Localizable", "widgets.details.lower_template") }
/// Max Label Template
public static var maxLabelTemplate: String { return L10n.tr("Localizable", "widgets.details.max_label_template") }
/// Run Action (only in rectangular family)
public static var runAction: String { return L10n.tr("Localizable", "widgets.details.run_action") }
/// Server
public static var server: String { return L10n.tr("Localizable", "widgets.details.server") }
/// Details
public static var title: String { return L10n.tr("Localizable", "widgets.details.title") }
/// Upper Text Template
public static var upperTemplate: String { return L10n.tr("Localizable", "widgets.details.upper_template") }
public enum Parameters {
/// Action
public static var action: String { return L10n.tr("Localizable", "widgets.details.parameters.action") }
/// Details Text Template (only in rectangular family)
public static var detailsTemplate: String { return L10n.tr("Localizable", "widgets.details.parameters.details_template") }
/// Lower Text Template
public static var lowerTemplate: String { return L10n.tr("Localizable", "widgets.details.parameters.lower_template") }
/// Run Action (only in rectangular family)
public static var runAction: String { return L10n.tr("Localizable", "widgets.details.parameters.run_action") }
/// Server
public static var server: String { return L10n.tr("Localizable", "widgets.details.parameters.server") }
/// Upper Text Template
public static var upperTemplate: String { return L10n.tr("Localizable", "widgets.details.parameters.upper_template") }
}
}
public enum Gauge {
/// Action
public static var action: String { return L10n.tr("Localizable", "widgets.gauge.action") }
/// Display numeric states from Home Assistant in a gauge
public static var description: String { return L10n.tr("Localizable", "widgets.gauge.description") }
/// Gauge Type
public static var gaugeType: String { return L10n.tr("Localizable", "widgets.gauge.gauge_type") }
/// Max Label Template
public static var maxLabelTemplate: String { return L10n.tr("Localizable", "widgets.gauge.max_label_template") }
/// Min Label Template
public static var minLabelTemplate: String { return L10n.tr("Localizable", "widgets.gauge.min_label_template") }
/// Run Action
public static var runAction: String { return L10n.tr("Localizable", "widgets.gauge.run_action") }
/// Server
public static var server: String { return L10n.tr("Localizable", "widgets.gauge.server") }
/// Gauge
public static var title: String { return L10n.tr("Localizable", "widgets.gauge.title") }
/// Value Label Template
public static var valueLabelTemplate: String { return L10n.tr("Localizable", "widgets.gauge.value_label_template") }
/// Value Template (0-1)
public static var valueTemplate: String { return L10n.tr("Localizable", "widgets.gauge.value_template") }
public enum Parameters {
/// Action
public static var action: String { return L10n.tr("Localizable", "widgets.gauge.parameters.action") }
/// Gauge Type
public static var gaugeType: String { return L10n.tr("Localizable", "widgets.gauge.parameters.gauge_type") }
/// Max Label Template
public static var maxLabelTemplate: String { return L10n.tr("Localizable", "widgets.gauge.parameters.max_label_template") }
/// Min Label Template
public static var minLabelTemplate: String { return L10n.tr("Localizable", "widgets.gauge.parameters.min_label_template") }
/// Run Action
public static var runAction: String { return L10n.tr("Localizable", "widgets.gauge.parameters.run_action") }
/// Server
public static var server: String { return L10n.tr("Localizable", "widgets.gauge.parameters.server") }
/// Value Label Template
public static var valueLabelTemplate: String { return L10n.tr("Localizable", "widgets.gauge.parameters.value_label_template") }
/// Value Template (0-1)
public static var valueTemplate: String { return L10n.tr("Localizable", "widgets.gauge.parameters.value_template") }
}
}
public enum OpenPage {
/// Open a frontend page in Home Assistant.
Expand Down

0 comments on commit d32bd63

Please sign in to comment.