[PATCHv2,08/12] extrahd.cgi: Add missing translation strings

Message ID 20230801154839.2373-8-stefan.schantl@ipfire.org
State Staged
Commit 72dfa1b0975bada9bde68fc11aed433c4899235e
Headers
Series [PATCHv2,01/12] extrahd.cgi: Add various perl functions deal with block devices |

Commit Message

Stefan Schantl Aug. 1, 2023, 3:48 p.m. UTC
  Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
---
 html/cgi-bin/extrahd.cgi | 21 ++++++++++++---------
 langs/de/cgi-bin/de.pl   |  5 +++++
 langs/en/cgi-bin/en.pl   |  5 +++++
 3 files changed, 22 insertions(+), 9 deletions(-)
  

Comments

Bernhard Bitsch Aug. 2, 2023, 12:02 p.m. UTC | #1
Reviewed-by: Bernhard Bitsch <bbitsch@ipfire.org>


Am 01.08.2023 um 17:48 schrieb Stefan Schantl:
> Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
> ---
>   html/cgi-bin/extrahd.cgi | 21 ++++++++++++---------
>   langs/de/cgi-bin/de.pl   |  5 +++++
>   langs/en/cgi-bin/en.pl   |  5 +++++
>   3 files changed, 22 insertions(+), 9 deletions(-)
> 
> diff --git a/html/cgi-bin/extrahd.cgi b/html/cgi-bin/extrahd.cgi
> index de5f26d0e..0b59a02f7 100644
> --- a/html/cgi-bin/extrahd.cgi
> +++ b/html/cgi-bin/extrahd.cgi
> @@ -98,14 +98,17 @@ $extrahdsettings{'UUID'} = '';
>   ## Add a new device.
>   #
>   if ($extrahdsettings{'ACTION'} eq $Lang::tr{'add'}) {
> +	# Check if a mount path has been given.
> +	if (not $extrahdsettings{'PATH'}) {
> +		$errormessage = "$Lang::tr{'extrahd no mount point given'}.";
> +	
>   	# Check if a valid mount path has been choosen.
> -	unless(&is_valid_dir("$extrahdsettings{'PATH'}")) {
> -		$errormessage = "$Lang::tr{'extrahd you cant mount'} $extrahdsettings{'DEVICE'} $Lang::tr{'extrahd to root'}.";
> -	}
> +	} elsif(not &is_valid_dir("$extrahdsettings{'PATH'}")) {
> +		$errormessage = "$Lang::tr{'extrahd you cant mount'} $extrahdsettings{'DEVICE'} $Lang::tr{'extrahd to'} $extrahdsettings{'PATH'} $Lang::tr{'extrahd because it is outside the allowed mount path'}.";
>   
>   	# Check if the given path allready is mounted somewhere.
> -	if(&is_mounted("$extrahdsettings{'PATH'}")) {
> -		$errormessage = "$Lang::tr{'extrahd you cant mount'} $extrahdsettings{'DEVICE'} $Lang::tr{'extrahd to'} $extrahdsettings{'PATH'}$Lang::tr{'extrahd because there is already a device mounted'}.";
> +	} elsif(&is_mounted("$extrahdsettings{'PATH'}")) {
> +		$errormessage = "$Lang::tr{'extrahd you cant mount'} $extrahdsettings{'DEVICE'} $Lang::tr{'extrahd to'} $extrahdsettings{'PATH'} $Lang::tr{'extrahd because there is already a device mounted'}.";
>   	}
>   
>   	# Check against may previously configured drives.
> @@ -122,7 +125,7 @@ if ($extrahdsettings{'ACTION'} eq $Lang::tr{'add'}) {
>   
>   			# Check if the path is allready used.
>   			if ( "$extrahdsettings{'PATH'}" eq "$path" ) {
> -				$errormessage = "$Lang::tr{'extrahd you cant mount'} $extrahdsettings{'DEVICE'} $Lang::tr{'extrahd to'} $extrahdsettings{'PATH'}$Lang::tr{'extrahd because there is already a device mounted'}.";
> +				$errormessage = "$Lang::tr{'extrahd you cant mount'} $extrahdsettings{'DEVICE'} $Lang::tr{'extrahd to'} $extrahdsettings{'PATH'} $Lang::tr{'extrahd because there is already a device mounted'}.";
>   			}
>   
>   			# Check if the uuid is allready used.
> @@ -318,16 +321,16 @@ END
>   
>   						# Check if the device is mounted properly.
>   						if(&is_mounted($mountpoint)) {
> -							print "<img src='/images/updbooster/updxl-led-green.gif' alt='MOUNTED' title='MOUNTED'>&nbsp;\n";
> +							print "<img src='/images/updbooster/updxl-led-green.gif' alt='$Lang::tr{'extrahd mounted'}' title='$Lang::tr{'extrahd mounted'}'>&nbsp;\n";
>   						} else {
> -							print "<img src='/images/updbooster/updxl-led-red.gif' alt='NOT MOUNTED' title='NOT MOUNTED'>&nbsp;\n";
> +							print "<img src='/images/updbooster/updxl-led-red.gif' alt='$Lang::tr{'extrahd not mounted'}' title='$Lang::tr{'extrahd not mounted'}'>&nbsp;\n";
>   						}
>   
>   						print "<input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/delete.gif'>\n";
>   					} else {
>   						unless($disabled) {
>   							print "<input type='hidden' name='ACTION' value='$Lang::tr{'add'}'>\n";
> -							print "<img src='/images/updbooster/updxl-led-gray.gif' alt='UNCONFIGURED' title='UNCONFIGURED'>&nbsp;\n";
> +							print "<img src='/images/updbooster/updxl-led-gray.gif' alt='$Lang::tr{'extrahd not configured'}' title='$Lang::tr{'extrahd not configured'}'>&nbsp;\n";
>   							print "<input type='image' alt='$Lang::tr{'add'}' title='$Lang::tr{'add'}' src='/images/add.gif'>\n";
>   						}
>   					}
> diff --git a/langs/de/cgi-bin/de.pl b/langs/de/cgi-bin/de.pl
> index 33730f0c3..37b17b431 100644
> --- a/langs/de/cgi-bin/de.pl
> +++ b/langs/de/cgi-bin/de.pl
> @@ -1025,11 +1025,16 @@
>   'external access rule removed' => ' Regel für externen Zugang entfernt; starte Zugangskontroller neu',
>   'external aliases configuration' => 'Externe Alias-Konfiguration',
>   'extrahd' => 'ExtraHD',
> +'extrahd because it is outside the allowed mount path' => 'mounten, da sich das Ziel außerhalb der erlaubten Pfade befindet',
>   'extrahd because there is already a device mounted' => ' mounten, weil bereits ein Gerät gemountet ist',
>   'extrahd cant umount' => 'Konnte',
>   'extrahd detected drives' => 'Gefundene Laufwerke',
>   'extrahd install or load driver' => 'Wenn Ihre Festplatte nicht angezeigt wird, müssen Sie zuerst den Treiber laden oder ggf. auch nachinstallieren. Wenn diese jedoch angezeigt wird, aber keine Partitionen zu sehen sind, müssen diese erst angelegt werden.',
>   'extrahd maybe the device is in use' => 'nicht mounten. Vielleicht wird das Gerät bereits verwendet',
> +'extrahd no mount point given' => 'Kein Pfad zum mounten angegeben',
> +'extrahd mounted' => 'Gemounted',
> +'extrahd not mounted' => 'Nicht gemounted',
> +'extrahd not configured' => 'Nicht konfiguriert',
>   'extrahd to' => 'nicht nach',
>   'extrahd to root' => 'nicht nach root mounten',
>   'extrahd unable to read' => 'Lesefehler von',
> diff --git a/langs/en/cgi-bin/en.pl b/langs/en/cgi-bin/en.pl
> index 729516538..b00ecc5eb 100644
> --- a/langs/en/cgi-bin/en.pl
> +++ b/langs/en/cgi-bin/en.pl
> @@ -1072,11 +1072,16 @@
>   'external access rule removed' => ' External access rule removed; restarting access controller',
>   'external aliases configuration' => 'External aliases configuration',
>   'extrahd' => 'ExtraHD',
> +'extrahd because it it outside the allowed mount path' => ', because it is outside the allowed mount path',
>   'extrahd because there is already a device mounted' => ', because there is already a device mounted',
>   'extrahd cant umount' => 'Can\'t umount',
>   'extrahd detected drives' => 'detected drives',
>   'extrahd install or load driver' => 'If your device isn\'t listed here, you need to install or load the driver.<br />If you can see your device but no partitions you have to create them first.',
> +'extrahd no mount point given', => 'No mount point given',
>   'extrahd maybe the device is in use' => '. Maybe the device is in use',
> +'extrahd mounted' => 'Mounted',
> +'extrahd not mounted' => 'Not mounted',
> +'extrahd not configured' => 'Not configured',
>   'extrahd to' => 'to',
>   'extrahd to root' => 'to root',
>   'extrahd unable to read' => 'Unable to read',
  

Patch

diff --git a/html/cgi-bin/extrahd.cgi b/html/cgi-bin/extrahd.cgi
index de5f26d0e..0b59a02f7 100644
--- a/html/cgi-bin/extrahd.cgi
+++ b/html/cgi-bin/extrahd.cgi
@@ -98,14 +98,17 @@  $extrahdsettings{'UUID'} = '';
 ## Add a new device.
 #
 if ($extrahdsettings{'ACTION'} eq $Lang::tr{'add'}) {
+	# Check if a mount path has been given.
+	if (not $extrahdsettings{'PATH'}) {
+		$errormessage = "$Lang::tr{'extrahd no mount point given'}.";
+	
 	# Check if a valid mount path has been choosen.
-	unless(&is_valid_dir("$extrahdsettings{'PATH'}")) {
-		$errormessage = "$Lang::tr{'extrahd you cant mount'} $extrahdsettings{'DEVICE'} $Lang::tr{'extrahd to root'}.";
-	}
+	} elsif(not &is_valid_dir("$extrahdsettings{'PATH'}")) {
+		$errormessage = "$Lang::tr{'extrahd you cant mount'} $extrahdsettings{'DEVICE'} $Lang::tr{'extrahd to'} $extrahdsettings{'PATH'} $Lang::tr{'extrahd because it is outside the allowed mount path'}.";
 
 	# Check if the given path allready is mounted somewhere.
-	if(&is_mounted("$extrahdsettings{'PATH'}")) {
-		$errormessage = "$Lang::tr{'extrahd you cant mount'} $extrahdsettings{'DEVICE'} $Lang::tr{'extrahd to'} $extrahdsettings{'PATH'}$Lang::tr{'extrahd because there is already a device mounted'}.";
+	} elsif(&is_mounted("$extrahdsettings{'PATH'}")) {
+		$errormessage = "$Lang::tr{'extrahd you cant mount'} $extrahdsettings{'DEVICE'} $Lang::tr{'extrahd to'} $extrahdsettings{'PATH'} $Lang::tr{'extrahd because there is already a device mounted'}.";
 	}
 
 	# Check against may previously configured drives.
@@ -122,7 +125,7 @@  if ($extrahdsettings{'ACTION'} eq $Lang::tr{'add'}) {
 
 			# Check if the path is allready used.
 			if ( "$extrahdsettings{'PATH'}" eq "$path" ) {
-				$errormessage = "$Lang::tr{'extrahd you cant mount'} $extrahdsettings{'DEVICE'} $Lang::tr{'extrahd to'} $extrahdsettings{'PATH'}$Lang::tr{'extrahd because there is already a device mounted'}.";
+				$errormessage = "$Lang::tr{'extrahd you cant mount'} $extrahdsettings{'DEVICE'} $Lang::tr{'extrahd to'} $extrahdsettings{'PATH'} $Lang::tr{'extrahd because there is already a device mounted'}.";
 			}
 
 			# Check if the uuid is allready used.
@@ -318,16 +321,16 @@  END
 
 						# Check if the device is mounted properly.
 						if(&is_mounted($mountpoint)) {
-							print "<img src='/images/updbooster/updxl-led-green.gif' alt='MOUNTED' title='MOUNTED'>&nbsp;\n";
+							print "<img src='/images/updbooster/updxl-led-green.gif' alt='$Lang::tr{'extrahd mounted'}' title='$Lang::tr{'extrahd mounted'}'>&nbsp;\n";
 						} else {
-							print "<img src='/images/updbooster/updxl-led-red.gif' alt='NOT MOUNTED' title='NOT MOUNTED'>&nbsp;\n";
+							print "<img src='/images/updbooster/updxl-led-red.gif' alt='$Lang::tr{'extrahd not mounted'}' title='$Lang::tr{'extrahd not mounted'}'>&nbsp;\n";
 						}
 
 						print "<input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/delete.gif'>\n";
 					} else {
 						unless($disabled) {
 							print "<input type='hidden' name='ACTION' value='$Lang::tr{'add'}'>\n";
-							print "<img src='/images/updbooster/updxl-led-gray.gif' alt='UNCONFIGURED' title='UNCONFIGURED'>&nbsp;\n";
+							print "<img src='/images/updbooster/updxl-led-gray.gif' alt='$Lang::tr{'extrahd not configured'}' title='$Lang::tr{'extrahd not configured'}'>&nbsp;\n";
 							print "<input type='image' alt='$Lang::tr{'add'}' title='$Lang::tr{'add'}' src='/images/add.gif'>\n";
 						}
 					}
diff --git a/langs/de/cgi-bin/de.pl b/langs/de/cgi-bin/de.pl
index 33730f0c3..37b17b431 100644
--- a/langs/de/cgi-bin/de.pl
+++ b/langs/de/cgi-bin/de.pl
@@ -1025,11 +1025,16 @@ 
 'external access rule removed' => ' Regel für externen Zugang entfernt; starte Zugangskontroller neu',
 'external aliases configuration' => 'Externe Alias-Konfiguration',
 'extrahd' => 'ExtraHD',
+'extrahd because it is outside the allowed mount path' => 'mounten, da sich das Ziel außerhalb der erlaubten Pfade befindet',
 'extrahd because there is already a device mounted' => ' mounten, weil bereits ein Gerät gemountet ist',
 'extrahd cant umount' => 'Konnte',
 'extrahd detected drives' => 'Gefundene Laufwerke',
 'extrahd install or load driver' => 'Wenn Ihre Festplatte nicht angezeigt wird, müssen Sie zuerst den Treiber laden oder ggf. auch nachinstallieren. Wenn diese jedoch angezeigt wird, aber keine Partitionen zu sehen sind, müssen diese erst angelegt werden.',
 'extrahd maybe the device is in use' => 'nicht mounten. Vielleicht wird das Gerät bereits verwendet',
+'extrahd no mount point given' => 'Kein Pfad zum mounten angegeben',
+'extrahd mounted' => 'Gemounted',
+'extrahd not mounted' => 'Nicht gemounted',
+'extrahd not configured' => 'Nicht konfiguriert',
 'extrahd to' => 'nicht nach',
 'extrahd to root' => 'nicht nach root mounten',
 'extrahd unable to read' => 'Lesefehler von',
diff --git a/langs/en/cgi-bin/en.pl b/langs/en/cgi-bin/en.pl
index 729516538..b00ecc5eb 100644
--- a/langs/en/cgi-bin/en.pl
+++ b/langs/en/cgi-bin/en.pl
@@ -1072,11 +1072,16 @@ 
 'external access rule removed' => ' External access rule removed; restarting access controller',
 'external aliases configuration' => 'External aliases configuration',
 'extrahd' => 'ExtraHD',
+'extrahd because it it outside the allowed mount path' => ', because it is outside the allowed mount path',
 'extrahd because there is already a device mounted' => ', because there is already a device mounted',
 'extrahd cant umount' => 'Can\'t umount',
 'extrahd detected drives' => 'detected drives',
 'extrahd install or load driver' => 'If your device isn\'t listed here, you need to install or load the driver.<br />If you can see your device but no partitions you have to create them first.',
+'extrahd no mount point given', => 'No mount point given',
 'extrahd maybe the device is in use' => '. Maybe the device is in use',
+'extrahd mounted' => 'Mounted',
+'extrahd not mounted' => 'Not mounted',
+'extrahd not configured' => 'Not configured',
 'extrahd to' => 'to',
 'extrahd to root' => 'to root',
 'extrahd unable to read' => 'Unable to read',