Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fall back from exporting colons from text string
Signed-off-by: Valdnet <[email protected]>
  • Loading branch information
Valdnet authored Nov 27, 2021
commit fbb6c29dc3c42b41b7507a781039cd34332fd0ac
36 changes: 18 additions & 18 deletions templates/settings-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,18 @@ function FormatMegabytes(int $byte): string {
</h2>
</div>
<div class="col col-12">
<p><?php p($l->t('Operating System:')); ?> <strong id="numFilesStorage"><?php p($_['osname']); ?></strong></p>
<p><?php p($l->t('CPU:')); ?>
<p><?php p($l->t('Operating System').':'); ?> <strong id="numFilesStorage"><?php p($_['osname']); ?></strong></p>
<p><?php p($l->t('CPU').':'); ?>
Comment on lines +59 to +60
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<p><?php p($l->t('Operating System').':'); ?> <strong id="numFilesStorage"><?php p($_['osname']); ?></strong></p>
<p><?php p($l->t('CPU').':'); ?>
<p><?php p($l->t('Operating System:')); ?> <strong id="numFilesStorage"><?php p($_['osname']); ?></strong></p>
<p><?php p($l->t('CPU:')); ?>

etc so french translators can add their space before the colon

<?php if ($_['cpu'] !== 'Unknown Processor'): ?>
<strong id="numFilesStorage"><?php p($_['cpu']) ?></strong></p>
<?php else: ?>
<strong id="numFilesStorage"><?php p($l->t('Unknown Processor')) ?></strong></p>
<?php endif; ?>
<p><?php p($l->t('Memory:')); ?>
<p><?php p($l->t('Memory').':'); ?>
<?php if ($memory->getMemTotal() > 0): ?> <strong id="numFilesStorage"><?php p(FormatMegabytes($memory->getMemTotal())) ?></strong></p>
<?php endif; ?>
<p><?php p($l->t('Server time:')); ?> <strong id="numFilesStorage"><span class="info" id="servertime"></span></strong></p>
<p><?php p($l->t('Uptime:')); ?> <strong id="numFilesStorage"><span class="info" id="uptime"></span></strong></p>
<p><?php p($l->t('Server time').':'); ?> <strong id="numFilesStorage"><span class="info" id="servertime"></span></strong></p>
<p><?php p($l->t('Uptime').':'); ?> <strong id="numFilesStorage"><span class="info" id="uptime"></span></strong></p>
</div>
</div>
</div>
Expand Down Expand Up @@ -142,10 +142,10 @@ function FormatMegabytes(int $byte): string {
<?php p($l->t('You will get a notification once one of your disks is nearly full.')); ?>
</div>

<p><?php p($l->t('Files:')); ?> <strong id="numFilesStorage"><?php p($_['storage']['num_files']); ?></strong></p>
<p><?php p($l->t('Storages:')); ?> <strong id="numFilesStorages"><?php p($_['storage']['num_storages']); ?></strong></p>
<p><?php p($l->t('Files').':'); ?> <strong id="numFilesStorage"><?php p($_['storage']['num_files']); ?></strong></p>
<p><?php p($l->t('Storages').':'); ?> <strong id="numFilesStorages"><?php p($_['storage']['num_storages']); ?></strong></p>
<?php if ($_['system']['freespace'] !== null): ?>
<p><?php p($l->t('Free Space:')); ?> <strong id="systemDiskFreeSpace"><?php p($_['system']['freespace']); ?></strong></p>
<p><?php p($l->t('Free Space').':'); ?> <strong id="systemDiskFreeSpace"><?php p($_['system']['freespace']); ?></strong></p>
<?php endif; ?>
</div>

Expand Down Expand Up @@ -224,7 +224,7 @@ class="barchart"
></canvas>
</div>
<p>
<?php p($l->t('Total users:')); ?>
<?php p($l->t('Total users').':'); ?>
<em id="numUsersStorage"><?php p($_['storage']['num_users']); ?></em>
</p>
</div>
Expand Down Expand Up @@ -266,19 +266,19 @@ class="barchart"
<div class="infobox">
<div class="phpinfo-wrapper">
<p>
<?php p($l->t('Version:')); ?>
<?php p($l->t('Version').':'); ?>
<em id="phpVersion"><?php p($_['php']['version']); ?></em>
</p>
<p>
<?php p($l->t('Memory limit:')); ?>
<?php p($l->t('Memory limit').':'); ?>
<em id="phpMemLimit"><?php p($_['php']['memory_limit']); ?></em>
</p>
<p>
<?php p($l->t('Max execution time:')); ?>
<?php p($l->t('Max execution time').':'); ?>
<em id="phpMaxExecTime"><?php p($_['php']['max_execution_time']); ?></em>
</p>
<p>
<?php p($l->t('Upload max size:')); ?>
<?php p($l->t('Upload max size').':'); ?>
<em id="phpUploadMaxSize"><?php p($_['php']['upload_max_filesize']); ?></em>
</p>
</div>
Expand All @@ -294,15 +294,15 @@ class="barchart"
<div class="infobox">
<div class="database-wrapper">
<p>
<?php p($l->t('Type:')); ?>
<?php p($l->t('Type').':'); ?>
Comment on lines -307 to +297
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The colon should always be part of the translated string, as it may be changed by the translation.
For instance in French a (small nonbreakable) space is expected before a double punctuation like a colon.

Copy link
Contributor Author

@Valdnet Valdnet Apr 26, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, you are absolutely right 👍, but in this case an exception is made, because using a colon in this PHP code with an entire text string means that the entire text string in the application is not displayed 😬. This was one of the problems that this change arose. I haven't found any other sensible solution to this problem, which doesn't mean it needs to be corrected.
I would like to ask developers who know more about PHP programming to look at this code, and maybe they will find a solution, and will be happy to implement it, so that French translators can correctly translate these text strings.

@nickvergessen could you have a look at it and advise us something?

@come-nc Unless you know the solution to this problem?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I already mentioned it here that this is necessary: https://github.com/nextcloud/serverinfo/pull/333/files#r752009811

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lemme checkout the branch and move it in, to see what breaks but it makes no sense to break

Copy link
Contributor Author

@Valdnet Valdnet Apr 26, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I already mentioned it here that this is necessary: https://github.com/nextcloud/serverinfo/pull/333/files#r752009811

@nickvergessen Yes, I know this and I remember it, but after using a colon text string, I do not know why, but this text string is not displayed at all. This was a problem before. Cannot use a colon in a text string in PHP?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<em id="databaseType"><?php p($_['database']['type']); ?></em>
</p>
<p>
<?php p($l->t('Version:')); ?>
<?php p($l->t('Version').':'); ?>
<em id="databaseVersion"><?php p($_['database']['version']); ?></em>
</p>
<p>
<?php p($l->t('Size:')); ?>
<?php p($l->t('Size').':'); ?>
<em id="databaseSize"><?php p($_['database']['size']); ?></em>
</p>
</div>
Expand All @@ -318,7 +318,7 @@ class="barchart"
<!-- OCS ENDPOINT -->
<h2><?php p($l->t('External monitoring tool')); ?></h2>
<p>
<?php p($l->t('You can connect an external monitoring tool by using this end point:')); ?>
<?php p($l->t('You can connect an external monitoring tool by using this end point').':'); ?>
</p>
<div class="monitoring-wrapper">
<input type="text" readonly="readonly" id="monitoring-endpoint-url" value="<?php echo p($_['ocs']); ?>"/>
Expand All @@ -328,7 +328,7 @@ class="barchart"
<?php p($l->t('Appending "?format=json" at the end of the URL gives you the result in JSON.')); ?>
</p>
<p>
<?php p($l->t('To use an access token please generate one then set it using the following command:')); ?>
<?php p($l->t('To use an access token please generate one then set it using the following command').':'); ?>
<div><i>occ config:app:set serverinfo token --value yourtoken</i></div>
</p>
<p>
Expand Down