Skip to content

Commit

Permalink
first localisation strings
Browse files Browse the repository at this point in the history
  • Loading branch information
herzhenr committed Aug 29, 2023
1 parent df3df6e commit 0f52936
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 5 deletions.
41 changes: 41 additions & 0 deletions lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,47 @@
"homeDeviceCardOnline": "Device is online",
"homeDeviceCardOffline": "Device is offline",
"homeWolCardTitle": "Waking up...",
"homeWolCardIp": "'{ip}' is an invalid IPv4 address",
"@homeWolCardIp": {
"placeholders": {
"ip": {
"type": "String",
"example": "192.168.0.1"
}
}
},
"homeWolCardMac": "'{mac}' is an invalid MAC address",
"@homeWolCardMac": {
"placeholders": {
"mac": {
"type": "String",
"example": "12:AB:00:00:00:00"
}
}
},
"homeWolCardPort": "'{port}' is an invalid port",
"@homeWolCardPort": {
"placeholders": {
"port": {
"type": "String",
"example": "9"
}
}
},
"homeWolCardValid": "Provided device details are valid",
"homeWolCardInvalid": "There was an error trying to send a WOL Package",
"homeWolCardPingInfo": "Trying to ping device until it is online...",
"homeWolCardPing": "Sending ping #{count}",
"@homeWolCardPing": {
"placeholders": {
"count": {
"type": "String",
"example": "1"
}
}
},
"homeWolCardPingSuccess": "Device is online",
"homeWolCardPingFail": "Device is still offline",
"@DISCOVER": {},
"discoverTitle": "Discover Devices",
"discoverCardTitle": "Network Scan",
Expand Down
10 changes: 5 additions & 5 deletions lib/services/network.dart
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,12 @@ Stream<Message> sendWolPackage({required NetworkDevice device}) async* {
bool invalid = false;

if (!IPv4Address.validate(ip)) {
yield Message(text: "'$ip' is a invalid IPv4 address", type: MsgType.error);
yield Message(text: "'$ip' is an invalid IPv4 address", type: MsgType.error);
invalid = true;
}

if (!MACAddress.validate(mac)) {
yield Message(text: "'$mac' is a invalid MAC address", type: MsgType.error);
yield Message(text: "'$mac' is an invalid MAC address", type: MsgType.error);
invalid = true;
}

Expand All @@ -85,12 +85,12 @@ Stream<Message> sendWolPackage({required NetworkDevice device}) async* {
}

if (invalid) {
// yield Message(text: "There was a error when trying to send a WOL Package to this host", type: MsgType.error);
yield Message(text: "There was an error trying to send a WOL Package", type: MsgType.error);
return;
}

// if no error occurred: try to send wol package
yield Message(text: "Provided ip and mac address are both valid");
yield Message(text: "Provided device details are valid");
yield Message(text: "Trying to send WOL Packages");

IPv4Address ipv4Address = IPv4Address(ip);
Expand All @@ -112,7 +112,7 @@ Stream<Message> sendWolPackage({required NetworkDevice device}) async* {
text: "Successfully send WOL packages to $ip", type: MsgType.check);
} catch (e) {
yield Message(
text: "There was a error when trying to send WOL Packages to this host",
text: "There was an error when trying to send WOL Packages to this host",
type: MsgType.error);
}

Expand Down

0 comments on commit 0f52936

Please sign in to comment.