Skip to content

Commit

Permalink
translate all in HTML
Browse files Browse the repository at this point in the history
Signed-off-by: Tomasz Wilczyński <twilczynski@naver.com>
  • Loading branch information
tomasz1986 committed Jan 26, 2024
1 parent 0246a48 commit 3299f4f
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 36 deletions.
1 change: 1 addition & 0 deletions gui/default/assets/lang/lang-en.json
Expand Up @@ -28,6 +28,7 @@
"Alphabetic": "Alphabetic",
"Altered by ignoring deletes.": "Altered by ignoring deletes.",
"Always enabled when the folder type is \"{%foldertype%}\".": "Always enabled when the folder type is \"{{foldertype}}\".",
"Always turned on when the folder type is \"{%foldertype%}\".": "Always turned on when the folder type is \"{{foldertype}}\".",
"An external command handles the versioning. It has to remove the file from the shared folder. If the path to the application contains spaces, it should be quoted.": "An external command handles the versioning. It has to remove the file from the shared folder. If the path to the application contains spaces, it should be quoted.",
"Anonymous Usage Reporting": "Anonymous Usage Reporting",
"Anonymous usage report format has changed. Would you like to move to the new format?": "Anonymous usage report format has changed. Would you like to move to the new format?",
Expand Down
7 changes: 6 additions & 1 deletion gui/default/index.html
Expand Up @@ -497,7 +497,12 @@ <h4 class="panel-title">
</tr>
<tr>
<th><span class="fas fa-fw fa-folder"></span>&nbsp;<span translate>Folder Type</span></th>
<td class="text-right">{{friendlyNameFromFolderType(folder.type).replace('&amp;amp;', '&amp;')}}</td>
<td class="text-right">
<span ng-if="folder.type == 'sendreceive'" translate>Send &amp; Receive</span>
<span ng-if="folder.type == 'sendonly'" translate>Send Only</span>
<span ng-if="folder.type == 'receiveonly'" translate>Receive Only</span>
<span ng-if="folder.type == 'receiveencrypted'" translate>Receive Encrypted</span>
</td>
</tr>
<tr ng-if="folder.ignorePerms">
<th><span class="far fa-fw fa-minus-square"></span>&nbsp;<span translate>Ignore Permissions</span></th>
Expand Down
19 changes: 0 additions & 19 deletions gui/default/syncthing/core/syncthingController.js
Expand Up @@ -1477,25 +1477,6 @@ angular.module('syncthing.core')
return deviceID.substr(0, shortIDStringLength);
};

// Remember to replace doubled "&amp;amp;" in HTML to work around the
// never-fixed angular-translate bug that doubles sanitised special
// characters. In our case, this applies to "&" in "Send & Receive".
// Ref: https://github.com/angular-translate/angular-translate/issues/1101
$scope.friendlyNameFromFolderType = function (folderType) {
switch (folderType) {
case 'receiveencrypted':
return $translate.instant("Receive Encrypted");
case 'receiveonly':
return $translate.instant("Receive Only");
case 'sendonly':
return $translate.instant("Send Only");
case 'sendreceive':
return $translate.instant("Send & Receive");
default:
return folderType;
}
};

$scope.deviceName = function (deviceCfg) {
if (typeof deviceCfg === 'undefined') {
return "";
Expand Down
28 changes: 14 additions & 14 deletions gui/default/syncthing/folder/editFolderModalView.html
Expand Up @@ -227,16 +227,16 @@
<label translate>Folder Type</label>
&nbsp;<a href="{{docsURL('users/foldertypes')}}" target="_blank"><span class="fas fa-question-circle"></span>&nbsp;<span translate>Help</span></a>
<select class="form-control" ng-change="setDefaultsForFolderType()" ng-model="currentFolder.type" ng-disabled="editingFolderExisting() && currentFolder.type == 'receiveencrypted'">
<option value="sendreceive">{{friendlyNameFromFolderType('sendreceive').replace('&amp;amp;', '&amp;')}}</option>
<option value="sendonly">{{friendlyNameFromFolderType('sendonly')}}</option>
<option value="receiveonly">{{friendlyNameFromFolderType('receiveonly')}}</option>
<option value="receiveencrypted" ng-disabled="editingFolderExisting()">{{friendlyNameFromFolderType('receiveencrypted')}}</option>
<option value="sendreceive" translate>Send &amp; Receive</option>
<option value="sendonly" translate>Send Only</option>
<option value="receiveonly" translate>Receive Only</option>
<option value="receiveencrypted" ng-disabled="editingFolderExisting()" translate>Receive Encrypted</option>
</select>
<p ng-if="currentFolder.type == 'sendonly'" translate class="help-block">Files are protected from changes made on other devices, but changes made on this device will be sent to the rest of the cluster.</p>
<p ng-if="currentFolder.type == 'receiveonly'" translate class="help-block">Files are synchronized from the cluster, but any changes made locally will not be sent to other devices.</p>
<p ng-if="currentFolder.type == 'receiveencrypted'" translate class="help-block" translate-value-receive-encrypted="{{friendlyNameFromFolderType('receiveencrypted')}}">Stores and syncs only encrypted data. Folders on all connected devices need to be set up with the same password or be of type "{%receiveEncrypted%}" too.</p>
<p ng-if="editingFolderExisting() && currentFolder.type == 'receiveencrypted'" translate class="help-block" translate-value-receive-encrypted="{{friendlyNameFromFolderType('receiveencrypted')}}">Folder type "{%receiveEncrypted%}" cannot be changed after adding the folder. You need to remove the folder, delete or decrypt the data on disk, and add the folder again.</p>
<p ng-if="editingFolderExisting() && currentFolder.type != 'receiveencrypted'" translate class="help-block" translate-value-receive-encrypted="{{friendlyNameFromFolderType('receiveencrypted')}}">Folder type "{%receiveEncrypted%}" can only be set when adding a new folder.</p>
<p ng-if="currentFolder.type == 'receiveencrypted'" translate class="help-block" translate-value-receive-encrypted="{{'Receive Encrypted' | translate}}">Stores and syncs only encrypted data. Folders on all connected devices need to be set up with the same password or be of type "{%receiveEncrypted%}" too.</p>
<p ng-if="editingFolderExisting() && currentFolder.type == 'receiveencrypted'" translate class="help-block" translate-value-receive-encrypted="{{'Receive Encrypted' | translate}}">Folder type "{%receiveEncrypted%}" cannot be changed after adding the folder. You need to remove the folder, delete or decrypt the data on disk, and add the folder again.</p>
<p ng-if="editingFolderExisting() && currentFolder.type != 'receiveencrypted'" translate class="help-block" translate-value-receive-encrypted="{{'Receive Encrypted' | translate}}">Folder type "{%receiveEncrypted%}" can only be set when adding a new folder.</p>
</div>
<div class="col-md-6 form-group">
<label translate>File Pull Order</label>
Expand All @@ -251,7 +251,7 @@
<select class="form-control" ng-if="currentFolder.type == 'sendonly'" disabled>
<option value="disabled" translate>Disabled</option>
</select>
<p class="help-block" ng-if="currentFolder.type == 'sendonly'" translate translate-value-foldertype="{{friendlyNameFromFolderType(currentFolder.type)}}">
<p class="help-block" ng-if="currentFolder.type === 'sendonly'" translate translate-value-foldertype="{{'Send Only' | translate}}">
Cannot be enabled when the folder type is "{%foldertype%}".
</p>
</div>
Expand Down Expand Up @@ -285,8 +285,8 @@
<p translate class="help-block">
Disables comparing and syncing file permissions. Useful on systems with nonexistent or custom permissions (e.g. FAT, exFAT, Synology, Android).
</p>
<p class="help-block" ng-if="currentFolder._recvEnc" translate translate-value-foldertype="{{friendlyNameFromFolderType(currentFolder.type)}}">
Always enabled when the folder type is "{%foldertype%}".
<p class="help-block" ng-if="currentFolder._recvEnc" translate translate-value-foldertype="{{'Receive Encrypted' | translate}}">
Always turned on when the folder type is "{%foldertype%}".
</p>
</div>
</div>
Expand All @@ -303,7 +303,7 @@
<p translate class="help-block">
Enables sending ownership information to other devices, and applying incoming ownership information. Typically requires running with elevated privileges.
</p>
<p class="help-block" ng-if="currentFolder.type == 'sendonly' || currentFolder.type == 'receiveencrypted'" translate translate-value-foldertype="{{friendlyNameFromFolderType(currentFolder.type)}}">
<p class="help-block" ng-if="has(['sendonly', 'receiveencrypted'], currentFolder.type)" translate translate-value-foldertype="{{currentFolder.type === 'sendonly' ? ('Send Only' | translate) : currentFolder.type === 'receiveencrypted' ? ('Receive Encrypted' | translate) : ''}}">
Cannot be enabled when the folder type is "{%foldertype%}".
</p>
<label>
Expand All @@ -312,7 +312,7 @@
<p translate class="help-block">
Enables sending ownership information to other devices, but not applying incoming ownership information. This can have a significant performance impact. Always enabled when "Sync Ownership" is enabled.
</p>
<p class="help-block" ng-if="currentFolder.type == 'receiveonly' || currentFolder.type == 'receiveencrypted'" translate translate-value-foldertype="{{friendlyNameFromFolderType(currentFolder.type)}}">
<p class="help-block" ng-if="has(['receiveonly', 'receiveencrypted'], currentFolder.type)" translate translate-value-foldertype="{{currentFolder.type === 'receiveonly' ? ('Receive Only' | translate) : currentFolder.type === 'receiveencrypted' ? ('Receive Encrypted' | translate) : ''}}">
Cannot be enabled when the folder type is "{%foldertype%}".
</p>
</div>
Expand All @@ -327,7 +327,7 @@
<p translate class="help-block">
Enables sending extended attributes to other devices, and applying incoming extended attributes. May require running with elevated privileges.
</p>
<p class="help-block" ng-if="currentFolder.type == 'sendonly' || currentFolder.type == 'receiveencrypted'" translate translate-value-foldertype="{{friendlyNameFromFolderType(currentFolder.type)}}">
<p class="help-block" ng-if="has(['sendonly', 'receiveencrypted'], currentFolder.type)" translate translate-value-foldertype="{{currentFolder.type === 'sendonly' ? ('Send Only' | translate) : currentFolder.type === 'receiveencrypted' ? ('Receive Encrypted' | translate) : ''}}">
Cannot be enabled when the folder type is "{%foldertype%}".
</p>
<label>
Expand All @@ -336,7 +336,7 @@
<p translate class="help-block">
Enables sending extended attributes to other devices, but not applying incoming extended attributes. This can have a significant performance impact. Always enabled when "Sync Extended Attributes" is enabled.
</p>
<p class="help-block" ng-if="currentFolder.type == 'receiveonly' || currentFolder.type == 'receiveencrypted'" translate translate-value-foldertype="{{friendlyNameFromFolderType(currentFolder.type)}}">
<p class="help-block" ng-if="has(['receiveonly', 'receiveencrypted'], currentFolder.type)" translate translate-value-foldertype="{{currentFolder.type === 'receiveonly' ? ('Receive Only' | translate) : currentFolder.type === 'receiveencrypted' ? ('Receive Encrypted' | translate) : ''}}">
Cannot be enabled when the folder type is "{%foldertype%}".
</p>
</div>
Expand Down
2 changes: 1 addition & 1 deletion gui/default/syncthing/folder/revertOverrideView.html
Expand Up @@ -7,7 +7,7 @@
<div ng-switch-when="deleteEnc">
<p>
<span translate>Unexpected items have been found in this folder.</span>
<span translate translate-value-receive-encrypted="{{friendlyNameFromFolderType('receiveencrypted')}}">You should never add or change anything locally in a "{%receiveEncrypted%}" folder.</span>
<span translate translate-value-receive-encrypted="{{'Receive Encrypted' | translate}}">You should never add or change anything locally in a "{%receiveEncrypted%}" folder.</span>
</p>
<p translate>
Are you sure you want to permanently delete all these files?
Expand Down
Expand Up @@ -5,7 +5,7 @@
</p>
<p ng-switch-when="receiveencrypted">
<span translate>The following unexpected items were found.</span>
<span translate translate-value-receive-encrypted="{{friendlyNameFromFolderType('receiveencrypted')}}">You should never add or change anything locally in a "{%receiveEncrypted%}" folder.</span>
<span translate translate-value-receive-encrypted="{{'Receive Encrypted' | translate}}">You should never add or change anything locally in a "{%receiveEncrypted%}" folder.</span>
</p>
<table class="table table-striped">
<thead>
Expand Down

0 comments on commit 3299f4f

Please sign in to comment.